RELAYLINK

Docker Compose deployment

This guide targets Linux Docker Engine. Because RelayLink Server dynamically binds proxy listener ports based on channel configuration, the default Compose definition uses network_mode: host. Docker Desktop and non-Linux container engines are not supported targets.

Quick Start

Prerequisites: Docker Engine, Docker Compose v2, and PowerShell 7 (pwsh).

pwsh ./scripts/start-server-compose.ps1 -AgentServerHost tunnel.example.com

On first run, the script automatically:

  1. Creates .local/docker-server/config/clients and .local/docker-server/data (plus the logs subdirectory).
  2. Prompts interactively for the administrator password and stores only its PBKDF2-SHA256 hash.
  3. Generates .local/docker-server/config/server.json.
  4. Builds the container image and runs --check-config inside a temporary container.
  5. Starts relaylink-server in detached mode once preflight checks pass.

Subsequent runs preserve existing configuration and SQLite data. Default endpoints:

  • Admin Dashboard: http://127.0.0.1:18080/
  • Agent Control Port: 7443/tcp
  • Agent Data Port: 7444/tcp

Loopback Dashboard Boundary: The starter configuration binds dashboard.listenAddress to 127.0.0.1. With network_mode: host, that is the Docker host's loopback interface—open it from a browser on the host or reach it through a co-located Agent over an end-to-end encrypted peer channel. Because the dashboard listens over plaintext HTTP, never expose or map it onto external interfaces. Binding dashboard.listenAddress to a non-loopback address emits a SECURITY warning in both error logs and stderr at startup.

Enable TLS

The generated starter configuration leaves tunnel TLS disabled and is intended only for validating standard proxy channels in controlled environments. Before production use or enabling Agent-to-Agent peer access, place your certificates in .local/docker-server/config/tls and update server.json:

{
  "tunnel": {
    "tlsEnabled": true,
    "certificatePemPath": "/etc/relaylink/tls/fullchain.pem",
    "privateKeyPemPath": "/etc/relaylink/tls/privkey.pem",
    "trustedCaPemPath": "/etc/relaylink/tls/root-ca.pem"
  }
}

Only the fields that need adjustment are shown above. Never commit private keys, live configurations, or .local state to the repository.

Common Commands

# Inspect container status and logs
docker compose -f deploy/docker/compose.yaml ps
docker compose -f deploy/docker/compose.yaml logs -f --tail 200

# Apply configuration or image updates
pwsh ./scripts/start-server-compose.ps1

# Stop the service while preserving config and database
pwsh ./scripts/stop-server-compose.ps1

If you invoke Docker Compose directly without the helper script, prepare .local/docker-server/config/server.json and an empty clients directory based on server.docker.example.json, then run:

docker compose -f deploy/docker/compose.yaml up -d --build

Networking & Storage

Item Default Details
Admin Dashboard 127.0.0.1:18080/tcp Host loopback only; plaintext HTTP—use a co-located Agent peer tunnel for remote access
Agent Control 7443/tcp Allow only from trusted Agent source IPs
Agent Data 7444/tcp Allow only from trusted Agent source IPs
Standard Channels Dynamic ports Determined by channel configuration; open host firewall rules as needed
UDP Business Channels Configured <port>/udp Pair with source-IP security groups; no port mapping needed in host mode, explicit /udp publishing required in custom bridge mode
Peer Direct STUN (Optional) Configured peerDirect.stunListenPort/udp If Server-hosted RFC 8489 STUN is enabled for preferDirect NAT traversal, allow the configured UDP port in the host firewall (or bridge override); the Server does not terminate QUIC streams (libmsquic is only needed on Linux Agents)
Runtime Identity & Hardening UID/GID 10001 Runs as non-root relaylink (10001:10001) with cap_drop: ALL, no-new-privileges:true, and read_only: true (/tmp mounted as 16 MiB tmpfs); on Linux/macOS scripts/start-server-compose.ps1 passes the host RELAYLINK_UID/RELAYLINK_GID and sets 0700/0600 permissions on directories and server.json; built-in /health/ready HEALTHCHECK
Bridge Mode Override deploy/docker/compose.bridge.yaml For static port mapping without dynamic listeners, combine docker compose -f deploy/docker/compose.yaml -f deploy/docker/compose.bridge.yaml up -d (publishes 127.0.0.1:18080, 7443/tcp, and 7444/tcp by default)
Config & Clients .local/docker-server/config Mounted at /etc/relaylink; directories must be 0700 and server.json / client JSON files 0600 (enforced by Server on write)
SQLite Data .local/docker-server/data Mounted at /var/lib/relaylink; include -wal and -shm files when backing up
Server Runtime Logs .local/docker-server/data/logs Mounted at /var/lib/relaylink/logs; server-*.jsonl retained for 14 days, server-error-*.jsonl retained indefinitely

Log Rotation & Lifecycle: RelayLink Server writes Serilog JSONL files into logs/ inside the data volume (server-*.jsonl and server-error-*.jsonl, rotated daily or at 10 MiB; Error/Critical logs are never auto-deleted). Docker Compose keeps stdout/stderr JSON logs capped at 10 MiB x 5 files for startup, preflight, and sink-failure diagnostics. Stopping containers does not remove configuration, SQLite data, or logs; never delete .local/docker-server manually without a backup.

Upgrading & Troubleshooting

Standard source update and restart:

git pull
pwsh ./scripts/start-server-compose.ps1
docker compose -f deploy/docker/compose.yaml logs --tail 200 relaylink-server

Rebuilding or restarting the container disconnects active Agent sessions and proxy connections. If the container exits immediately, inspect container logs and check .local/docker-server/config/server.json for invalid paths, port conflicts, or missing TLS files. Under network_mode: host, port conflicts occur directly on the Docker host and can be diagnosed with host networking tools.

Assisted Upgrade via Version Status

  1. Check the target upstream version and host upgrade command under Version Status in the Server Admin UI.

  2. Back up the host configuration and full SQLite data directory, preserving your existing RELAYLINK_DOCKER_ROOT, RELAYLINK_UID, RELAYLINK_GID, Compose override files, and custom flags.

  3. Check out the target release tag and inject its SemVer via RELAYLINK_VERSION (when unset, scripts/start-server-compose.ps1 reads an exact v* tag on HEAD and falls back to 0.0.0-dev for other source builds).

  4. The startup script reuses any pre-set RELAYLINK_DOCKER_ROOT. Run with -Upgrade and pass the same -ComposeFiles, -ProjectName, and -EnvFile arguments used previously (if server.json is missing, the script exits immediately to avoid accidental re-initialization):

    pwsh ./scripts/start-server-compose.ps1 -Upgrade
    
  5. Release packages pre-cached via the dashboard are stored under the mounted /var/lib/relaylink/updates/ directory for Agents. Once the Server container finishes rebuilding and configuration preflight passes, verify /health/ready and confirm Agents reconnect cleanly.

Repository source