Files
drum-rhythm-game/DEPLOYMENT.md
T
2026-08-02 23:42:07 +00:00

1.7 KiB

Hosting with Docker + Caddy 2

The game is a single static index.html, so it's served from a small nginx container. Caddy sits in front as a reverse proxy and handles the FQDN + TLS.

1. Build and run the container

docker compose up -d --build

This builds the image from Dockerfile (nginx serving index.html) and exposes it on http://<docker-host>:8888. Check it directly first:

curl http://localhost:8888/healthz   # -> ok

Change the 8888:80 mapping in docker-compose.yml if that port is taken.

2. Point Caddy at it

Caddy can run on the same host as the container or on a different machine — either way it just needs a reverse_proxy pointed at the container's exposed port.

Add a block like this to your existing Caddyfile (replace drums.example.com with your real FQDN):

drums.example.com {
    reverse_proxy localhost:8888
}

If Caddy runs on a different machine than the container, use the docker host's address or internal hostname instead of localhost:

drums.example.com {
    reverse_proxy 10.0.0.5:8888
}

Then reload Caddy:

caddy reload --config /path/to/Caddyfile

Caddy 2 automatically requests and renews a TLS certificate for the FQDN (via Let's Encrypt) the first time it's reloaded with a public domain name in the block — no extra config needed, as long as the FQDN's DNS A/AAAA record already points at the Caddy host and ports 80/443 are reachable.

3. Updating

Since the game is one file, redeploying after a code change is:

docker compose up -d --build

nginx serves the new index.html immediately; no Caddy reload needed unless you changed the Caddyfile itself.