Files
hnefatafl/deploy/verify-ledgers.sh
T

15 lines
771 B
Bash
Executable File

#!/usr/bin/env bash
# The determinism gate: fetch every production ledger and replay it with the
# LOCAL engine, comparing each room with what the server shows. A ledger the
# new engine replays differently would rewrite a game in progress when the
# server restarts, so this runs before every deploy.
# deploy/verify-ledgers.sh <droplet-ip-or-host> [https://site]
set -euo pipefail
HOST="${1:?usage: verify-ledgers.sh <droplet-ip-or-host> [https://site]}"
# SITE in the environment overrides the name, for a machine whose DNS has not caught up with a new record.
SITE="${2:-${SITE:-https://tafl.kestrelsnest.social}}"
DIR="$(mktemp -d)"
trap 'rm -rf "$DIR"' EXIT
rsync -az "root@$HOST:/var/lib/hnefatafl/rooms/" "$DIR/"
npx tsx deploy/replay-ledgers.ts "$DIR" "$SITE"