Deploying OAuthMC
OAuthMC compiles to a static Linux musl binary inside a non-root gcr.io/distroless/static-debian12:nonroot container image. It needs no database or persistent volume: tickets live in memory and expire after a few minutes.
Container image#
The GHCR image (ghcr.io/yellowumbrelladev/oauthmc) is not published yet; it ships with the first stable release. Until then, build the image locally from crates/oauthmc:
docker build -t oauthmc crates/oauthmc => => naming to docker.io/library/oauthmc:latestOnce published, replace build: ./crates/oauthmc / image: oauthmc in the examples below with ghcr.io/yellowumbrelladev/oauthmc:<version> (pin a version tag such as 0.1.0, not :latest).
Docker Compose#
Publish the Minecraft port (25565) publicly and keep the HTTP API (8080) on an internal network reachable only by your platform backend:
services:
oauthmc:
image: oauthmc
build: ./crates/oauthmc
restart: unless-stopped
ports:
- "25565:25565"
environment:
OAUTHMC_API_KEYS: "${OAUTHMC_API_KEY}"
OAUTHMC_PUBLIC_ADDRESS: "verify.example.com"
networks:
- internal
networks:
internal:
driver: bridgeInside the Docker image, OAUTHMC_API_ADDR defaults to 0.0.0.0:8080 so sibling containers on internal can reach http://oauthmc:8080, while port 8080 is never published on the host.
Start the service and inspect its log:
docker compose up -d oauthmc
docker compose logs oauthmclevel=info event=listening mc_addr=0.0.0.0:25565 api_addr=0.0.0.0:8080Non-default port with a DNS SRV record#
If a Minecraft game server already uses port 25565 on the host, publish OAuthMC on another port (for example 25566) and add a DNS SRV record so players still connect to verify.example.com without typing a port:
_minecraft._tcp.verify.example.com. 300 IN SRV 0 5 25566 verify-host.example.com.Set OAUTHMC_PUBLIC_ADDRESS=verify.example.com. Minecraft Java Edition resolves _minecraft._tcp.<host> automatically.
Running behind a TCP proxy#
OAuthMC enforces per-IP concurrency (OAUTHMC_MAX_CONNECTIONS_PER_IP, default 16), per-IP held link sessions (OAUTHMC_MAX_HELD_PER_IP, default 2), and the per-IP auth rate limit (OAUTHMC_AUTH_RATE_PER_MINUTE, OAUTHMC_AUTH_BURST) using the TCP peer address returned by accept().
OAuthMC does not parse PROXY protocol headers. If you run it behind a SNATing L4 proxy or load balancer (such as HAProxy, Nginx stream, or a cloud TCP load balancer), every connection arrives from the proxy's IP address instead of the player's IP address. When running behind a SNATing proxy:
- Raise
OAUTHMC_MAX_CONNECTIONS_PER_IP,OAUTHMC_MAX_HELD_PER_IP,OAUTHMC_AUTH_RATE_PER_MINUTE, andOAUTHMC_AUTH_BURSTso legitimate players do not trip the shared per-IP caps. - Enforce per-client connection and rate limits at the proxy layer.
Health checks#
The container image defines a built-in HEALTHCHECK that runs every 30 seconds:
/oauthmc healthcheckThe healthcheck subcommand reads OAUTHMC_API_ADDR (rewriting 0.0.0.0 to 127.0.0.1 and :: to ::1), sends GET http://<addr>/healthz with a 3-second timeout, and exits 0 on HTTP 200 or 1 otherwise.
Verify it on a running container:
docker exec oauthmc /oauthmc healthcheck && echo "healthy"healthyExternal orchestrators on the internal network can also probe GET /healthz directly without an API key:
curl -sS http://127.0.0.1:8080/healthz{"ok":true}Upgrades#
OAuthMC keeps no state on disk. Upgrading replaces the container image and restarts the process:
-
Rebuild the image (or pull the new version tag once published on GHCR):
docker compose build oauthmc -
Recreate the container:
docker compose up -d oauthmc -
Verify the container is listening and healthy:
docker compose exec oauthmc /oauthmc healthcheck && echo "healthy"healthy
Because tickets live in memory, any open ticket is dropped during the restart. Players whose ticket disappears receive 404 not_found on the platform and start a fresh verification.
Graceful shutdown#
OAuthMC listens for SIGTERM and SIGINT. On receiving either signal, it:
- Logs
level=info event=shutdown. - Stops accepting new Minecraft and HTTP API connections and stops the ticket-expiry sweep loop.
- Sends Configuration Disconnect (
0x02) with theshutdowntemplate to held link-mode clients. - Exits with status
0.