The test pair served the move to NixOS, which is done. Its overlays, dummy secrets and sops recipients go; the rules for testing on a copy of production stay in nixos/README.md, and git log finds the overlay if it is needed again. Options that existed only for it (alert address, Loki bucket, extra cert-push keys) are inlined, and comments still pointing at Ansible or MIGRATION.md are corrected. The tofu README now spells out the state bucket bootstrap: the bucket is a resource in the state it holds, so a new project needs one local apply first. The bucket gets prevent_destroy for the same reason. Assisted-by: Claude:opus-5-5
3.9 KiB
Restoring from backups
Each host backs itself up nightly with restic (ops 03:30, services 04:15 UTC) into two independent repositories:
| Name | Repository |
|---|---|
hel1 |
s3:https://hel1.your-objectstorage.com/asxpio-backups-main/restic/<host> |
fsn1 |
s3:https://fsn1.your-objectstorage.com/asxpio-backups-repl/restic/<host> |
What a snapshot holds is declared next to each service (asxpio.backup
in nixos/): paths, and hooks that put consistent copies of databases
into /var/backups/restic-stage just before the run.
| Host | Paths | In /var/backups/restic-stage |
|---|---|---|
| asxpio-ops | /etc/ssh, /opt (app stacks), /var/lib/forgejo, /var/lib/garage (after a metadata snapshot), /var/lib/traefik, /var/lib/grafana |
pg_dumpall.sql, asxpio.dump (pg_dump -Fc), forgejo.db |
| asxpio-services | /etc/ssh, /opt (XMPP state), /var/lib/minecraft, /var/lib/SillyTavern, the Podman volumes xmpp_database and xmpp_tackygram |
ejabberd.sqlite; Mnesia as nightly.backup inside xmpp_database |
Not in the backup: Postgres' data directory (restore from the dump), Prometheus and Loki's local data, and what Minecraft downloads again.
Three secrets are needed: the Object Storage keys (s3/access_key,
s3/secret_key) and the restic password (restic/password), all in
nixos/secrets/<host>.yaml. Without the password nothing can be read.
One file or one service, on a running host
restic-backup hel1 snapshots
restic-backup hel1 ls latest /var/lib/minecraft/world
restic-backup fsn1 restore latest --target /tmp/r --include /opt/xmpp
Restore beside the live data, compare, then stop the service and move the files into place.
A whole host
Build a fresh host first (nixos/README.md). Services that own data do
not start until /var/lib/.data-in-place exists, so nothing creates
empty state where the restore lands.
export AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... RESTIC_PASSWORD=...
export RESTIC_REPOSITORY=s3:https://hel1.your-objectstorage.com/asxpio-backups-main/restic/asxpio-ops
restic snapshots --host asxpio-ops
restic restore latest --host asxpio-ops --target /
Then, on ops:
touch /var/lib/.data-in-place; systemctl start postgresqlrunuser -u postgres -- psql -q postgres < /var/backups/restic-stage/pg_dumpall.sql(one error,role "postgres" already exists, is expected), thensystemctl restart postgres-rolesto set the passwords from sops.- Replace Forgejo's database with the staged copy:
cp /var/backups/restic-stage/forgejo.db /var/lib/forgejo/data/forgejo.db,chown git:gitit, thenforgejo-admin regenerate keys. - Reboot. Everything starts, the app containers through podman-restart.
On services: the XMPP volumes come back with the restore; replace
ejabberd.sqlite in xmpp_database with the staged copy, and if Mnesia
does not come up clean, podman exec xmpp-ejabberd ejabberdctl restore /opt/ejabberd/database/nightly.backup. Then touch /var/lib/.data-in-place and reboot.
Check: the sites answer (Grafana → Probes), a git clone over SSH, an XMPP login, the Minecraft world, the next nightly backup.
Backups from the Debian era
Snapshots taken before 2026-11-17 hold the Debian/Docker layout
(/opt/forgejo, Docker volumes). Restore one to a side directory and
let the migration scripts on branch migration move it into place:
git show migration:nixos/migration/ops-data.sh > /tmp/ops-data.sh # or services-data.sh
restic restore <snapshot> --target /restore
bash /tmp/ops-data.sh /restore
Keeping this true
After a change to what is backed up, and at least twice a year, restore
the latest snapshot of each host onto a throwaway server (nixos/README.md,
"Testing on a copy of production") and walk through this page. Last walk-through: 2026-11-17, both hosts
(the ops runbook on a fresh server with that night's backup).