The engine and the bot no longer import each other: geometry, movement
and captures live in src/lib/game/board.ts and both use it. The escape
test, the four directions, the king's neighbours and the enumeration of
a side's moves each exist once; the tally counts by the named end
sentences rather than by regex over them; exports nobody imports are
exports no more. The tests pin the bot's opening move and the three-
beside-the-throne capture they named but never exercised.
In the client: .small, the word-as-button, the × that dismisses, the
visually-hidden rule and the frame of the reading pages are in app.css
once; the preferences panel and the report slip share one modal shape;
the room store drops the simultaneous-round fields this game never read
and gains seatEmpty and seatUnheld, which the lobby and the join page
read instead of three spellings of their own. The wire shapes for
reports and the tally are declared in view.ts for both sides. The
artwork component is re-indented for the top level it lives at.
On the server and in deploy: the plaintext-token fallback and its
migration script guarded ledgers this game never wrote; the seat line
now requires the hash and the start line the rules revision. The route
table lists every route. The visitors digest and the nightly rollup
count Caddy's log through deploy/traffic.py, and the rollup writes the
finished-games count it had been computing behind "and False". The
reports digest is one program, deploy/report-digest.ts, that
pull-reports.sh and the desk skill both use. The deploy README, the
visitors skill and the reports skill no longer describe a browser-only
game, a /play route or a rules text in docs/; conventions.md carries
the kit's Preferences and tally sections.
Kit-shared files touched, to port back: server/src/{index,rooms,store,
tally,reports}.ts, deploy/{deploy.sh,replay-ledgers.ts,pull-reports.sh,
traffic.py,report-digest.ts,*-rollup.sh,*-visitors.sh,*-pulse.sh},
src/lib/net/{client.ts,room.svelte.ts,view.ts}, Preferences.svelte,
ReportSlip.svelte, TableTalk.svelte.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GwFKMuQnPAEHJ5yA1q4orh
56 lines
2.7 KiB
Bash
Executable File
56 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build locally, push the static site and the game server to the droplet,
|
|
# and restart the server. Usage: deploy/deploy.sh <droplet-ip-or-host>
|
|
set -euo pipefail
|
|
HOST="${1:?usage: deploy.sh <droplet-ip-or-host>}"
|
|
|
|
# The family list is the kit's; a game deploys with the kit's latest copy when the kit is beside it.
|
|
KIT_FAMILY="$(dirname "$0")/../../game-kit/family.json"
|
|
[ -f "$KIT_FAMILY" ] && cp "$KIT_FAMILY" static/family.json
|
|
|
|
npm run check
|
|
npm run check:server
|
|
npm test
|
|
npm run build
|
|
|
|
# Every production ledger must replay identically with the engine about to ship.
|
|
deploy/verify-ledgers.sh "$HOST"
|
|
|
|
# Old hashed chunks stay a week: a page loaded before this deploy can still
|
|
# fetch the module it was built against instead of failing mid-game.
|
|
rsync -az --delete --filter='P _app/immutable/*' \
|
|
build/ "root@$HOST:/opt/hnefatafl/build/"
|
|
|
|
# The server runs from source with tsx and carries its own small manifest;
|
|
# it needs only its code and the engine. Ledgers live outside this tree.
|
|
rsync -az --delete --exclude='/server/node_modules' \
|
|
--include='/server/***' --include='/src/' --include='/src/lib/' --include='/src/lib/game/***' --include='/src/lib/net/' --include='/src/lib/net/view.ts' \
|
|
--include='/deploy/' --include='/deploy/hnefatafl.service' --include='/deploy/hnefatafl.cron' --include='/deploy/*.sh' --include='/deploy/traffic.py' \
|
|
--exclude='*' \
|
|
./ "root@$HOST:/opt/hnefatafl/app/"
|
|
|
|
ssh "root@$HOST" '
|
|
find /opt/hnefatafl/build/_app/immutable -type f -mtime +7 -delete
|
|
chown -R root:caddy /opt/hnefatafl/build
|
|
chmod -R g+rX /opt/hnefatafl/build
|
|
cd /opt/hnefatafl/app/server && npm install --no-audit --no-fund
|
|
chown -R hnefatafl:hnefatafl /opt/hnefatafl/app
|
|
cp /opt/hnefatafl/app/deploy/hnefatafl.service /etc/systemd/system/hnefatafl.service
|
|
# The ops scripts run from /usr/local/bin and share traffic.py: install them
|
|
# on every deploy so the live copies are always the repo copies.
|
|
install -m 755 /opt/hnefatafl/app/deploy/hnefatafl-visitors.sh /usr/local/bin/hnefatafl-visitors.sh
|
|
install -m 755 /opt/hnefatafl/app/deploy/hnefatafl-pulse.sh /usr/local/bin/hnefatafl-pulse.sh
|
|
install -m 755 /opt/hnefatafl/app/deploy/hnefatafl-rollup.sh /usr/local/bin/hnefatafl-rollup.sh
|
|
install -m 755 /opt/hnefatafl/app/deploy/hnefatafl-backup.sh /usr/local/bin/hnefatafl-backup.sh
|
|
install -m 644 -D /opt/hnefatafl/app/deploy/traffic.py /usr/local/lib/hnefatafl/traffic.py
|
|
install -m 644 /opt/hnefatafl/app/deploy/hnefatafl.cron /etc/cron.d/hnefatafl
|
|
mkdir -p /var/log/hnefatafl
|
|
systemctl daemon-reload
|
|
systemctl enable --now hnefatafl
|
|
systemctl restart hnefatafl
|
|
systemctl reload caddy
|
|
sleep 1
|
|
systemctl --no-pager -l status hnefatafl | head -3
|
|
'
|
|
echo "deployed."
|