Traefik keeps its role and its acme.json. Routes for the native services (Forgejo, Garage, the dashboard, the XMPP certificate) are written from Nix; the app containers keep declaring theirs as labels, which Traefik reads through Podman's socket as it did through Docker's. The asxpio runner uses the NixOS module and starts jobs through Podman; the interop runner is its own unit because it connects with a UUID and token instead of registering. Tried on the rehearsal pair: Forgejo and Garage through Traefik, a label-routed container, anonymous reads of the public bucket only, and a workflow with a nix-latest and an ubuntu-latest job. A restored Forgejo database still holds production's queued jobs, schedules and Actions secrets. The test runner tried to take a queued production job and was stopped only by the different secret key. migration/rehearsal-sanitize-forgejo.sh removes all of that and must run before a runner meets restored data. Assisted-by: Claude:fable-5-2
33 lines
1.2 KiB
Shell
Executable file
33 lines
1.2 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# REHEARSAL HOSTS ONLY. Run after restoring production's Forgejo data and
|
|
# before any runner is started against it.
|
|
#
|
|
# A restored database still has production's queued jobs, its schedules
|
|
# and its Actions secrets (deploy keys, registry tokens). A runner would
|
|
# pick the jobs up and deploy to production from the test server. This
|
|
# cancels what is queued, removes the schedules and deletes every secret.
|
|
set -euo pipefail
|
|
|
|
case "$(hostname)" in
|
|
rehearsal-*) ;;
|
|
*) echo "refusing: $(hostname) is not a rehearsal host" >&2; exit 1 ;;
|
|
esac
|
|
|
|
db=/var/lib/forgejo/data/forgejo.db
|
|
systemctl stop forgejo.service
|
|
sqlite3 "$db" <<'SQL'
|
|
BEGIN;
|
|
DELETE FROM secret;
|
|
-- 3 = cancelled; 5 waiting, 6 running, 7 blocked
|
|
UPDATE action_run_job SET status = 3 WHERE status IN (5, 6, 7);
|
|
UPDATE action_run SET status = 3 WHERE status IN (5, 6, 7);
|
|
UPDATE action_task SET status = 3 WHERE status IN (5, 6, 7);
|
|
DELETE FROM action_schedule_spec;
|
|
DELETE FROM action_schedule;
|
|
DELETE FROM action_runner;
|
|
DELETE FROM webhook;
|
|
DELETE FROM push_mirror;
|
|
COMMIT;
|
|
SQL
|
|
systemctl start forgejo.service
|
|
echo "sanitized: no secrets, no queued jobs, no schedules, no runners, no webhooks"
|