# The nordschleife multiplayer relay.
#
# docker compose -f /opt/web/apps/mp-relay/docker-compose.yml up -d --build
#
# Deployed to /opt/web/apps/mp-relay/ alongside an `app/` directory holding the
# relay source. Caddy proxies wss://makefuture.ro/ws here.
services:
relay:
build: ./app
container_name: mp-relay
restart: unless-stopped
# No `ports:`. Publishing to the host would put a raw WebSocket server on
# the public internet next to the one Caddy already terminates TLS for.
# Caddy resolves `mp-relay` by container name over web-edge instead.
environment:
PORT: 8090
LB_PATH: /data/leaderboard.json
# The one piece of durable state: the global curve leaderboard. Room
# state stays in memory as before.
volumes:
- ./data:/data
security_opt:
- no-new-privileges:true
# In-memory room state only, so a crash costs a few seconds of gameplay and
# nothing else. Restarting is always the right move.
healthcheck:
test:
[
'CMD',
'node',
'-e',
"require('net').connect(8090,'127.0.0.1').on('connect',()=>process.exit(0)).on('error',()=>process.exit(1))",
]
interval: 30s
timeout: 5s
retries: 3
start_period: 5s
logging:
driver: json-file
options:
max-size: '10m'
max-file: '3'
networks:
- web-edge
networks:
web-edge:
external: true