Mesh relay
Configuration
Configure the relay through the command-line arguments supported by the Docker entrypoint.
The image builds /data/config.json from its command-line arguments every time the container starts. Treat the container arguments as the source of truth: manual changes to config.json are overwritten on restart.
Environment variables such as RELAY_PORT, LOG_LEVEL and MAX_CONNECTIONS are not supported.
Supported operator arguments
| Argument | Default | Purpose |
|---|---|---|
--host | 0.0.0.0 | Public IPv4 address or DNS name advertised to other relays. Set this explicitly for a public relay. |
--external-port | 41234 | Public TCP and UDP port advertised with --host. It must match the Docker host port mapped to internal port 41234. |
--origins | Automatic discovery | Explicit comma-separated host:port list. A nonempty list disables downloading. |
--no-origin-discovery | Disabled | Do not download origins; allows starting an isolated relay without an explicit list. |
Unknown arguments are ignored by the current entrypoint. IPv6 literals are not accepted because relay addresses currently use the host:port format.
Fixed container settings
The current image fixes several settings rather than exposing them as operator options:
| Setting | Value |
|---|---|
| Client and relay port | 41234 |
| Message database | /data/relay.db |
| Heartbeat interval | 60 seconds |
| Unseen relay cleanup interval | 60 minutes |
| Maximum rebound count | 7 |
| Client transport | TCP |
| Relay-to-relay transport | UDP |
The container always listens internally on 41234. If the Docker host publishes another port, map that port to 41234 for both protocols and pass the host port through --external-port.
Origins
An origin gives a new relay an initial peer from which it can discover the network.
Without an explicit list, the relay downloads https://mesh-network.org/origins.json at each startup with a 5-second timeout. The validated manifest is stored in /data/origins-cache.json. If the website is unavailable, the last valid cache is used; without a valid cache, startup fails with an explicit error. A cache write failure does not prevent using a valid downloaded list.
For private networks or isolated relays, use --no-origin-discovery. When using JSON configuration outside the Docker entrypoint, set originDiscovery: false. The testnet mode never downloads the public registry. Previously discovered peers are not removed when the registry changes. There is no periodic refresh.
Applications and CLI
A new client installation downloads and saves origins. An existing valid list, including an empty list, is preserved. In Settings, Récupérer les origines fills the draft; Sauvegarder applies it. Failures preserve settings and allow retrying or manual configuration.
During mesh-cli init, the CLI prioritizes MESH_RELAY_ORIGINS, otherwise downloading the registry. mesh-cli init --no-origin-discovery allows isolated initialization. An existing configuration works without another download.
mesh-cli origins fetch # Preview without modifying configuration
mesh-cli origins fetch --apply # Replace only origins, preserving identity keys
Maintaining the registry
Edit packages/website/public/origins.json in the repository and redeploy the website. The format is { "schemaVersion": 1, "network": "mainnet", "origins": ["relay.example.org:41234"] }. The list must be nonempty and contain only DNS or IPv4 addresses with a port between 1 and 65535, without a URL scheme. Downloads are public, without authentication, with CORS * and HTTP revalidation.
When first rolling out this feature, publish and verify the registry before distributing new clients and relays. To switch an existing relay to automatic discovery, remove its --origins argument and recreate its container while retaining the volume.
Persistent data
Everything under /data must survive container replacement. Losing the volume loses stored envelopes, databases and local relay state. See Operations for a backup procedure.