Eight cron monitors, two per game, watched eight scripts that run on the same box at the same two minutes. hall-nightly.sh now runs the hall's own rollup and every game's rollup at 00:12, and every game's backup at 07:23, finding the games by their scripts in /usr/local/bin, and checks in once for each job to the gamehall project's hall-rollup and hall-backup monitors. The template's rollup and backup say by their exit status whether they managed, the skipped backup included, and its deploy leaves the game's own cron file off a host the hall schedules. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
35 lines
1.8 KiB
Bash
Executable File
35 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Publish Kestrel's Hall to the shared host: the page to /opt/gamehall and
|
|
# its Caddy site file beside the games'. Usage: gamehall/deploy.sh <host>
|
|
set -euo pipefail
|
|
HOST="${1:?usage: gamehall/deploy.sh <host>}"
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
|
|
rsync -az --delete "$HERE/site/" "root@$HOST:/opt/gamehall/"
|
|
scp -q "$HERE/gamehall.caddy" "root@$HOST:/etc/caddy/sites/gamehall.caddy"
|
|
rsync -az "$HERE/ops/" "root@$HOST:/tmp/gamehall-ops/"
|
|
ssh "root@$HOST" '
|
|
set -e
|
|
chown -R root:caddy /opt/gamehall
|
|
chmod -R g+rX /opt/gamehall
|
|
# Validating as root would create the access log as root; Caddy runs as caddy and must own it.
|
|
touch /var/lib/caddy/gamehall-access.log
|
|
chown caddy:caddy /var/lib/caddy/gamehall-access.log
|
|
caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile >/dev/null 2>&1
|
|
chown caddy:caddy /var/lib/caddy/gamehall-access.log
|
|
systemctl reload caddy
|
|
# The counting tools: installed on every publish so the live copies are the repo copies.
|
|
install -m 755 /tmp/gamehall-ops/gamehall-visitors.sh /usr/local/bin/gamehall-visitors.sh
|
|
install -m 755 /tmp/gamehall-ops/gamehall-rollup.sh /usr/local/bin/gamehall-rollup.sh
|
|
# The nightly job that runs the rollup and backup of every game here and checks in once for all.
|
|
install -m 755 /tmp/gamehall-ops/hall-nightly.sh /usr/local/bin/hall-nightly.sh
|
|
install -m 644 -D /tmp/gamehall-ops/traffic.py /usr/local/lib/gamehall/traffic.py
|
|
install -m 644 /tmp/gamehall-ops/gamehall.cron /etc/cron.d/gamehall
|
|
# The hall-wide notice every game serves at /hall/announcement.json.
|
|
install -m 755 /tmp/gamehall-ops/hall-announce.sh /usr/local/bin/hall-announce
|
|
install -d -m 755 /var/lib/hall
|
|
mkdir -p /var/lib/gamehall /var/log/gamehall
|
|
rm -r /tmp/gamehall-ops
|
|
'
|
|
echo "published."
|