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

@ -2,8 +2,8 @@
Each server's whole system, as one flake. A server is created by OpenTofu
(`../tofu`, OpenTofu), converts itself to NixOS on first boot, and gets its
configuration from here. Production is moving over from `../ansible`;
the plan and its state are in `../MIGRATION.md`.
configuration from here. How the servers moved here from Debian and
Ansible is on branch `migration`.
```
flake.nix inputs (nixpkgs 26.05, unstable for a few packages, sops-nix), hosts, dev shell
@ -17,7 +17,6 @@ modules/monitoring-agent.nix node, container and security metrics, logs to Loki
hosts/asxpio-ops/ Traefik, Forgejo, Postgres, Garage, monitoring, app stacks
hosts/asxpio-services/ runners, Minecraft, XMPP, Xray, SillyTavern, one file each
hosts/rehearsal/ overrides that turn the two hosts into a test pair
migration/ one-off scripts: Debian-era data into place, rehearsal clean-up
secrets/*.yaml sops-encrypted, one file per host
```
@ -191,12 +190,22 @@ the other way round for WireGuard); `nixos-rebuild switch --flake
.#rehearsal-<role> --target-host root@<ip> --build-host root@<ip>`;
reboot once.
With test data: `touch /var/lib/.data-in-place`. With a restored copy of
production: restore last night's snapshot to `/restore`, run
`migration/ops-data.sh /restore` or `services-data.sh /restore`, and on
ops `migration/rehearsal-sanitize-forgejo.sh` before the runner starts.
Read the rehearsal rules in `../MIGRATION.md` first: restored data
carries production credentials.
With test data: `touch /var/lib/.data-in-place`. With a restored copy
of production: restore that night's snapshot to `/` (RESTORE.md, "A whole
host"), and mind what the copy carries:
- Production credentials. Anything that would use them outward stays
off in `hosts/rehearsal/`: XMPP and the Telegram gateway, mail
(Forgejo, Grafana, crawler), the bucket replica, certificate pushes,
the interop runner, Minecraft's outward plugins (DiscordSRV,
ServerBackup, AutoUpdateGeyser).
- On ops, run `hosts/rehearsal/sanitize-forgejo.sh` before any runner
meets the data: it removes production's queued jobs, schedules,
Actions secrets, runners and webhooks.
- Start app containers by hand only, with mail pointed at nothing and
`INDEXNOW_KEY` empty; never vhpbot or asxpio-monitor.
- Limit SSH to your address with a Hetzner firewall, keep backup
credentials in `/run` only, and delete the servers when done.
## How the first boot works, and its limits