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
3 changed files with 56 additions and 380 deletions

View file

@ -89,10 +89,24 @@ tofu plan
tofu apply
```
In a new project the state bucket does not exist yet: comment out the
`backend "s3"` block in `providers.tofu` for the first apply, restore it,
then `tofu init -migrate-state`.
### First run: the state bucket
The state bucket `asxpio-tofu-main` is itself a resource here
(`s3.tofu`), so in a new project `tofu init` fails: the backend points at
a bucket that doesn't exist yet. Bootstrap it once with local state:
```bash
# 1. comment out the backend "s3" block in providers.tofu
tofu init
tofu apply -target=minio_s3_bucket.state_main # just the bucket
# 2. restore the backend block
tofu init -migrate-state # copies local state into the bucket
rm terraform.tfstate* # S3 holds it now
tofu apply # everything else
```
The bucket holds the state that manages it, so it carries
`prevent_destroy`: a plan that would delete it fails instead.
## Files

View file

@ -3,6 +3,11 @@ resource "minio_s3_bucket" "state_main" {
provider = minio.hel1
bucket = "asxpio-tofu-main"
acl = "private"
# Holds the state that manages it
lifecycle {
prevent_destroy = true
}
}
resource "minio_s3_bucket" "state_repl" {

View file

@ -31,8 +31,9 @@ resource "hcloud_server" "ops" {
hcloud_ssh_key.deploy.id
]
# Off: restic backs up both hosts to object storage (ansible role
# restic_backup) for less than the 20% of the server price this costs
# Off: restic backs up both hosts to object storage
# (nixos/modules/backup.nix) for less than the 20% of the server
# price this costs
backups = false
delete_protection = true
rebuild_protection = true
@ -79,8 +80,9 @@ resource "hcloud_server" "services" {
hcloud_ssh_key.deploy.id
]
# Off: restic backs up both hosts to object storage (ansible role
# restic_backup) for less than the 20% of the server price this costs
# Off: restic backs up both hosts to object storage
# (nixos/modules/backup.nix) for less than the 20% of the server
# price this costs
backups = false
delete_protection = true
rebuild_protection = true