Current development documentation

These instructions describe the current development line. Application source publication is being prepared. Check the requirements and deployment status for your selected release.

Source revision bf318ffa5eb970b778e01ff387d5b4d42f867ab1

Server configuration reference

This reference explains how configuration connects the control plane, signaling, PostgreSQL, the HTTPS proxy and TURN. The complete checked-in Compose environment template appears at the end of this page, including its comments and optional settings.

Use the Docker installation guide or native Windows/Linux guide for installation order. The full build and deployment reference covers source builds, native codec prerequisites, agent enrollment and the transport design.

Where configuration is read

Docker installations use deploy/.env with the Compose files in deploy. Run Compose from that directory, or explicitly select the matching environment file. Compose substitutes variables from that file and passes the process variables declared by each service. Merely adding an arbitrary variable to deploy/.env does not guarantee it reaches a process.

Native installations use config/controlplane.env, config/signaling.env, config/relay.env and config/caddy.env in the extracted native package. The launchers read literal KEY=value lines. They do not execute shell commands, expand variables or strip quotes. Do not copy shell expressions such as $(openssl rand -hex 32) into those files: generate a value first and paste the resulting hexadecimal string.

The Compose template below uses deployment variables such as TURN_URLS; native signaling reads process names such as SIGNALING_TURN_URLS. Choose the correct names for your installation. Files containing actual keys and passwords belong outside viewer, download and source control.

Database owner and application role

Setting Used by Required relationship
MIGRATE_DATABASE_URL controlplane migrate Connect as the schema owner/admin to apply DDL. Do not give this connection to the serving application.
APP_DB_PASSWORD Migration/provisioning command Sets the password for the separate rmt_app role.
DATABASE_URL Serving control plane Connect as rmt_app, a non-owner, non-superuser role without BYPASSRLS.
POSTGRES_USER / POSTGRES_PASSWORD Compose PostgreSQL administration Owner credentials for provisioning and backups; these are not application credentials.

Tenant isolation depends on row-level security. A superuser or BYPASSRLS role bypasses that protection. Production startup refuses a privileged application connection unless an insecure override is deliberately enabled. Keep CP_INSECURE_ALLOW_PRIVILEGED_DB, CP_INSECURE_DEV and CP_INSECURE_DEV_LISTEN_ANY unset for deployed servers.

The supported migration runner records filenames and checksums in schema_migration. Apply all migrations shipped with the selected server release; do not maintain a handwritten list or silently baseline a database whose schema has not been verified. See database setup.

Persistent signing and encryption keys

Setting Purpose Consequence of changing or losing it
GRANT_ISSUER_SEED Stable Ed25519 grant issuer, 32 bytes encoded as 64 hexadecimal characters Enrolled agents pin its public key; changing it breaks that trust relationship.
DIRECTIVE_SIGNING_SEED Separate fleet-directive signing key Agents pin this public key too. Keep it stable and separate from the grant seed.
TOTP_ENCRYPTION_KEY Encrypts stored authenticator secrets Existing encrypted secrets require the original key or an intentional re-encryption procedure.
RECORDING_MASTER_KEY Wraps central recording data keys Losing a required master-key version makes those stored recordings unreadable.
RECORDING_MASTER_KEY_ID / RECORDING_MASTER_KEY_PREVIOUS Identifies the current key and retained previous versions Previous keys use id:hexkey entries separated by commas; preserve versions needed by recordings and backups.

Generate each key independently and store it persistently. Do not regenerate keys during container or service startup. The public grant key printed at control-plane startup is copied into SIGNALING_TICKET_PUBKEY; the private GRANT_ISSUER_SEED must never be supplied in its place. Keep an encrypted backup of all required keys, separately from the server. See the backup and restore runbook.

Service-to-service credentials

Control-plane setting Signaling setting Purpose
CP_DEVICE_IDENTITY_TOKEN SIGNALING_DEVICE_IDENTITY_TOKEN Matching random secret, at least 32 characters, for agent identity verification and internal directive notification.
CP_PRESENCE_TOKEN SIGNALING_PRESENCE_TOKEN Matching random secret, at least 32 characters, for online-machine presence.
CP_PRESENCE_URL Internal signaling base plus /internal/presence The private feed polled by the control plane.
CP_SIGNALING_NOTIFY_URL Internal signaling base, no /ws suffix Optional immediate directive notification; otherwise a directive waits for the agent's next registration.
Not applicable SIGNALING_DEVICE_IDENTITY_URL Internal control-plane base URL used by signaling; it is not the public /ws endpoint.

For native processes on one host, internal URLs normally use 127.0.0.1 and ports 8080/8081. Inside Compose, use service names such as signaling and controlplane. Those names are not public DNS names and cannot be handed to remote browsers or agents. Rotate each paired credential on both services together.

Public addresses, proxy routes and client IPs

Setting or route Meaning
SITE_ADDRESS Hostname served by the HTTPS proxy, for example remote.example.com. DNS must already reach that proxy.
CP_SIGNALING_URL Public browser/agent address, for example wss://remote.example.com/ws.
CP_PUBLIC_ORIGIN Public HTTPS origin for recording-upload signatures, scheme and host only, without /cp or another path.
SIGNALING_ALLOWED_ORIGINS Exact allowed browser origins, including scheme and any nonstandard port.
CP_TRUSTED_PROXIES / SIGNALING_TRUSTED_PROXIES CIDR lists of actual proxy peers allowed to supply forwarded client addresses.
/cp/* Proxy to the control plane after stripping /cp.
/cp/internal and /cp/internal/* Refuse publicly with 404; service calls use the private control-plane listener.
/ws WebSocket proxy to signaling.
/download/* Published artifacts; a missing executable must return 404, not the SPA HTML.

For a same-host native proxy, 127.0.0.1/32 and ::1/128 describe loopback proxy peers. For Compose, use the actual trusted container-network CIDR. Avoid trusting an entire private address range simply because it is convenient. CP_TRUST_PROXY_IP=1 is the legacy mode and accepts forwarded address information from any peer that can reach the application; explicit proxy CIDRs are preferable. The same address derivation affects access restrictions, throttling and audit source addresses.

Bind native control-plane/signaling listeners to loopback unless a private multi-host topology requires another address. Do not publish PostgreSQL or raw backend ports to the internet. HTTPS terminates at the proxy; the browser console and signaling address must use compatible secure origins. See proxy source-address behavior.

TURN settings and credential limits

Compose deployment name Native signaling process name Purpose
STUN_URLS SIGNALING_STUN_URLS Public STUN URL list.
TURN_URLS SIGNALING_TURN_URLS Comma-separated public TURN URLs, including TCP/TLS where needed.
TURN_SHARED_SECRET SIGNALING_TURN_SECRET Must match coturn's static authentication secret.
TURN_TTL SIGNALING_TURN_TTL Short-lived credential lifetime; current source default is 2h.
TURN_MAX_PER_USER SIGNALING_TURN_MAX_PER_USER Outstanding credentials per technician; current source default is 20.
TURN_MAX_PER_TENANT SIGNALING_TURN_MAX_PER_TENANT Outstanding credentials per tenant; current source default is 80.

Credentials count against their limits until they expire, even if a session ends. Repeated reconnects can exhaust a limit. Public TURN URLs must be reachable by the peers; a container name such as coturn is not suitable. Supplying TURN URLs without a matching secret leaves TURN unavailable. The raw DeskRally relay is a different protocol and cannot replace TURN.

For certificate synchronization, allocation ranges and TURN on restrictive networks, see the TURN reference. For the user-facing relay-limit notice and evidence to collect, see connection troubleshooting.

Recording storage and writable data

Central recording is enabled only when the release supports it and RECORDING_MASTER_KEY is configured. Set RECORDING_DIR to a real directory outside the web roots, writable by the control-plane service identity. The root must not be a symlink or Windows junction, and .incoming/.quarantine must remain on the same filesystem.

On Windows, explicitly select a path such as C:/ProgramData/DeskRally/recordings before enabling the master key; the default /var/lib/deskrally/recordings is a Linux path. On Linux systemd, add the directory to ReadWritePaths when using the read-only service template. Container installs must persist the configured storage on a volume rather than rely on the container's writable layer. Check the release's actual volume and variable wiring before enabling storage.

Set the tenant retention policy deliberately; it defaults off. Back up the complete required keyring (the current key plus every _PREVIOUS entry): losing it makes the recordings unreadable. Retention is a deletion policy, not durability, so the recording volume is outside the v1 backup contract and is covered only by operator-owned tooling (docs/63 C11 acceptance pending; see backup and restore). RECORDING_RECONCILE_MODE is for the restore drill (it enables the lost marking pass; docs/22 section 4 has the exact steps), not an everyday startup setting. RECORDING_DISK_FLOOR_MIB (default 5120 = 5 GiB, valid 512 to 1048576; an invalid value stops startup) is the free-space floor below which new uploads are refused; the volume often shares a filesystem with Postgres, so keep it generous. See recording storage and rotation and backup and restore.

Complete Compose environment template

The following template comes from the same source revision as this reference. Generate and supply deployment-specific values before starting services.

# =================================================================================================
# Copy to `deploy/.env` and fill in. `docker compose` reads it automatically from that path.
#
#   cp deploy/.env.example deploy/.env
#
# NEVER COMMIT `deploy/.env`. Check it is gitignored before you put real secrets in it.
#
# Reasoning for every value here: docs/18-selfhost-deployment.md.
# =================================================================================================

# --- Identity of the deployment ------------------------------------------------------------------

# A REAL hostname that already resolves to this host's public IP. Caddy requests a certificate for
# it on startup, so DNS must work BEFORE the first bring-up — Let's Encrypt rate-limits repeated
# failures.
#
# It must be a hostname, not `:80` and not a bare IP. The console calls `crypto.randomUUID()` in its
# CONNECT path with no fallback, and that API is secure-context only: over plain http:// to anything
# but localhost it is `undefined` and the console THROWS on connect. docs/18 §6.
SITE_ADDRESS=remote.example.com

# The host IP Caddy binds its 80/443 to. Giving this stack its own address keeps it off whatever
# else the box runs. Leave EMPTY to bind all interfaces.
PUBLIC_IP=

# What the control plane tells the console to dial for signaling. Must match the Caddyfile's /ws
# route and the hostname above.
CP_SIGNALING_URL=wss://remote.example.com/ws

# Where the built console bundle lives on the host (index.html + join.html + assets/).
# Produce it with scripts/build-release.ps1, or `npm run build` in web/viewer.
VIEWER_DIST=../dist/viewer

# Where the signed support-client artifact lives on the host: DeskRallySupport.exe and its
# DeskRallySupport.exe.sha256.txt sidecar, served by the Caddyfile /download route (docs/27 step 15).
# This directory MUST EXIST before `docker compose up -d --force-recreate caddy` — Docker resolves
# the bind mount at container creation and a restart reuses the stale inode if the path appeared
# afterwards. Leave it pointing at an empty (or absent-then-created) directory until a signed client
# is published; the /download route simply 404s until DeskRallySupport.exe is there.
ARTIFACT_DIR=../dist/artifacts


# The address Let's Encrypt associates with the certificate account, for EXPIRY WARNINGS.
#
# Renewal is automatic, so this is not needed for the happy path — which is exactly why it is easy to
# skip and easy to regret. Unset, Caddy creates the ACME account anonymously ("no account for
# configured email is known to us"), and Let's Encrypt then has no way to warn you if renewal ever
# silently stops. It can stop: anything that breaks the tls-alpn-01 challenge does it, including
# putting the DNS record behind a proxy that terminates TLS itself. Without an address on file, the
# first sign is the outage.
#
# Applying it needs a Caddyfile change as well — see the commented global block at the top of
# deploy/Caddyfile.
ACME_EMAIL=

# --- Database ------------------------------------------------------------------------------------

POSTGRES_DB=rmt
POSTGRES_USER=rmt
# The OWNER/superuser password. Used for migrations and admin only — the control plane must NOT
# connect as this role (see APP_DB_PASSWORD).
#   openssl rand -hex 24
POSTGRES_PASSWORD=

# The password for `rmt_app`, the NOSUPERUSER NOBYPASSRLS role migration 0005 creates and the
# control plane actually connects as.
#
# THIS IS A SECURITY CONTROL, not bookkeeping. A superuser bypasses row-level security
# UNCONDITIONALLY — `FORCE ROW LEVEL SECURITY`, which all 13 protected tables carry, constrains the
# table OWNER but not a superuser. Without this the only working DSN is the superuser's and tenant
# isolation is silently off. The prod overlay sets this password on FIRST INIT of an empty volume.
#   openssl rand -hex 24
APP_DB_PASSWORD=


# --- Keys and shared secrets ---------------------------------------------------------------------

# The control plane's Ed25519 grant-issuer seed. REQUIRED by the prod overlay, and MUST be stable
# across restarts: agents pin the public key derived from it, and a fresh key makes every enrolled
# agent reject new grants.
#
# BACK THIS UP, and never let a redeploy regenerate it. The failure is delayed and silent — the
# stack starts fine, and backstage stops working for every enrolled machine some restarts later.
#   openssl rand -hex 32
GRANT_ISSUER_SEED=

# Encrypts TOTP (2FA) shared secrets at rest, 64 hex chars. SEPARATE from GRANT_ISSUER_SEED on
# purpose: that seed already signs backstage grants, elevation grants, session policies and session
# tickets, and deriving this from it would mean one compromised value also decrypts every second
# factor — and that the two could never be rotated independently.
#
# Without it the stack still starts and existing 2FA keeps working, but NEW enrollments are refused,
# because storing a second factor we cannot protect is worse than declining to store one.
#
# BACK THIS UP with the same care as GRANT_ISSUER_SEED. Lose it and every enrolled user must
# re-enroll their authenticator app; there is no recovery from the database alone. Do NOT put a
# placeholder here — an all-zero value is refused at startup, because a key an attacker guesses
# first is indistinguishable from no encryption.
#
# After setting it on an existing deployment, convert the rows already on disk:
#   docker compose -f deploy/docker-compose.yml -f deploy/docker-compose.prod.yml \
#     run --rm controlplane reencrypt-totp -dry-run     # then again without -dry-run
#
#   openssl rand -hex 32
TOTP_ENCRYPTION_KEY=

# The PUBLIC key derived from GRANT_ISSUER_SEED, 64 hex chars. Signaling REFUSES TO START without
# it — a server that cannot verify session tickets would broker any WebSocket client to any agent.
#
# CHICKEN AND EGG, and how to break it. You cannot know this value until the control plane has run,
# but compose interpolates the WHOLE file before starting anything, so an unset one fails the
# command even if you only name the controlplane service. So:
#
#   1. put 64 zeros here as a placeholder
#   2. docker compose -f deploy/docker-compose.yml -f deploy/docker-compose.prod.yml up -d postgres controlplane
#   3. docker compose -f deploy/docker-compose.yml -f deploy/docker-compose.prod.yml logs controlplane | grep grant_issuer_pubkey
#   4. paste the real value here, then bring up everything
#
# The control plane logs it at startup as `control-plane: grant_issuer_pubkey=<hex>`. Read the LOG,
# not the endpoint. Two independent reasons, and the second is the one that used to be missed: with
# the prod overlay the control plane has no published port, AND `GET /grant/pubkey` is on the
# protected router, so an anonymous curl answers {"error":"unauthorized"} even where the port IS
# published. At this point in a first bring-up no account and no API token exist yet, so the log is
# the only source there is. Afterwards an API token works — see docs/10 §4 step 1.
# ⚠ THIS PLACEHOLDER IS NOT A KEY. Signaling REFUSES to start on it — deliberately. All-zeros is a
# well-formed 32-byte value and a low-order Ed25519 point, so signatures from anyone verify against
# it: every session ticket would be forgeable and nothing would look wrong. Replace it with the
# value from step 3 above before bringing signaling up.
SIGNALING_TICKET_PUBKEY=0000000000000000000000000000000000000000000000000000000000000000

# Shared secret letting signaling verify an agent's proof of possession at register_agent.
# 32+ chars. Unset ⇒ the route is not mounted and agent auth cannot be checked.
#   openssl rand -hex 32
CP_DEVICE_IDENTITY_TOKEN=

# Shared between signaling and the control plane so the access panel can show online/offline.
# Must be IDENTICAL on both. Fails SOFT — presence just reports unknown.
#   openssl rand -hex 32
PRESENCE_TOKEN=


# Allowed browser Origins for the signaling WebSocket (docs/25 F09). Comma-separated list.
# Native agents have no Origin header and are always allowed. Browsers always send Origin.
# EMPTY (the default) = warn-only mode: all browser Origins permitted. This keeps the F09
# browser-recruitment gap open. Set this to the console URL to close it:
#   SIGNALING_ALLOWED_ORIGINS=https://console.example.com
# Use the same value as SITE_ADDRESS with the https:// scheme. Multiple origins may be listed if
# you run the console at more than one URL (e.g. a staging site):
#   SIGNALING_ALLOWED_ORIGINS=https://console.example.com,https://staging.example.com
# NOTE: include the exact scheme+host (+non-default port if any). https://host and https://host:443
# are NOT interchangeable — browsers typically omit default ports; use the form browsers actually send.
SIGNALING_ALLOWED_ORIGINS=
# Production overlay: empty = derived from SITE_ADDRESS (a bare host or a comma/space list; each -> https://host; scheme/port/wildcard = startup error; plus https://<tenant>$CP_TENANT_HOST_SUFFIX when set).
# '*' = allow any origin (UNSAFE). Production mode refuses to start with an empty effective list.

# Concurrent relay connections (both TCP and WebSocket). Default 1024; invalid/negative values
# refuse startup. 0 deliberately disables admission and is for isolated development only.
# Keep the production overlay's relay ports unpublished; this bound is not relay authentication.
RELAY_MAX_CONNECTIONS=1024

# Per-source (per-IP) WebSocket connection limit for signaling (docs/25 F09). 0 or unset =
# unlimited (warn-only default, F09 per-source gap remains open). Set to a value that fits
# your fleet — a typical deployment needs one slot per agent plus a few controller connections
# per operator IP (e.g. 32-64 for a moderate fleet; 4-8 for a single-operator lab).
#
# IMPORTANT: Behind a reverse proxy (Caddy), all clients appear as the proxy's IP unless
# SIGNALING_TRUSTED_PROXIES is also set. Both values must be configured together to be
# effective in a proxied deployment.
# The PRODUCTION OVERLAY now defaults an empty value to 64 (0 disables) and defaults
# SIGNALING_TRUSTED_PROXIES to the private ranges; leave both empty to take those defaults.
# Signaling refuses to start in production mode with a cap but no trusted proxies.
SIGNALING_MAX_CONNECTIONS_PER_IP=

# CIDRs whose TCP peers may set X-Forwarded-For for signaling client-IP resolution. Enables
# the real client IP to be used for per-source quota accounting when Caddy (or another reverse
# proxy) fronts the signaling WebSocket. Set to the Docker Compose network CIDR of Caddy,
# e.g. "172.20.0.0/24". Multiple CIDRs may be listed comma-separated.
# A malformed entry is a hard startup failure, never a silent widening.
# Unset = XFF not trusted (RemoteAddr only); safe default for a direct-listen deployment.
# Production overlay: empty = 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 (signaling's port is not
# published, so only compose-network containers, i.e. Caddy, can reach it).
SIGNALING_TRUSTED_PROXIES=

# Per-connection message-rate ceiling, messages per second (docs/25 F09 — message-rate budget).
# Each inbound WebSocket frame, whether valid or malformed, consumes one token from the
# per-connection token bucket. When the bucket is empty the connection receives a Rejected frame
# and is closed. 0 = unlimited. Empty = the production overlay's default of 200 (forwarded since
# the 2026-10-18 security audit; before that this setting never reached the container).
#
# A well-behaved agent sends heartbeats at the configured heartbeat-ttl interval (default 30s,
# i.e. ~0.03 messages/s) plus broker messages (SDP, candidates) during session setup — typically
# 5-20 frames in the first few seconds. A ceiling of 50 msg/s gives enormous headroom for
# legitimate traffic while capping a flood at a small fraction of the default connection cap.
SIGNALING_MAX_MESSAGES_PER_SECOND=

# --- Exposure hardening --------------------------------------------------------------------------

# Marks the session cookie Secure. The cookie IS the console's authentication. Defaulted to 1 by the
# prod overlay; do not turn it off while serving over HTTPS.
CP_SECURE_COOKIE=1
# Console SSO (docs/34): the public suffix tenant hosts live under. Unset = SSO routes not mounted.
CP_TENANT_HOST_SUFFIX=.deskrally.com
# docs/66 hostname theming: OFF unless CP_HOST_THEMING=on (the suffix above never enables it). To opt in, set
# CP_HOST_THEMING=on together with CP_EDGE_SECRET (random, >= 32 chars; openssl rand -hex 32) and the Caddy
# X-DeskRally-Edge marker (see docs/66); the control plane refuses to start with theming on and no secret.
# The marker is sent by the Caddyfile's opt-in `#| ` block, which goes live together with the commented CP_EDGE_SECRET
# lines of BOTH the controlplane and the caddy service in docker-compose.prod.yml (docs/66 2i has the order).
# CP_HOST_THEMING=on
# CP_EDGE_SECRET=

# docs/63 central session-recording storage: OFF unless RECORDING_MASTER_KEY is set. Leave all of these EMPTY until
# you have read docs/20 "Turning on central recording storage" (key backup FIRST, volume, tenant policy). The
# recordings live on the `recordings` named volume (docker-compose.prod.yml), which `docker compose down -v`
# destroys and which is OUTSIDE the backup contract in v1 (docs/22 section 4); the key below is IN the must-back-up set.
#   RECORDING_MASTER_KEY: 64 hex chars, `openssl rand -hex 32`, separate from every other secret. Losing it makes every
#   stored recording unreadable.
#   RECORDING_MASTER_KEY_ID: positive integer naming that key (empty = 1). A rotated-in key gets a NEW id.
#   RECORDING_MASTER_KEY_PREVIOUS: "id:hexkey,id:hexkey", every earlier key that still wraps a stored file.
#   CP_PUBLIC_ORIGIN: https://<SITE_ADDRESS>, scheme and host only; REQUIRED once the key is set (startup refuses without it).
#   RECORDING_RECONCILE_MODE: restore drills only (docs/22); empty in normal operation.
#   RECORDING_RECONCILE_ACCEPT_MISSING: restore drills only, with the line above: go ahead and mark recordings lost even when most
#   files are missing or the volume looks empty (say it only after checking the right volume is mounted; docs/22).
#   RECORDING_DISK_FLOOR_MIB: refuse new uploads below this much free space on the recordings volume, in whole MiB
#   (512..1048576; EMPTY = 5120, i.e. 5 GiB; anything else stops startup). The volume shares the root filesystem with
#   Postgres on the reference host, so the floor also protects the database (docs/20 section 15).
RECORDING_MASTER_KEY=
RECORDING_MASTER_KEY_ID=
RECORDING_MASTER_KEY_PREVIOUS=
CP_PUBLIC_ORIGIN=
RECORDING_RECONCILE_MODE=
RECORDING_RECONCILE_ACCEPT_MISSING=
RECORDING_DISK_FLOOR_MIB=

# Take the client IP from the rightmost X-Forwarded-For hop. Correct ONLY behind exactly one trusted
# reverse proxy, which is what Caddy is here. Without it the allow-list below compares against
# Caddy's own address and matches nobody.
CP_TRUST_PROXY_IP=1

# Restrict the AUTHENTICATED console API to these source networks (CIDRs or bare IPs, comma/space/
# semicolon separated). EMPTY = open, which is the backward-compatible default.
#
# The highest-value single control if you always browse from known networks. A malformed entry is a
# HARD startup failure, never a silent widening.
#
# LIMIT, so it is not over-trusted: this covers the console API only. Agent-enroll and guest-attend
# routes stay open by design (they carry their own bearer authorization), and signaling must be
# reachable. It narrows the blast radius; it does not eliminate exposure.
CP_ADMIN_IP_ALLOWLIST=

# Inactivity timeout for a console login, in minutes (default 30; "0" disables, leaving only the
# absolute 12h expiry).
CP_SESSION_IDLE_MINUTES=30

# Optional control-plane tunables, all forwarded by the prod overlay and all EMPTY = the built-in default.
# (A guard test, TestComposeForwardsEveryEnvVarTheServerReads, fails the build when a variable a server
# binary reads is neither forwarded by the compose files nor allowlisted with a reason.)
#   CP_ISSUER_NAME                name shown in authenticator apps (default rmt-control-plane)
#   AGENT_PUBLISHED_VERSION       expected agent build "<semver>+<short-sha>"; empty = version tracking off
#   CP_MAX_CONNS                  concurrent-connection cap
#   CP_READ_TIMEOUT               whole-request read timeout, a Go duration such as 60s
#   CP_PASSWORD_HASH_CONCURRENCY  parallel argon2 hashes (~64 MiB each); CP_PASSWORD_HASH_QUEUE = waiting room
#   CP_AUTH_LOOKUP_CONCURRENCY    concurrent database lookups of not-yet-proven credentials (default a quarter of the pool); CP_AUTH_LOOKUP_QUEUE = waiting room
#   CP_LOOKUP_DB_CONNS            database connections for anonymous lookups (public branding, attended redeem), a pool apart from the main one (default 8)
#   DIRECTIVE_SIGNING_SEED        fleet directives (docs/65); 64 hex, DIFFERENT from GRANT_ISSUER_SEED (openssl rand -hex 32)
#   CP_SIGNALING_NOTIFY_URL       default http://signaling:8080 (compose network); only used with the seed above
CP_ISSUER_NAME=
AGENT_PUBLISHED_VERSION=
CP_MAX_CONNS=
CP_READ_TIMEOUT=
CP_LOOKUP_DB_CONNS=
CP_PASSWORD_HASH_CONCURRENCY=
CP_PASSWORD_HASH_QUEUE=
CP_AUTH_LOOKUP_CONCURRENCY=
CP_AUTH_LOOKUP_QUEUE=
DIRECTIVE_SIGNING_SEED=


# --- TURN / coturn (leave empty until a network actually needs it) --------------------------------
#
# STUN handles most home/office NAT. TURN is for symmetric NAT and networks that block UDP between
# the peers. Its ABSENCE fails visibly (sessions do not connect); its MISCONFIGURATION fails
# silently. Add it when you hit a network that needs it, not pre-emptively. docs/18 §4.
#
# Setting URLs without a secret (or the reverse) logs a loud warning and leaves TURN DISABLED rather
# than handing clients an ICE server they cannot authenticate against.
#
# The URLs must be reachable BY THE PEERS — the TURN server's public hostname, never a compose
# service name. Include the TCP entry: it is what saves you on a network that blocks outbound UDP,
# which is often the very reason TURN was needed.
STUN_URLS=
TURN_URLS=
#   openssl rand -hex 32   — must equal coturn's --static-auth-secret
TURN_SHARED_SECRET=
TURN_TTL=2h
# Caps on OUTSTANDING TURN credentials: a brokered session holds one until it EXPIRES (TURN_TTL), not
# until it ends, and a session over a cap connects STUN-only. Empty = the built-in 20 per technician /
# 80 per tenant, which with TURN_TTL=2h covered a month of real sessions (the old 6 / 24 proved too
# small for ONE busy technician; docs/10, "Configure the signaling server").
TURN_MAX_PER_USER=20
TURN_MAX_PER_TENANT=80
TURN_REALM=remote.example.com


# =================================================================================================
# TURN (WAN NAT traversal) — used ONLY when you layer deploy/docker-compose.turn.yml (docs/20 §9).
# Server-side TURN so remote sessions work with ZERO changes on end-user firewalls (clients dial OUT
# to it). Leave ALL of this unset for a LAN-only deployment. The example values below are this
# deployment's actual, measured setup (spare public IP .59, TURNS on 443 externally -> :5349).
# =================================================================================================
#
# Must equal what the signaling service already reads. Generate once: openssl rand -hex 32
# TURN_SHARED_SECRET=<64 hex>
#
# THE TRAP: the gateway does DESTINATION-SCOPED forwarding, not 1:1 NAT, so coturn must be told its
# public/private mapping or it silently hands out unroutable 192.168.x relay candidates.
# TURN_EXTERNAL_IP=203.0.113.10/10.0.0.6
# The PRIVATE address TURN_EXTERNAL_IP maps. REQUIRED with network_mode: host — coturn otherwise
# relays on EVERY interface it finds (other LAN IPs, docker bridges) and advertises the unroutable
# ones intermittently. This pins relay + listening to the one address the gateway forwards to.
# TURN_RELAY_IP=10.0.0.6
# TURN_REALM=remote.example.com
#
# What signaling advertises to peers (must be reachable BY THE PEERS — the public turns hostname,
# never coturn:3478). TCP + TLS matter: they clear firewalls that block UDP. turns is 443 externally
# (gateway forwards .59:443 -> box:5349), which looks like HTTPS and gets through corporate firewalls.
# The TURN hostname (DNS -> the second public IP). Caddy obtains and renews its certificate; coturn
# reads it from the shared volume. Defaults to the hosted service's name; install.sh sets
# turn.<SITE_ADDRESS>.
# TURN_SITE_ADDRESS=turn.example.com
# STUN_URLS=stun:turn.example.com:3478
# TURN_URLS=turn:turn.example.com:3478?transport=udp,turn:turn.example.com:3478?transport=tcp,turns:turn.example.com:443?transport=tcp
#
# TURN_TLS_CERT / TURN_TLS_KEY are NO LONGER USED (non-root coturn, audit #19): coturn reads fixed
# paths in a dedicated `turncerts` volume that deploy/turn-cert-sync.sh fills with ONLY the TURN
# hostname's cert + key (it finds them in Caddy's volume by TURN_SITE_ADDRESS). Remove any old
# TURN_TLS_* lines; they are ignored. See docs/20-ubuntu-host-runbook.md section 9.
#
# Relay port range (open exactly this on the gateway) + the external caddydata volume name
# (read only by the cert-export step) and the dedicated cert volume coturn mounts.
# TURN_MIN_PORT=49160
# TURN_MAX_PORT=49200
# CADDYDATA_VOLUME=deploy_caddydata
# TURNCERTS_VOLUME=deploy_turncerts

# docs/68 + docs/20 section 16: the OPT-IN download / update reach report. OFF unless you run
# `docker compose --profile reach up -d --build reach-ingest`; the variables below are read only by that service.
#   REACH_DATABASE_URL: the rmt_reach_ingest login (migration 0078 creates the role NOLOGIN; you give it a password
#   and LOGIN, docs/20 section 16), e.g. postgres://rmt_reach_ingest:PASSWORD@postgres:5432/rmt?sslmode=disable
#   REACH_INTERVAL: how often it reads the Caddy log (a Go duration, at least 1m; EMPTY = 1h).
REACH_DATABASE_URL=
REACH_INTERVAL=

← All documentationConfiguration reference ↗