From f8fe077c1afc4fda193ccd30766e8729e3673e00 Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Tue, 10 Nov 2026 15:29:05 +0100 Subject: [PATCH] fix(install): repair optional RustFS and coturn services --- docker/docker-compose.coturn.yml | 12 +++++++++-- docker/docker-compose.rustfs.yml | 4 ++-- docs/docker-compose.md | 11 +++++++--- skills/optional-server-services/SKILL.md | 26 ++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 skills/optional-server-services/SKILL.md diff --git a/docker/docker-compose.coturn.yml b/docker/docker-compose.coturn.yml index d5bb00b..ee2ccca 100644 --- a/docker/docker-compose.coturn.yml +++ b/docker/docker-compose.coturn.yml @@ -3,16 +3,24 @@ services: coturn: image: coturn/coturn:4.6 pull_policy: always + ports: + - "${COTURN_PORT:-3478}:3478/tcp" + - "${COTURN_PORT:-3478}:3478/udp" + - "${COTURN_RELAY_PORT_MIN:-49160}-${COTURN_RELAY_PORT_MAX:-49200}:${COTURN_RELAY_PORT_MIN:-49160}-${COTURN_RELAY_PORT_MAX:-49200}/udp" + entrypoint: ["turnserver"] command: > -n --use-auth-secret --static-auth-secret-file=/run/secrets/coturn_secret --realm=${COTURN_REALM:-heimdall.local} --fingerprint --no-tlsv1 --no-tlsv1_1 --log-file=stdout - network_mode: host + --no-cli + --listening-port=3478 + --min-port=${COTURN_RELAY_PORT_MIN:-49160} + --max-port=${COTURN_RELAY_PORT_MAX:-49200} secrets: - coturn_secret restart: unless-stopped secrets: coturn_secret: - file: ./secrets/coturn_secret + file: ./optional/secrets/coturn_secret diff --git a/docker/docker-compose.rustfs.yml b/docker/docker-compose.rustfs.yml index cb10a36..20a860d 100644 --- a/docker/docker-compose.rustfs.yml +++ b/docker/docker-compose.rustfs.yml @@ -30,9 +30,9 @@ volumes: secrets: rustfs_access_key: - file: ./secrets/rustfs_access_key + file: ./optional/secrets/rustfs_access_key rustfs_secret_key: - file: ./secrets/rustfs_secret_key + file: ./optional/secrets/rustfs_secret_key networks: heimdall-net: diff --git a/docs/docker-compose.md b/docs/docker-compose.md index 294b5eb..8bd6250 100644 --- a/docs/docker-compose.md +++ b/docs/docker-compose.md @@ -201,9 +201,14 @@ RTSPS/WHEP TCP ports and WebRTC ICE UDP port in the firewall. Add STUN URLs unde `LiveMedia:IceServers`; for TURN REST credentials set `LiveMedia:Turn:Urls` and `LiveMedia:Turn:SharedSecret`. Central returns five-minute HMAC credentials to the browser; the shared secret is never sent. -When using `docker-compose.coturn.yml`, configure the Central secret from the same -protected secret source as `docker/secrets/coturn_secret`; protect the Central -`.env` with owner-only permissions. +When using `docker-compose.coturn.yml`, the installer stores its shared secret +at `optional/secrets/coturn_secret`. Configure the matching TURN shared secret +in Central from that protected file and protect Central's `.env` with owner-only +permissions. Coturn publishes TCP/UDP 3478 and UDP relay ports 49160–49200 by +default; forward those ports through the host firewall/NAT. Set +`COTURN_RELAY_PORT_MIN` and `COTURN_RELAY_PORT_MAX` together if you need a +different relay range, and `COTURN_EXTERNAL_IP` when coturn must advertise an +address other than the container's detected address. Use Docker's default bridge network; coturn must not use `network_mode: host` when relying on published ports. Start the core project first so its external `heimdall-net` network exists, then start MediaMTX with a separate project name: diff --git a/skills/optional-server-services/SKILL.md b/skills/optional-server-services/SKILL.md new file mode 100644 index 0000000..1306a45 --- /dev/null +++ b/skills/optional-server-services/SKILL.md @@ -0,0 +1,26 @@ +--- +name: optional-server-services +description: Keep installer-managed RustFS and coturn Compose services aligned with the server installer's paths and networking. +--- + +# Installer-managed optional services + +The Linux and Windows server installers run optional Compose files with the installation root as the current directory. They save service secrets in `optional/secrets/` and pass the root `.env` for interpolation. Therefore, Compose secret `file:` entries must use `./optional/secrets/`, not `./secrets/` or paths relative to `optional/`. + +## RustFS + +- Keep `rustfs_access_key` and `rustfs_secret_key` file paths aligned with the generated files from both installers. +- Verify Compose config from the install-root working directory and ensure Docker secrets are sourced from those files. +- Keep the named data volume and shared `heimdall-net` behavior intact. + +## coturn + +- Keep `coturn_secret` sourced from `./optional/secrets/coturn_secret`. +- Use `turnserver` as the explicit image entrypoint, bridge networking, and explicit TCP/UDP listener and UDP relay port publications; the upstream image has a `turnadmin` entrypoint, and host networking cannot be combined with useful Compose port mappings. +- Keep the published relay range identical to coturn's `--min-port`/`--max-port` options. Make listener and relay settings configurable with documented defaults. +- Set `COTURN_EXTERNAL_IP` only when NAT requires coturn to advertise an explicit public address. The operator must forward the listener and relay range through firewalls/NAT. +- Do not claim public TURN reachability from a local container startup. It requires an external ICE/TURN client on a real network. + +## Acceptance + +Run both services in one uniquely named disposable Compose project using generated secrets and unique loopback listener ports. Use `docker compose --project-directory --env-file -f -p config` to prove the installer root resolves `optional/secrets/` correctly. Start RustFS and coturn; verify RustFS `/health` and S3 authentication and coturn startup plus a TURN REST authenticated allocation from a test client if available. State separately whether the real TURN allocation succeeded. Tear down only that project, verify its containers/volumes/networks are absent, and keep upstream images. No local images should be built by this recipe.