|
20 | 20 |
|
21 | 21 | </div> |
22 | 22 |
|
23 | | -## Install |
| 23 | +# Installation |
24 | 24 |
|
25 | | -**1. Download required files** |
| 25 | +## Prerequisites |
26 | 26 |
|
27 | | -Get the `docker-compose.yml` and `Caddyfile` from the **deploy** folder. |
| 27 | +- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) installed |
| 28 | +- Python 3 (for generating the secret key) |
28 | 29 |
|
29 | | -**2. Generate a secure secret key** |
| 30 | +## Quick Start |
30 | 31 |
|
31 | | -Run the following command to generate a 32-byte base64-encoded secret: |
| 32 | +### Option 1: HTTP (Local Development) |
32 | 33 |
|
33 | | -``` |
34 | | -python3 -c "import secrets, base64; print(base64.b64encode(secrets.token_bytes(32)).decode())" |
35 | | -``` |
| 34 | +**1. Download the required files** |
36 | 35 |
|
37 | | -**3. Configure the secret key** |
| 36 | +Get [docker-compose.yml](deploy/docker-compose.yml) from the `deploy` folder. |
38 | 37 |
|
39 | | -Open `docker-compose.yml` and replace **both occurrences** of `<SECRET_KEY>` with the generated value from the previous step. |
| 38 | +**2. Generate a secret key** |
40 | 39 |
|
41 | | -**Example:** |
| 40 | +Run the following command to generate a secure 32-byte base64-encoded secret: |
42 | 41 |
|
| 42 | +```bash |
| 43 | +python3 -c "import secrets, base64; print(base64.b64encode(secrets.token_bytes(32)).decode())" |
43 | 44 | ``` |
| 45 | + |
| 46 | +**3. Configure the secret** |
| 47 | + |
| 48 | +Open `docker-compose.yml` and replace **both occurrences** of `<SECRET_KEY>` with the generated value. |
| 49 | + |
| 50 | +Example: |
| 51 | +```yaml |
44 | 52 | ... |
45 | 53 | - --static-auth-secret=/RaFOHJQQPAAXRNdaDhfBghvX9+o9UJEazKgIopK3TI= |
46 | 54 | ... |
47 | 55 | - SECRET_KEY=/RaFOHJQQPAAXRNdaDhfBghvX9+o9UJEazKgIopK3TI= |
48 | 56 | ... |
49 | 57 | ``` |
50 | 58 |
|
51 | | -**4. (Optional) Enable HTTPS** |
| 59 | +**4. Start FileSync** |
| 60 | + |
| 61 | +```bash |
| 62 | +docker-compose up -d |
| 63 | +``` |
| 64 | + |
| 65 | +Access FileSync at `http://localhost:80` |
| 66 | + |
| 67 | +### Option 2: HTTPS (Production with Custom Domain) |
| 68 | + |
| 69 | +**1. Download the required files** |
52 | 70 |
|
53 | | -To enable HTTPS, edit the `Caddyfile`: |
| 71 | +Get [docker-compose-ssl.yml](deploy/docker-compose-ssl.yml) and [Caddyfile](deploy/Caddyfile) from the `deploy` folder. |
54 | 72 |
|
55 | | -- Replace `:80` with your domain (e.g., `filesync.app`). |
| 73 | +**2. Generate a secret key** |
| 74 | + |
| 75 | +Run the following command to generate a secure 32-byte base64-encoded secret: |
| 76 | + |
| 77 | +```bash |
| 78 | +python3 -c "import secrets, base64; print(base64.b64encode(secrets.token_bytes(32)).decode())" |
| 79 | +``` |
| 80 | + |
| 81 | +**3. Configure the secret** |
| 82 | + |
| 83 | +Open `docker-compose-ssl.yml` and replace **both occurrences** of `<SECRET_KEY>` with the generated value. |
| 84 | + |
| 85 | +Example: |
| 86 | +```yaml |
| 87 | +... |
| 88 | +- --static-auth-secret=/RaFOHJQQPAAXRNdaDhfBghvX9+o9UJEazKgIopK3TI= |
| 89 | +... |
| 90 | +- SECRET_KEY=/RaFOHJQQPAAXRNdaDhfBghvX9+o9UJEazKgIopK3TI= |
| 91 | +... |
| 92 | +``` |
56 | 93 |
|
57 | | -Caddy will automatically provision and renew SSL certificates for your domain. |
| 94 | +**4. Configure your domain** |
58 | 95 |
|
59 | | -**Example:** |
| 96 | +Open `Caddyfile` and replace `yourdomain.com` with your actual domain. |
60 | 97 |
|
| 98 | +Example: |
61 | 99 | ``` |
62 | 100 | filesync.app { |
63 | 101 | reverse_proxy filesync:80 |
64 | 102 | } |
65 | 103 | ``` |
66 | 104 |
|
67 | | -**5. Start the services** |
68 | | - |
69 | | -Run the following command to start everything in detached mode: |
| 105 | +**5. Start FileSync** |
70 | 106 |
|
71 | | -``` |
72 | | -docker-compose up -d |
| 107 | +```bash |
| 108 | +docker-compose -f docker-compose-ssl.yml up -d |
73 | 109 | ``` |
74 | 110 |
|
75 | | -**6. Access the application** |
| 111 | +Caddy will automatically obtain and manage SSL certificates from Let's Encrypt. |
76 | 112 |
|
77 | | -Once the services are up; |
| 113 | +Access FileSync at `https://yourdomain.com` |
78 | 114 |
|
79 | | -- For local testing, open your browser at: |
| 115 | +## Stopping FileSync |
80 | 116 |
|
81 | | -``` |
82 | | -http://localhost |
| 117 | +```bash |
| 118 | +# For HTTP setup |
| 119 | +docker-compose down |
| 120 | + |
| 121 | +# For HTTPS setup |
| 122 | +docker-compose -f docker-compose-ssl.yml down |
83 | 123 | ``` |
84 | 124 |
|
85 | | -- If using a domain, open: |
| 125 | +## Required Ports |
86 | 126 |
|
87 | | -``` |
88 | | -https://yourdomain |
89 | | -``` |
| 127 | +To expose FileSync to the internet, ensure the following ports are open on your server/firewall: |
| 128 | + |
| 129 | +### HTTP Setup |
| 130 | +- **Port 80** (TCP) - Web interface |
| 131 | +- **Port 3478** (TCP + UDP) - STUN/TURN server for WebRTC |
| 132 | + |
| 133 | +### HTTPS Setup |
| 134 | +- **Port 443** (TCP) - Web interface (HTTPS) |
| 135 | +- **Port 3478** (TCP + UDP) - STUN/TURN server for WebRTC |
| 136 | + |
| 137 | +> **Note:** Port 3478 is essential for establishing peer-to-peer connections, especially when devices are behind NAT/firewalls. |
| 138 | +
|
| 139 | +## Customizing Ports |
90 | 140 |
|
91 | | -## Uninstall (Optional) |
| 141 | +### Changing the HTTP Port |
92 | 142 |
|
93 | | -To stop and remove the containers, run: |
| 143 | +By default, FileSync uses port 80. To use a different port (e.g., 8080): |
94 | 144 |
|
| 145 | +**1. Edit `docker-compose.yml`** |
| 146 | + |
| 147 | +Find the `ports` section under the `filesync` service: |
| 148 | + |
| 149 | +```yaml |
| 150 | +ports: |
| 151 | + - "80:80" |
95 | 152 | ``` |
96 | | -docker-compose down |
| 153 | +
|
| 154 | +Change the **first** port number to your desired port: |
| 155 | +
|
| 156 | +```yaml |
| 157 | +ports: |
| 158 | + - "8080:80" |
97 | 159 | ``` |
98 | 160 |
|
| 161 | +**2. Access FileSync** |
| 162 | +
|
| 163 | +Access FileSync at `http://localhost:8080` (or your server IP with the new port). |
| 164 | + |
| 165 | +> **Note:** The second port number (80) should remain unchanged as it refers to the internal container port. |
| 166 | + |
| 167 | +### Changing the HTTPS Port |
| 168 | + |
| 169 | +To use a custom external port, deploy a separate reverse proxy (Nginx, Traefik, or standalone Caddy) that: |
| 170 | +- Listens on port 443 with SSL termination |
| 171 | +- Forwards traffic to FileSync on your custom internal HTTP port |
| 172 | + |
| 173 | +This approach maintains standard HTTPS on port 443 while allowing flexible internal port configuration. |
| 174 | + |
99 | 175 | ## Under the hood |
100 | 176 |
|
101 | 177 | FileSync uses [PeerJS](https://github.com/peers/peerjs) (a WebRTC wrapper) to transfer files between multiple devices. Files shared are peer-to-peer, which means there is a direct file transfer between the sender and receiver without any intermediate server. Your files remain private and secure throughout the entire transfer process. |
102 | 178 |
|
103 | | -Do note that a [PeerJS server](https://github.com/peers/peerjs-server) is used to assist in the initial connection setup, ensuring all users can establish peer-to-peer connections effectively. Once the connections are established, the server steps back, allowing the direct transfer of files between the sender and the receiver. At no point during this process does the server have access to the file contents. It solely facilitates the connection between users without compromising the privacy or security of the files being shared. |
104 | | - |
105 | 179 |  |
0 commit comments