Run your own OneLobby server
You get a lobby server, a relay for players behind strict networks, and automatic HTTPS, on one small machine. A 1 vCPU / 1 GB VM or a Raspberry Pi 4 is enough.
This is the advanced path. If you only need a lobby server and no relay, EASY_SERVER.md gets you one on a free host in a few clicks.
Five steps
- Get a machine and a name. Any Linux box with a public IP and Docker (with the compose plugin). Point a DNS
record (for example
lobby.example.com) at it. - Open the ports in the machine's firewall and your cloud's security group (table below).
- Configure. From this
deploy/directory:
Editcp .env.example .env.env: setLOBBY_DOMAIN,ACME_EMAIL,TURN_EXTERNAL_IP(your public IP), and a fresh secret withopenssl rand -hex 32forTURN_SECRET. - Start it.
Caddy fetches a certificate on first start (give it a minute; ports 80 and 443 must be reachable).docker compose up -d - Point your game at it. Set the game's
lobby_servertowss://lobby.example.com/ws. The server accepts WebSockets on/as well, sowss://lobby.example.comalso works; the recipes and examples use the/wsform.
Ports
| Port | Protocol | Who | What |
|---|---|---|---|
| 80 | TCP | Caddy | Certificate challenge and redirect to HTTPS |
| 443 | TCP (and UDP) | Caddy | wss:// lobby signaling, /healthz, optional Godot web build |
| 3478 | UDP and TCP | coturn | TURN relay |
| 5349 | TCP | coturn | TURN over TLS (turns:), for networks that only allow TCP |
| 49160-49400 | UDP | coturn | Relay range, one port per relayed player |
| 8080 | TCP | onelobby-server | Internal only. Not published to the internet |
TURN over TLS is on 5349 by default because Caddy owns 443. If you want turns: on 443 as well (some hotel and office
networks allow nothing else), give the machine two public IPs. Bind Caddy to one with ports: "IP1:443:443" in
compose.yaml, set TURN_TLS_PORT=443 and listening-ip=IP2 for coturn. Most games are fine without this.
Smoke test
On the machine (an Ubuntu VM is the tested target), as root so it can block UDP for the TCP/TLS checks:
sudo deploy/scripts/smoke.sh
It checks that https://<your domain>/healthz answers 200 with a valid certificate, that a TURN allocation works over
UDP, and that allocations still work over TCP and TLS with UDP to the relay blocked. Every line starts with ok or FAIL.
To check only the credential maths (no server needed): node deploy/scripts/turn-creds-check.mjs.
Running without Docker
Download the onelobby-server binary for your platform from the releases page, then follow the comments at the top of
onelobby-server.service (a systemd unit). Install coturn from your package manager, copy turnserver.conf to
/etc/turnserver.conf, and pass the secret, realm, external IP and certificate on the coturn command line as
compose.yaml does. You still want Caddy (or nginx) in front for TLS.
Raspberry Pi notes
- Use a 64-bit OS (Raspberry Pi OS 64-bit or Ubuntu). The images and the
linux-arm64binary are 64-bit only. - Run from an SSD or a good SD card; Caddy writes certificates and logs.
- The relay is the heavy part. The default cap is 1 MB/s per player and 200 allocations total, which a Pi 4 on gigabit
Ethernet handles. On Wi-Fi or a slow uplink lower
max-bpsandtotal-quotainturnserver.conf. - Home connection: forward the ports in the table to the Pi on your router, set
TURN_EXTERNAL_IPto your public IP, and use a dynamic DNS name forLOBBY_DOMAINif your IP changes (updateTURN_EXTERNAL_IPwhen it does and rundocker compose up -d).
Good to know
--trust-proxyis already set in compose and the unit, so per-IP limits see each player's real address behind Caddy.TURN_SECRETmust be the same foronelobby-serverand coturn; compose passes one value to both.- Players' relay traffic is capped (
total-quota,user-quota,max-bps) and cannot reach private addresses (denied-peer-ipinturnserver.conf), so the relay cannot be used to probe your home network. - coturn reads the certificate Caddy obtained. If
turns:fails right after first start, wait for Caddy to finish getting its certificate and rundocker compose restart coturn. - Serving a Godot web build: put the exported files in
deploy/game-web/, setGAME_DOMAINin.envto a real name that points at the machine. The Caddyfile adds theCross-Origin-Opener-PolicyandCross-Origin-Embedder-Policyheaders Godot needs. - Update:
docker compose pull && docker compose up -d.
This page is generated from the source on GitHub, which is always the latest version.
