The kit sets games up on the shared hall host

setup-droplet.sh prepares a host several games share and adds this game
to it: its own Caddy site file, port, user, trees and access log, with
/etc/caddy/Caddyfile only importing sites/*.caddy. setup-server.sh is
folded in. A slug that is already a system group stops the setup with a
clear word. new-game.sh now stamps .py files too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
Eric Wagoner
2026-09-25 16:49:03 -04:00
co-authored by Claude Opus 5.5
parent cd9d14ec35
commit bc5f93c2fa
7 changed files with 131 additions and 118 deletions
+28 -24
View File
@@ -1,22 +1,28 @@
# Deploying __NAME__
Every game, against a housecarl or a friend, is a room on a small Node
process that keeps it as an append-only ledger of moves in
/var/lib/__SLUG__/rooms. Production is one DigitalOcean droplet: Caddy
terminates TLS with automatic certificates, serves the static build from
/opt/__SLUG__/build, and proxies /api and /ws to the game server on port
__PORT__, which runs as the `__SLUG__` user under systemd from
/opt/__SLUG__/app.
Every game is a room on a small Node process that keeps it as an
append-only ledger of moves in /var/lib/__SLUG__/rooms. Production is the
shared Kestrel's Hall host: Caddy terminates TLS with automatic
certificates, serves the static build from /opt/__SLUG__/build, and proxies
/api and /ws to the game server on port __PORT__, which runs as the
`__SLUG__` user under systemd from /opt/__SLUG__/app.
## Sizing
## The shared host
The smallest droplet, `s-1vcpu-512mb-10gb` ($4 a month), carries both Caddy
and the game server comfortably: the server is one small Node process capped
at 300 MB by its unit file, and a room is a few kilobytes of ledger.
The games of Kestrel's Hall share one droplet, `hall` (nyc3, s-1vcpu-1gb,
$6 a month, tag `kestrels-hall`, IP 159.203.115.252). Each game keeps its
own Caddy site file in /etc/caddy/sites/<slug>.caddy, its own port,
service user, /opt/<slug> and /var/lib/<slug> trees, access log
(/var/lib/caddy/<slug>-access.log), cron file and ops scripts;
/etc/caddy/Caddyfile only says `import sites/*.caddy`. A game server is one
small Node process capped at 300 MB by its unit file, and a room is a few
kilobytes of ledger, so the host carries several. Each game needs a port
of its own on the host: wizwar 8787, waving-hands 8788, hnefatafl 8789,
dip 8790.
## Current production
- Droplet: `__SLUG__` (nyc3, s-1vcpu-512mb-10gb, tag `__SLUG__`), IP __IP__
- Host: __IP__
- URLs: https://__DOMAIN__ (A record at Hover, where kestrelsnest.social's
DNS lives) and https://__SLUG__.__IP__.sslip.io (always works, zero DNS).
- Everyday deploy: `deploy/deploy.sh __IP__`
@@ -24,21 +30,19 @@ at 300 MB by its unit file, and a room is a few kilobytes of ledger.
and the screenshots to ~/Desktop/__SLUG__-reports with a digest;
`deploy/report-reply.sh __IP__ <id> <status> "text"` answers one.
## New droplet from scratch
## Adding this game to the host
1. `doctl compute droplet create __SLUG__ --region nyc3 \
--size s-1vcpu-512mb-10gb --image ubuntu-24-04-x64 \
--ssh-keys <your-key-ids> --tag-name __SLUG__ --wait`
2. `scp deploy/setup-droplet.sh deploy/Caddyfile.tmpl root@<ip>:/root/ && ssh root@<ip> \
1. `scp deploy/setup-droplet.sh deploy/Caddyfile.tmpl root@<ip>:/root/ && ssh root@<ip> \
"bash /root/setup-droplet.sh '__DOMAIN__, __SLUG__.<ip>.sslip.io'"`
(point the A record at the new IP first, or leave the real name out until it is).
3. `scp deploy/setup-server.sh deploy/Caddyfile.tmpl root@<ip>:/root/ && ssh root@<ip> "bash /root/setup-server.sh"`
4. `deploy/deploy.sh <ip>`
It installs Caddy and Node if the host lacks them, writes this game's
site file, and touches nothing of another game's. Point the A record at
the host first, or leave the real name out until it is; running it again
with the new line is how a name is added later.
2. `deploy/deploy.sh <ip>`
The sslip.io hostname works with no DNS at all. To add a real name, point an
A record at the droplet and add the name to the first line of
/etc/caddy/Caddyfile (space separated), then `systemctl reload caddy`; Caddy
fetches the certificate on first request.
A fresh host, when one is needed: `doctl compute droplet create hall --region nyc3 \
--size s-1vcpu-1gb --image ubuntu-24-04-x64 --ssh-keys <your-key-ids> \
--tag-name kestrels-hall --wait`, then step 1.
## Operations scripts on the droplet