Run Relay on Synology or QNAP
Run Viaalink Relay on a Synology NAS with the Viaalink Relay package or Container Manager, or on a QNAP NAS with Container Station, using the Docker Compose setup.
Overview
On a Synology NAS you can install the Viaalink Relay package (.spk), which sets everything up for you; see Synology: the Viaalink Relay package. It is not in Package Center: you download it and install it by hand.
On a QNAP NAS, and on a Synology NAS without the package, you run the Viaalink Relay container image with the NAS’s own Docker app: Container Manager on Synology, Container Station on QNAP. You use the same Docker Compose setup as in Run Relay with Docker, with the changes on this page from Requirements on.
The container image is public on the GitHub Container Registry: ghcr.io/viaalink/relay (latest, or a version tag such as 1.39.0), and the same image on Docker Hub as viaalink/viaalink-relay. You can pull it without an account.
Synology: the Viaalink Relay package
The package runs the same Relay container image through Container Manager. It carries the image inside the .spk, so the install needs no internet access.
Requirements
- DSM 7.2 or later, with Container Manager 20.10.23-1432 or later from Package Center. If Package Center does not list Container Manager for your model, it cannot run the package.
- A 64-bit processor: one
.spkfor x86-64 models (ViaalinkRelay-x86_64-<version>.spk) and one for ARM64 models (ViaalinkRelay-armv8-<version>.spk). - A domain you control with wildcard DNS (see DNS Configuration).
Download
Every Viaalink Relay release comes with the Synology package. Download it here, or from the public releases page, github.com/viaalink/relay/releases. For Viaalink Relay 1.40.5 (Synology package 1.40.5-0001):
- ViaalinkRelay-x86_64-1.40.5-0001.spk for x86-64 models (Intel and AMD)
- ViaalinkRelay-armv8-1.40.5-0001.spk for ARM64 models
- The checksums of the packages
The package is not in Synology’s Package Center: you install it by hand, as below.
Install
- Install Container Manager from Package Center.
- In Package Center, click Manual Install, choose the
.spkfor your NAS’s processor, and click Next. DSM asks you to confirm installing a package that Synology has not signed. - Accept the license agreement and finish the installation.
- When the installation finishes, open the
viaalink-relayshared folder in File Station and openCREDENTIALS.txt. It holds the dashboard address and the setup code. - Open Viaalink Relay from the DSM main menu. It opens the Relay dashboard at
http://<your-NAS>:28081/_relay/dashboard. Enter the setup code, then add your domain and activate the license as described in Relay Licensing.
Ports
The package registers its ports with DSM, so they appear under Control Panel › Security › Firewall and in the router port forwarding wizard (Control Panel › External Access › Router Configuration):
| Port | Protocol | For |
|---|---|---|
28022 | TCP | Devices connecting to the Relay |
28081 | TCP | The Relay dashboard and web traffic |
28443 | TCP | HTTPS |
3478 | UDP | Calls through firewalls |
Forward the ones you use from your router to the NAS.
Keys and license
The Relay’s keys, certificates and license are kept in the package’s own data folder, readable only by the package. The viaalink-relay shared folder holds CREDENTIALS.txt only.
Updating the package
The package is not in Package Center, so DSM does not offer updates for it. The Relay’s dashboard shows when a newer version exists. To update, download the newer .spk from the releases page and install it with Manual Install over the installed one. The keys, devices, domain, license and ports are kept (checked from 1.39 to 1.40.3 on a DS920+). The update steps the dashboard prints are for a Docker Compose install; on the package, use Manual Install.
Uninstalling
Do not count on an uninstall to wipe the Relay: on DSM 7.4.1, uninstalling left the package’s data folder in place, and a new install came back with the old keys, license and settings.
Requirements
- Synology: DSM 7.2 or later with the Container Manager package. Projects (Docker Compose) are part of Container Manager, which needs DSM 7.2. Open Package Center and search for Container Manager. If it is not listed, your model cannot run containers. Many value and “j” models with an ARM processor do not have it.
- QNAP: QTS or QuTS hero with Container Station from App Center. If App Center does not list Container Station for your model, it cannot run containers.
- A 64-bit processor: x86-64 (amd64) or ARM64. The image is built for
amd64andarm64only. NAS models with a 32-bit ARM processor cannot run it. - A domain you control with wildcard DNS (see DNS Configuration).
- At least 128 MB of free RAM (256 MB recommended).
- SSH access to the NAS for one check in step 3 (DSM: Control Panel › Terminal & SNMP; QTS: Control Panel › Network & File Services › Telnet / SSH).
1. Prepare a folder on the NAS
Create a shared folder for the Relay, for example docker/viaalink-relay, with these subfolders:
viaalink-relay/
data/keys/
data/pubkeys/
data/ssl/
data/license/Put the files from Run Relay with Docker in the viaalink-relay folder: docker-compose.yml, Dockerfile.caddy, Caddyfile, and data/config.yml.
2. Ports: Caddy on 8080 and 8443
DSM and QTS use ports 80 and 443 for their own web server, so Caddy cannot take them on the NAS. Publish Caddy on NAS ports 8080 and 8443 instead. In docker-compose.yml, change the caddy service:
caddy:
ports:
- "8080:80"
- "8443:443"
- "8443:443/udp"Then set these port forwarding rules on your router:
| External port | To the NAS | What it is for |
|---|---|---|
80/tcp | port 8080 | HTTP and the redirect to HTTPS |
443/tcp | port 8443 | HTTPS for every published address |
2222/tcp | port 2222 | Clients that connect to the Relay |
3478/udp | port 3478 | Call control (optional) |
Visitors still use the normal ports 80 and 443. The Compose file already tells the Relay that Caddy handles HTTPS (VIAALINK_RELAY_PROXY_SSL_TERMINATION) and which addresses Caddy sends from (VIAALINK_RELAY_TRUSTED_PROXIES). Because the public port stays 443, you do not need --https-port-override.
The call media port range 49152–49167/udp is not published by this Compose file, so calls through firewalls do not work with this setup. See Requirements and Network Architecture and Relay Ports.
3. Tie the license to the NAS
A license is activated on one machine. The Relay needs a stable ID of the NAS for that. Pick one of the two ways below.
Check for a machine ID
Some NAS systems do not have /etc/machine-id. Check it over SSH:
test -s /etc/machine-id && echo "machine ID found" || echo "no machine ID"Do not mount /etc/machine-id when this says no machine ID. Docker then creates an empty folder in its place, and license activation fails.
Way A: the machine ID (the NAS has one)
The Compose file from Run Relay with Docker already has this line under volumes: of the relay service. Keep it:
- /etc/machine-id:/run/host/machine-id:roWay B: the network card, with host networking (no machine ID)
With VIAALINK_RELAY_HOST_ID_SOURCE=nic (or --host-id-source=nic), the Relay ties the license to the factory addresses of the NAS’s network cards. It can only see those cards with host networking. On the relay-net network, activation fails with no physical (PCI) network card. If you replace or add a network card later, you activate again.
Replace the relay service with this one. It has no ports: and no networks:, because with host networking the Relay listens on the NAS itself:
relay:
image: ghcr.io/viaalink/relay:latest
container_name: viaalink-relay
restart: unless-stopped
network_mode: host
environment:
VIAALINK_RELAY_DOMAIN: relay.example.com
VIAALINK_RELAY_SSH_ADDRESS: ":2222"
VIAALINK_RELAY_HTTP_ADDRESS: ":8081"
VIAALINK_RELAY_PROXY_SSL_TERMINATION: "true"
VIAALINK_RELAY_TRUSTED_PROXIES: "127.0.0.1,172.24.0.0/24"
VIAALINK_RELAY_AUTHENTICATION: "true"
VIAALINK_RELAY_BIND_RANDOM_SUBDOMAINS: "true"
VIAALINK_RELAY_LICENSE_KEY_FILE: "/app/deploy/license/license.jwt"
VIAALINK_RELAY_HOST_ID_SOURCE: "nic"
VIAALINK_RELAY_LOG_JSON: "true"
VIAALINK_RELAY_LOG_TO_STDOUT: "true"
volumes:
- ./data/keys:/app/deploy/keys
- ./data/pubkeys:/app/deploy/pubkeys
- ./data/ssl:/app/deploy/ssl
- ./data/license:/app/deploy/license
- ./data/config.yml:/app/config.ymlThe Relay’s HTTP listener is on NAS port 8081, because Caddy already uses 8080. Caddy stays on relay-net and reaches the Relay through the NAS. Add this to the caddy service:
extra_hosts:
- "host.docker.internal:host-gateway"In the Caddyfile, change reverse_proxy relay:8080 { to:
reverse_proxy host.docker.internal:8081 {In data/config.yml, change http-address: :8080 to http-address: :8081.
If the log still says no physical (PCI) network card, the NAS’s network port is not a PCI card. Then use an ID file. Create it once with cat /proc/sys/kernel/random/uuid > data/license/host-id and keep it with your backups. Set VIAALINK_RELAY_HOST_ID_FILE: "/app/deploy/license/host-id" instead of VIAALINK_RELAY_HOST_ID_SOURCE. Never change that file after activation.
4. Pick a free network range
The Compose file gives relay-net the fixed range 172.24.0.0/24. If another network on the NAS already uses that range, the project does not start. See the ranges in use in Container Manager under Network, or over SSH with docker network ls and docker network inspect <name>.
To use another range, for example 172.30.99.0/24, change it in three places:
subnet:undernetworks:indocker-compose.yml.VIAALINK_RELAY_TRUSTED_PROXIESindocker-compose.yml.trusted-proxies:indata/config.yml.
5a. Synology: Container Manager
- Open Container Manager and go to Project.
- Click Create, give the project a name (for example
viaalink-relay), and set Path to theviaalink-relayfolder. - Choose to use the existing
docker-compose.ymlin that folder, review the settings, and finish the wizard. Container Manager builds the Caddy image and starts both containers. - Open the log of the
viaalink-relaycontainer and find the setup code (see step 6).
5b. QNAP: Container Station
- Open Container Station and go to Applications.
- Click Create, name the application (for example
viaalink-relay), and paste the contents of yourdocker-compose.yml. - Relative paths such as
./data/keysare not guaranteed to point at your shared folder when you paste the file. Replace each./data/...,./Caddyfileand the buildcontext: .with the absolute path of yourviaalink-relayfolder (on QNAP shared folders live under/share/, for example/share/Container/viaalink-relay/data/keys). - Click Create. Open the log of the
viaalink-relaycontainer and find the setup code (see step 6).
6. Find the setup code
The Relay writes the setup code to its container log, in a line that starts with:
Setup dashboard token:The code follows on the same line. The Relay makes a new code each time it starts, so use the newest line. The code is also written to data/license/setup-token.txt, but only root can read that file, so File Station cannot open it.
7. Open the setup dashboard
You can sign in to the dashboard in two ways.
On your own network, before DNS and the router are ready. The Compose file does not publish the Relay’s HTTP port on the NAS. To sign in from a computer on your network first, add a port to the relay service:
ports:
- "2222:2222"
- "3478:3478/udp"
- "8081:8080"Then open http://<nas-ip>:8081/_relay/dashboard?x-authorization=<setup-code>. With Way B (host networking) the Relay already listens on NAS port 8081, so open the same address without adding a port. Do not forward port 8081 on your router. You can remove the extra port again after setup.
Over the internet. This works once DNS, the router rules from step 2, Caddy and its certificate are in place. Open:
https://relay.example.com/_relay/dashboard?x-authorization=<setup-code>Settings that need a restart (ports, domain, HTTPS, IP and country rules) make the Relay stop itself; the restart: unless-stopped policy in the Compose file starts it again within seconds. The dashboard shows a restart bar with options: Restart now, Tonight at …, or Undo. Restart now stops the Relay and Compose starts it again. Settings in config.yml that the Compose file also sets as environment variables are overridden by those variables, so keep domain and ports in config.yml only.
Updating
Pull the new image first, then recreate the containers. Recreating alone can keep using the image that is already on the NAS.
- Container Manager: download the new
ghcr.io/viaalink/relayimage (under Registry or Image), then select the project and use Action to stop it and build it again. - Container Station: pull the new image, then recreate the application.
- Over SSH, in the
viaalink-relayfolder:docker compose pull && docker compose up -d.
Your data/ folder is kept, including host keys, approved keys, and the license.
Next steps
- Back up the
data/folder as described in Relay Operations and Maintenance. - Authorize client keys in Access Control and Security.
- Activate a paid plan in Relay Licensing.