Commit graph iac/nixos/hosts/rehearsal
Author SHA1 Message Date
b7414c2ad1
runner: connect with UUID and token instead of registering
All checks were successful
nixos / nixos (push) Successful in 1m8s
The runner's token was regenerated in Forgejo (runner asxpio-services,
same UUID), which also retires the registration-token route the NixOS
module used. Both runners now work the same way: settings from Nix, the
connection (URL, UUID, token from sops) merged in at start, no
registration step. A new token is a sops change and a deploy.

Corrects 0a54caa: `forgejo actions generate-runner-token` returned the
existing registration token, so that commit rotated nothing.

Assisted-by: Claude:opus-5-5
2026-11-17 10:57:02 +04:00
6d9122eeff
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
2026-11-17 10:08:40 +04:00
2ca56d595c
nixos: containers come back after a reboot; ops-data.sh fixes
All checks were successful
nixos / nixos (push) Successful in 44s
Found by rehearsing the ops conversion on a fresh test server with last
night's backup:

- After a reboot the app containers stayed stopped. Docker restarted
  them; Podman does so only through podman-restart.service, which it
  ships but does not enable. Enable it; on ops it waits for the app
  networks, Postgres and Garage.
- ops-data.sh: a fresh NixOS has no /opt, so moving the app directories
  failed; and NixOS creates an empty /var/lib/forgejo/repositories at
  boot, so the repositories were moved into it, one level too deep.
  Every part now creates its target, replaces what is empty and skips
  what already moved, so an interrupted run can be resumed.
- `forgejo admin regenerate hooks` is gone in Forgejo 17, which gives
  git its own hooks on every push; a push to a restored repository
  works with the old hook files in place. Drop the call.
- The rehearsal ops host does not push XMPP certificates: there is no
  services host behind 10.10.0.20 on the test network.

Assisted-by: Claude:opus-5-5
2026-11-17 08:27:35 +04:00
b634e50cb0
nixos: accept Debian ops's certificate push until ops converts
All checks were successful
nixos / nixos (push) Successful in 34s
Between the two conversions, services runs NixOS while ops still pushes
the XMPP certificates with the key Ansible generated there. Authorize
that key too, with the same forced command and source restriction, so
renewals keep reaching ejabberd. Remove it after the ops conversion.

Assisted-by: Claude:opus-5-5
2026-11-17 05:54:34 +04:00
2a0e7bd83a
nixos: crawler report as native units
Same script, schedule and threshold. It now mails through SMTP with the
alert account from sops instead of reading Forgejo's app.ini out of its
container, and reads Traefik's log at its new place. Forgejo's router
is forgejo@file now.

Tried on the rehearsal pair against generated GPTBot traffic.

Assisted-by: Claude:opus-5-5
2026-11-17 04:51:37 +04:00
cbf14b4b99
nixos: monitoring as native services
Every host runs node_exporter, cAdvisor (now against Podman), Alloy and
the security-metrics script, on its private address. Each service
declares its own expected ports, users and privileged containers next
to its definition, so the security baseline follows the config instead
of a separate inventory list.

On ops: Prometheus, Loki, Grafana, the blackbox prober and the Postgres
exporter, with the same scrape jobs, probes, retention, dashboards and
33 alert rules. Two rules matched container-era names and now match the
native ones: Forgejo's log is unit forgejo.service, Grafana's route is
grafana@file.

Grafana keeps its default secret_key on production, because its
database was written with it; rotating it is a separate step.

Prometheus, Grafana and Alloy come from nixos-unstable: their data is
from newer versions than 26.05 ships.

LLMNR and mDNS are off: the baseline flagged them as public listeners.

Tried on the rehearsal pair: all 28 scrape targets up, logs from both
hosts in Loki, Grafana WireGuard-only, no unexpected port, user or
container on either host.

Assisted-by: Claude:opus-5-5
2026-11-17 04:48:56 +04:00
422eb3bc6e
nixos: bucket replica and XMPP certificate sync
s3-replicate is the same rclone sync with the same delete limit, run by
the rclone package instead of its image.

The certificate push keeps its shape: ops reads Traefik's acme.json and
sends each certificate over SSH with a key that may run one command on
services, from ops only. The key is now a sops secret with its public
half in the config, instead of being generated on the host, so a
rebuilt pair works without a manual step. Tried on the rehearsal pair
with a throwaway certificate; any other command is refused.

Assisted-by: Claude:fable-5-2
2026-11-16 23:27:47 +04:00
e95d97869f
nixos: Traefik and the CI runners as native services
Traefik keeps its role and its acme.json. Routes for the native
services (Forgejo, Garage, the dashboard, the XMPP certificate) are
written from Nix; the app containers keep declaring theirs as labels,
which Traefik reads through Podman's socket as it did through Docker's.

The asxpio runner uses the NixOS module and starts jobs through Podman;
the interop runner is its own unit because it connects with a UUID and
token instead of registering.

Tried on the rehearsal pair: Forgejo and Garage through Traefik, a
label-routed container, anonymous reads of the public bucket only, and
a workflow with a nix-latest and an ubuntu-latest job.

A restored Forgejo database still holds production's queued jobs,
schedules and Actions secrets. The test runner tried to take a queued
production job and was stopped only by the different secret key.
migration/rehearsal-sanitize-forgejo.sh removes all of that and must
run before a runner meets restored data.

Assisted-by: Claude:fable-5-2
2026-11-16 23:17:09 +04:00
be68c5adef
nixos: describe both servers as NixOS systems
Start of the move from Ansible to NixOS. Services run as native NixOS
services where nixpkgs has a module and as Podman containers otherwise;
there is no Docker.

Shared: users with their Debian UIDs, SSH with the Ansible role's crypto
settings, nftables firewall, WireGuard (ops is the hub), sops-nix
secrets per host, the restic backup script with its schedule and
retention, mail on unit failure.

asxpio-services: Xray, SillyTavern, Minecraft (Paper) and the ACME
forwarder natively; XMPP stays in containers because the server is a
custom build.

asxpio-ops: Postgres, Garage and Forgejo natively. Roles, buckets, keys
and grants move here from the storage repo's init scripts.

Services that own data wait for /var/lib/.data-in-place, so an install
never creates empty state where a restore is about to land.
migration/*-data.sh move the Debian-era data into the new layout.

hosts/rehearsal turns the two hosts into a test pair with its own keys
and dummy secrets. Everything here ran there, Postgres, Garage, Forgejo,
Minecraft and SillyTavern on a restored copy of production data. Three
differences from the containers showed up and are handled: Garage
rejects a 0440 credential file, Geyser needs libcrypto and netlink,
SillyTavern ignores the module's listen flags.

Production is untouched: both servers still run Debian under Ansible.

Assisted-by: Claude:fable-5-2
2026-11-16 22:59:59 +04:00