Production shape: one Node process serves the built client and the websocket on a single port (SPA fallback, same-origin wss in the client), with Caddy terminating auto-TLS in front. The droplet (nyc3, $6/mo) runs it under systemd as an unprivileged user with room files on the persistent disk at /var/lib/wizwar/rooms — deploys and reboots cannot eat a game. deploy/ carries the one-time droplet setup script, the systemd unit, the Caddyfile, an everyday deploy script (build locally, rsync, install, restart), and a README. Live at https://wizwar.104.236.96.198.sslip.io via sslip.io, so TLS needed no DNS setup at all. Verified over the real internet: room created, second player joined, expansion game started, hands dealt, room file persisted. Fixed en route: rsync's unanchored "data" exclude was stripping the engine's card database, and tsx must ship (it is the runtime). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
37 lines
1.4 KiB
Markdown
37 lines
1.4 KiB
Markdown
# Deploying Wiz-War
|
|
|
|
The game runs on a single DigitalOcean droplet: one Node process serves the
|
|
built client and the websocket on port 8787; Caddy in front terminates TLS
|
|
with automatic certificates. Room files persist in /var/lib/wizwar/rooms and
|
|
survive deploys and reboots.
|
|
|
|
## Current production
|
|
|
|
- Droplet: `wizwar` (nyc3, s-1vcpu-1gb, tag `wizwar`), IP 104.236.96.198
|
|
- URL: https://wizwar.104.236.96.198.sslip.io
|
|
(sslip.io resolves the embedded IP — zero DNS setup. To use a real domain,
|
|
point an A record at the droplet and update /etc/caddy/Caddyfile.)
|
|
|
|
## Everyday deploys
|
|
|
|
deploy/deploy.sh 104.236.96.198
|
|
|
|
Builds the client locally, rsyncs the repo (minus node_modules, /data, .git,
|
|
research), installs dependencies on the droplet, and restarts the service.
|
|
Games in progress survive: state lives in room files, and clients reconnect
|
|
automatically.
|
|
|
|
## New droplet from scratch
|
|
|
|
1. `doctl compute droplet create wizwar --region nyc3 --size s-1vcpu-1gb \
|
|
--image ubuntu-24-04-x64 --ssh-keys <your-key-ids> --tag-name wizwar --wait`
|
|
2. `scp deploy/setup-droplet.sh root@<ip>:/root/ && ssh root@<ip> \
|
|
"bash /root/setup-droplet.sh wizwar.<ip>.sslip.io"`
|
|
3. `deploy/deploy.sh <ip>`
|
|
|
|
## Operations
|
|
|
|
- Logs: `ssh root@<ip> journalctl -u wizwar -f`
|
|
- Restart: `ssh root@<ip> systemctl restart wizwar`
|
|
- Backup games: `scp -r root@<ip>:/var/lib/wizwar/rooms ./rooms-backup`
|