chucky2401/syncrelay

By chucky2401

Updated 5 days ago

A Syncthing relay server with more options

Image
Networking
1

2.0K

chucky2401/syncrelay repository overview

SyncRelay-Srv

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.

syncthing

Supported Architectures

Simply pulling chucky2401/syncrelay:tagversion should retrieve the correct image for your arch.

Usage

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 cli (click here for more info)
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

Parameters

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.

ParameterDefaultFunction
-p 22067N/ARelay advertising
-p 22070N/APort to retrieve statistics
-e TZ=Etc/UTCN/Aspecify a timezone to use, see this list.
-e TOKEN=MyTokenEmptySet a token to securing your relay. Disables joining any pools.
-e PRIVATE=EmptySet 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=22067If you set a different port on the host side to inform the server - see below for example
-e EXTERNAL_ADDRESS=EmptyIf you want to fix the address of your relay
-e DEBUG=EmptySet to True to enable debug output of the binary
-e NAT=EmptySet to True to enable UPnP/NAT-PNP
-v /var/strelaysrvN/AConfiguration files.

Environment variables from files (Docker secrets)

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

Using the port variable

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

Changing running user

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

Footnotes

  1. Text grab from the official documentation

  2. :8080 is equivalent to 0.0.0.0:8080 for all interfaces

  3. NGinX Proxy Manager

Tag summary

Content type

Image

Digest

sha256:a49e1e3ed

Size

13.2 MB

Last updated

5 days ago

docker pull chucky2401/syncrelay