A Syncthing relay server with more options
2.0K
Find me at:
Syncthing relies on a network of community-contributed relay servers. Anyone can run a relay server, and it will automatically join the relay pool and be available to Syncthing users. The current list of relays can be found at this link 1.
Simply pulling chucky2401/syncrelay:tagversion should retrieve the correct
image for your arch.
To help you get started creating a container from this image you can either use docker compose or the docker cli.
services:
syncrelay:
image: chucky2401/syncrelay:v2.0.16
container_name: syncrelay
environment:
- TZ=Etc/UTC
volumes:
- ./strelaysrv:/var/strelaysrv
ports:
- 22067:22067
- 22070:22070
restart: unless-stopped
docker run -d \
--name=syncrelay \
-e TZ=Etc/UTC \
-p 22067:22067 \
-p 22070:22070 \
-v ./strelaysrv:/var/strelaysrv
--restart unless-stopped \
chucky2401/syncrelay:v2.0.16
Containers are configured using parameters passed at runtime (such as those
above). These parameters are separated by a colon and indicate
<external>:<internal> respectively. For example, -p 8080:80 would expose
port 80 from inside the container to be accessible from the host's IP on port
8080 outside the container.
| Parameter | Default | Function |
|---|---|---|
-p 22067 | N/A | Relay advertising |
-p 22070 | N/A | Port to retrieve statistics |
-e TZ=Etc/UTC | N/A | specify a timezone to use, see this list. |
-e TOKEN=MyToken | Empty | Set a token to securing your relay. Disables joining any pools. |
-e PRIVATE= | Empty | Set to True to make your relay private. It will not announced itself to the pool. If not set, it will announce to the default pool (https://relays.syncthing.net/endpoint) |
-e PORT= | 22067 | If you set a different port on the host side to inform the server - see below for example |
-e EXTERNAL_ADDRESS= | Empty | If you want to fix the address of your relay |
-e DEBUG= | Empty | Set to True to enable debug output of the binary |
-e NAT= | Empty | Set to True to enable UPnP/NAT-PNP |
-v /var/strelaysrv | N/A | Configuration files. |
For the TOKEN environment variable, you can use a Docker secret.
As an example:
-e TOKEN=/run/secrets/mysupertoken
Will set the environment variable TOKEN based on the contents of the
/run/secrets/mysupertoken file.
Note: I recommend you to use this format to pass your token to your container.
Example:
services:
syncrelay:
image: chucky2401/syncrelay:v2.0.16
container_name: syncrelay
environment:
- TZ=Etc/UTC
- TOKEN=/run/secrets/mysupertoken
secrets:
- mysupertoken
volumes:
- ./strelaysrv:/var/strelaysrv
ports:
- 22067:22067
- 22070:22070
restart: unless-stopped
secrets:
mysupertoken:
file: ./secrets/token_file
In my case, my company authorize in the firewall only ports: 80, 443 and 8080 to the outside.
I need to use the relay on one of the three ports. In my case, only the 8080 is available at home.
So I use this docker compose file:
services:
syncrelay:
image: chucky2401/syncrelay:v2.0.16
container_name: syncrelay
environment:
- TZ=Etc/UTC
- SECRET_TOKEN=/run/secrets/mysupertoken
- PORT=8080
secrets:
- mysupertoken
volumes:
- ./strelaysrv:/var/strelaysrv
ports:
- 22067:22067
- 22070:22070
restart: unless-stopped
secrets:
mysupertoken:
file: ./secrets/token_file
In this case, strelaysrv is started with the argument -ext-address=:80802, because the server needs to know on which port the client will try to contact it.
Note: I also use NPM (NGinX Proxy Manager)3 to stream the port 8080 to the port 22067 of my Docker host.
If you're not using a reverse proxy, you need to map the port to yours:
ports:
- 8080:22067
You can use the user instruction in the compose file:
services:
syncrelay:
image: chucky2401/syncrelay:v2.0.16
[...]
user: 1000:993
You nee to set the exact same identifier on the directory for the volume mount:
chown 1000:993 ./strelaysrv
Text grab from the official documentation ↩
:8080 is equivalent to 0.0.0.0:8080 for all interfaces ↩
Content type
Image
Digest
sha256:a49e1e3ed…
Size
13.2 MB
Last updated
5 days ago
docker pull chucky2401/syncrelay