The hall comes first, in the shape of wizwar's landing
The home page is a centred card: title and pitch, your name, play the bot or continue the duel under way, create or join a duel by code, a sample ledger, the duels this browser holds with whose move it is, and the story of the game. The single-player board lives at /play. The droplet gains the duel server as a systemd service behind Caddy. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
e1bda87987
commit
6c6edca4be
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
# Adds the duel server to a droplet that setup-droplet.sh already prepared.
|
||||
# Run ON the droplet as root; safe to run again. Installs Node 22, creates
|
||||
# the service user and data directory, and teaches Caddy to hand /api and
|
||||
# /ws to the server while it keeps serving the static site itself.
|
||||
set -euo pipefail
|
||||
|
||||
if ! command -v node >/dev/null || [[ "$(node -v)" != v22* ]]; then
|
||||
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
||||
apt-get install -qy nodejs
|
||||
fi
|
||||
|
||||
id -u waving-hands &>/dev/null || useradd -r -m -d /opt/waving-hands-home waving-hands
|
||||
mkdir -p /opt/waving-hands/app /var/lib/waving-hands/rooms
|
||||
chown -R waving-hands:waving-hands /var/lib/waving-hands
|
||||
|
||||
# Caddy: the two proxied paths go in before the static file handling.
|
||||
if ! grep -q 'reverse_proxy' /etc/caddy/Caddyfile; then
|
||||
python3 - <<'PY'
|
||||
import pathlib
|
||||
p = pathlib.Path('/etc/caddy/Caddyfile'); s = p.read_text()
|
||||
marker = 'try_files {path} {path}.html /index.html'
|
||||
proxy = '''@duel path /api/* /ws
|
||||
reverse_proxy @duel localhost:8788 {
|
||||
lb_try_duration 30s
|
||||
lb_try_interval 250ms
|
||||
}
|
||||
|
||||
'''
|
||||
assert marker in s
|
||||
p.write_text(s.replace(marker, proxy + marker))
|
||||
PY
|
||||
caddy validate --config /etc/caddy/Caddyfile
|
||||
systemctl reload caddy
|
||||
fi
|
||||
|
||||
echo "server prerequisites ready: now run deploy/deploy.sh <ip> from your machine"
|
||||
Reference in New Issue
Block a user