Deployment
The supported production layout is one API process, one WhatsApp/BullMQ worker, MongoDB, and Redis. The included Compose stack implements that topology.
v1.0.1 was released on 2026-12-05 and the container image is published at
ghcr.io/leviro/relay:1.0.1(docker pull ghcr.io/leviro/relay:1.0.1). The Compose commands below still build the image locally asleviro-relay:local— the shippedcompose.yamlbuilds locally and the repo documents no GHCR-based Compose procedure.
Prerequisites
Section titled “Prerequisites”- Docker Engine and Docker Compose v2, or Node.js 24+ with independently managed MongoDB/Redis
- At least 2 GB RAM for a small installation; media processing may require more
- Persistent storage for MongoDB, Redis, uploads, and logs
- Outbound HTTPS/WebSocket access to WhatsApp services
- A TLS reverse proxy for any internet-facing deployment
Node.js 24 LTS is used by the production image. The runtime also includes FFmpeg/FFprobe for media conversion and dumb-init for correct signal handling.
Docker Compose
Section titled “Docker Compose”| Service | Published port | Persistent data |
|---|---|---|
api |
127.0.0.1:${APP_PORT:-3000} (localhost only) |
state named volume at /app/state |
worker |
None | the same state volume, same path |
mongodb |
None | mongodb named volume |
redis |
None | redis named volume with AOF enabled |
One volume holds everything the application writes, mounted into both containers at the same path: /app/state/data, /app/state/uploads, /app/state/gallery, /app/state/logs. Sharing it is not a convenience — the API accepts an upload and the worker sends it, and backups run in the worker and read gallery/.
MongoDB and Redis run with no authentication in the Compose file, which is only safe because they are reachable solely over the private Compose network and publish no ports. Do not publish their ports (even on 127.0.0.1) without adding authentication first.
git clone https://github.com/leviro/relay.gitcd relaydocker compose up -d --builddocker compose psdocker compose logs --tail=100 api workerThe image runs as the unprivileged node user, drops Linux capabilities, and uses a one-minute shutdown grace period so an active BullMQ job can finish.
Reverse proxy and HTTPS
Section titled “Reverse proxy and HTTPS”Terminate TLS in nginx, Caddy, Traefik, or an equivalent proxy. The proxy must forward Host, X-Forwarded-For, and X-Forwarded-Proto, support HTTP/1.1 upgrades for Socket.IO, permit request bodies up to MAX_FILE_SIZE_MB, and use timeouts long enough for large media uploads.
location / { proxy_pass http://127.0.0.1:3000; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; client_max_body_size 50m; proxy_read_timeout 120s;}Set TRUST_PROXY only to the actual proxy hop count or trusted CIDRs. An overly broad value allows clients to spoof addresses used by rate limiting. HTTPS is also required for service-worker registration and PWA installation on non-localhost origins.
Native process deployment
Section titled “Native process deployment”git clone https://github.com/leviro/relay.gitcd relaycp .env.example .envnpm cinpm run buildWORKER_MODE=separate node src/index.jsWORKER_MODE=separate node src/worker.jsFor a small installation, one process can host both roles: WORKER_MODE=single node src/index.js. Do not launch src/worker.js alongside it.
Upgrades
Section titled “Upgrades”- Back up MongoDB and the
statevolume. - Review release notes and
.env.examplechanges. - Pull the new source.
- Rebuild and recreate application containers:
docker compose build --pulldocker compose up -ddocker compose psdocker compose logs --tail=100 api workerThe worker drains its active message during graceful shutdown. Avoid forcing a container kill unless it is genuinely stuck.
Monitoring
Section titled “Monitoring”Monitor API health and HTTP availability, worker restarts and WhatsApp connection state, MongoDB/Redis health and disk usage, failed BullMQ jobs and campaign failure rate, state volume capacity, and repeated login failures.
docker compose psdocker compose logs --since=30m api workerdocker compose topdocker statsScaling constraints
Section titled “Scaling constraints”- Run exactly one worker for each WhatsApp account/session.
- Do not horizontally scale workers against the same MongoDB auth records.
- API replicas require deliberate Socket.IO routing; the provided Compose file intentionally runs one API replica.
Releases (v1.0.1 released 2026-12-05)
Section titled “Releases (v1.0.1 released 2026-12-05)”v1.0.1 was released on 2026-12-05: tag v1.0.1 (commit 0fe673a), GitHub Release, and a public GHCR image ghcr.io/leviro/relay:1.0.1 (digest sha256:f1f374c6a0fd0a7cf9220eb80559ac410263f2a0476595f7d9f1006d8e11a2b3), also tagged 1.0, latest, and sha-0fe673ac7941ed75727353708724af50310b44b3. The release mechanics below are how that image was produced.
When a v* tag is pushed, the release workflow builds the container image once, verifies it against a real MongoDB and Redis, and publishes that same image to GHCR (ghcr.io/leviro/relay) — one build, tagged and pushed, never rebuilt at publish time — with the exact version, major.minor, sha-<full sha>, and latest (stable + highest stable only) tags. A workflow_dispatch run is the dry run: it builds and verifies and publishes nothing. See docs/RELEASING.md in the Relay repository for versioning, tags, and identifying the exact image a container is running. A GitHub Release object was created for v1.0.1; no deployment is automated by any workflow.