Three sysadmin items ahead of the public announcement's arrivals. deploy/wizwar-rollup.sh writes one JSON line per UTC day to /var/lib/wizwar/rollup.jsonl at 00:10: yesterday's traffic from Caddy's access log (requests, human vs bot addresses as counts only, socket connects, path mix, external referrers), the table's growth (new rooms, human seats and names, lifetime game totals, reports and replies), and the box's vitals (service memory and peak, disk, load, protocol errors, service starts, ledger size). Re-rolling a day replaces its line. It checks in to a Sentry cron monitor of its own, whose URL deploy.sh derives from the backup monitor's on first install, alongside the cron entry. The pulse gains a Trends section that reads the last week of it. Caddy keeps 30 log files instead of 5 as the raw backing. Per-address limits on the two doors anyone may use unseated: 12 new rooms and 6 reports per address per hour, in a sliding window keyed by the address Caddy forwards. The per-connection cap stays; it reset on reconnect, which is what a script would do. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
32 lines
1.5 KiB
Bash
Executable File
32 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build locally, push to the droplet, restart. Usage: deploy/deploy.sh <droplet-ip>
|
|
set -euo pipefail
|
|
HOST="${1:?usage: deploy.sh <droplet-ip-or-host>}"
|
|
|
|
npm run build --workspace=@wizwar/web
|
|
rsync -az --delete \
|
|
--exclude node_modules --exclude data/ --exclude .git --exclude research \
|
|
./ "root@$HOST:/opt/wizwar/"
|
|
ssh "root@$HOST" '
|
|
cd /opt/wizwar && npm install --no-audit --no-fund
|
|
chown -R wizwar:wizwar /opt/wizwar
|
|
cp /opt/wizwar/deploy/wizwar.service /etc/systemd/system/wizwar.service
|
|
# The backup script is cron-run from /usr/local/bin — install it every
|
|
# deploy, or the repo copy and the live copy drift apart (they did:
|
|
# the Sentry check-ins shipped in the repo and never reached the box).
|
|
install -m 755 /opt/wizwar/deploy/wizwar-backup.sh /usr/local/bin/wizwar-backup.sh
|
|
# The nightly rollup and its cron entry ride along the same way; its
|
|
# Sentry check-in URL is the backup monitor'"'"'s with its own slug.
|
|
install -m 755 /opt/wizwar/deploy/wizwar-rollup.sh /usr/local/bin/wizwar-rollup.sh
|
|
install -m 644 /opt/wizwar/deploy/wizwar-rollup.cron /etc/cron.d/wizwar-rollup
|
|
if [ -f /root/.wizwar-sentry-cron ] && [ ! -f /root/.wizwar-sentry-cron-rollup ]; then
|
|
sed "s#/cron/new-monitor/#/cron/wizwar-rollup/#" /root/.wizwar-sentry-cron > /root/.wizwar-sentry-cron-rollup
|
|
chmod 600 /root/.wizwar-sentry-cron-rollup
|
|
fi
|
|
systemctl daemon-reload
|
|
systemctl enable --now wizwar
|
|
systemctl restart wizwar
|
|
systemctl --no-pager -l status wizwar | head -5
|
|
'
|
|
echo "deployed."
|