nixos: drop the rehearsal pair and other migration leftovers
All checks were successful
nixos / nixos (push) Successful in 1m3s

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
This commit is contained in:
Sergei Poljanski 2026-11-17 11:11:33 +04:00
commit 2635b887c7
Signed by: asxpi
GPG key ID: 4F8851660FA4121B

View file

@ -16,7 +16,6 @@ modules/alert.nix mail when a unit fails
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
secrets/*.yaml sops-encrypted, one file per host
```
@ -52,7 +51,7 @@ generation in the boot menu (Hetzner console). Package updates come from
Renovate (`flake.lock` weekly, pinned images and versions as they are
released); by hand: `nix flake update`, commit `flake.lock`.
Try anything risky on the rehearsal pair first (below).
Try anything risky on a throwaway server first (below).
## Building the servers from scratch
@ -161,57 +160,34 @@ and never backs up an empty host over a full one. After restoring or
moving the data: `touch /var/lib/.data-in-place`, then start the units
or reboot.
## Rehearsal
## Testing on a copy of production
`.#rehearsal-ops` and `.#rehearsal-services` are the two hosts' own
configurations plus `hosts/rehearsal/`: other keys and addresses, dummy
secrets, SSH open to the world, backups into local directories, and
anything that would act as production (the XMPP server) started by hand
only. **Every change is tried there first**, and the pair should be able
to do everything production does before a production host is converted.
The test pair used for the migration (`.#rehearsal-ops`,
`.#rehearsal-services`: other keys and addresses, dummy secrets, backups
into local directories) was removed after it; `git log --
nixos/hosts/rehearsal` finds it to bring back. A throwaway server is
created like a real one (above, in the `personal` project), then gets
that night's snapshot restored (RESTORE.md, "A whole host").
Two servers on a private network with the production addresses:
A restored copy carries production credentials:
```sh
hcloud network create --name rehearsal --ip-range 10.10.0.0/20
hcloud network add-subnet rehearsal --type cloud --network-zone eu-central --ip-range 10.10.0.0/23
tofu -chdir=../tofu output -json user_data | jq -r '."asxpio-ops"' > /tmp/ops.yaml
tofu -chdir=../tofu output -json user_data | jq -r '."asxpio-services"' > /tmp/services.yaml
hcloud server create --name rehearsal-ops --type cx23 --image debian-13 --location hel1 \
--ssh-key <your key> --network rehearsal --user-data-from-file /tmp/ops.yaml
hcloud server create --name rehearsal-services --type cx23 --image debian-13 --location hel1 \
--ssh-key <your key> --network rehearsal --user-data-from-file /tmp/services.yaml
```
Then, per server: put its age recipient in `.sops.yaml` (`&rehearsal_*`)
and `sops updatekeys secrets/rehearsal-<role>.yaml`; put its addresses in
`hosts/rehearsal/<role>.nix` (and ops's public key in services' file,
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 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.
- Anything that would use them outward stays off: XMPP and the Telegram
gateway, mail (Forgejo, Grafana, crawler), the bucket replica,
certificate pushes, the CI runners, Minecraft's outward plugins
(DiscordSRV, ServerBackup, AutoUpdateGeyser).
- Before any runner meets Forgejo's data, delete production's queued
jobs, schedules, Actions secrets, runners and webhooks (the removed
`hosts/rehearsal/sanitize-forgejo.sh` does that).
- 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.
credentials in `/run` only, and delete the server when done.
## How the first boot works, and its limits
- nixos-infect is pinned by commit and checksum in
`../tofu/servers.tofu`; it replaces the operating system, so bump it
deliberately and rehearse.
deliberately and try it on a throwaway server.
- It keeps the Debian image's partitions (`modules/hetzner.nix` matches
them) and moves the old system to `/old-root`.
- `bootstrap.nix` in the cloud-init corrects three things for the first