main: the current setup only
Some checks failed
nixos / nixos (push) Has been cancelled

Both servers run NixOS. The Ansible code and the move itself leave main
for their own branches: `ansible` is the Debian/Ansible setup as it was
before the migration, `migration` keeps the plan and record, the data
scripts and everything else the move needed.

README and RESTORE describe the setup as it is now: NixOS, Podman,
sops, OpenTofu, the backup paths and hooks of the new layout. The
README carries the TODO list that MIGRATION.md had. The Forgejo
sanitising script stays, under hosts/rehearsal, with the rules for
rehearsing on restored production data in the NixOS README. Renovate
no longer looks at Ansible files.

Assisted-by: Claude:opus-5-5
This commit is contained in:
Sergei Poljanski 2026-11-17 10:08:40 +04:00
commit 6d9122eeff
Signed by: asxpi
GPG key ID: 4F8851660FA4121B

View file

@ -0,0 +1,33 @@
#!/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"