# asxp.io infrastructure Two Hetzner Cloud servers running NixOS, described by OpenTofu. - `tofu/`: servers, network, firewalls, DNS, Object Storage buckets (OpenTofu, applied by hand; `tofu/README.md`) - `nixos/`: the whole system of each server (one flake; `nixos/README.md`) - `RESTORE.md`: restoring data from the backups Branches: `main` is what runs. `ansible` is the Debian/Ansible setup as it was before the move to NixOS (2026-11-16), `migration` the move itself: its plan and record, the data scripts and the rehearsal rules. ## Servers | Server | Size | Runs | |--------|------|------| | asxpio-ops | CX23: 2 vCPU, 4 GB | WireGuard hub, Traefik, Forgejo (+ registry), Postgres, Garage, monitoring; app stacks deployed from their own repos | | asxpio-services | CX43: 8 vCPU, 16 GB | Forgejo Actions runners, Minecraft (Paper), SillyTavern, XMPP (asxp.io), Xray | Administration only over WireGuard (10.20.0.0/24) or the private network (10.10.0.0/20). Both servers are billed below today's list price: never delete or recreate them, reinstall in place (`nixos/README.md`). ## Changing something Edit `nixos/`, push a branch (CI evaluates every host), merge to `main`. Each host pulls `main` within a minute, builds its own configuration and switches to it ([comin](https://github.com/nlewo/comin), `nixos/modules/comin.nix`). Only units whose definition changed restart. Undo by reverting on `main`, or `nixos-rebuild switch --rollback` on the host (the next commit on `main` replaces it). Versions are pinned (`flake.lock`, image tags); Renovate opens a PR per bump and updates `flake.lock` weekly. Things to know: - Try a change on one host first: push it to `testing-` on top of `main`; that host applies it with `test` (not the boot default). Merge it to `main` to keep it. - `comin status` on a host shows what it fetched, built and deployed. A failing fetch, build or switch alerts in Grafana after 15 minutes. - comin on ops fetches from Forgejo on ops. A change that breaks Forgejo or Traefik has to be fixed by hand (`nixos/README.md`). - App stacks (asxpio, datacenterbingo, blog, czsk, vhpbot) are Podman containers that their own repositories deploy with `docker compose` as user `deploy`. `docker` and `podman` talk to the system Podman for every admin. - Your workstation's uplink may run through Xray on services: never stop it without another path. ## Monitoring Grafana at https://gf.asxp.io (WireGuard only). Dashboards and the 33 alert rules are provisioned from `nixos/hosts/asxpio-ops/monitoring/`; change them there, not in the UI. Alerts mail `asxpio.alertEmail`. - **Metrics:** Prometheus on ops scrapes both hosts, 90 days. - **Logs:** Alloy ships the journal, container logs and Traefik's access log to Loki (bucket `asxpio-loki-main`), 2 years. - **Probes:** blackbox checks every site and TCP/TLS service from ops. - **Security baseline:** every host reports its WireGuard peers, devices on the private network, accounts, listening ports and privileged containers; anything not declared in the config alerts. Each service declares what it expects (`asxpio.security`). SSH logins show the same summary. ## Backups Nightly restic on each host (ops 03:30, services 04:15 UTC) into `restic/` in `asxpio-backups-main` (hel1) and `asxpio-backups-repl` (fsn1); a failed run mails. A daily replica (services, ~06:00) copies `asxpio-backups-main` (minus `restic/`), `asxpio-tofu-main`, `asxpio-loki-main` and `k8s-asxpio-main` to their fsn1 twins. Details and restores: `RESTORE.md`. ## Secrets Service secrets are in `nixos/secrets/.yaml`, encrypted with sops for the admin's age key and each host's SSH host key; the hosts decrypt them at boot. CI holds no server credentials. Keep a copy of the admin age key (`~/.config/sops/age/keys.txt`) outside this machine. ## TODO - [ ] **From 2026-11-24**, if nothing came up: `rm -rf /old-root` on both hosts (Debian and its leftovers: Postgres 17/18 rollback volumes on ops), then delete the snapshots `pre-nixos-2026-11-17` and `asxpio-ops-pre-nixos-2026-11-17` in the Hetzner console. - [ ] Remove the repository secret `ANSIBLE_VAULT_PASSWORD` (Forgejo → iac → Settings → Actions → Secrets). - [ ] Empty and remove the old state buckets `asxpio-terraform-main/-repl` (`legacy_state_*` in `tofu/s3.tofu`) once the new state has been in use for a few weeks. - [ ] Reset Forgejo's instance-wide runner registration token (Site administration → Actions → Runners → Create new runner → Reset registration token). Nothing uses it any more (the runners connect by UUID and token), but the old one, from 2024, still registers runners. The other secrets from the old history are rotated. - [ ] Optional: a new token for the interop runner (by an admin of dev.another.im), into sops `runner/interop_token`. - [ ] Move Postgres and Garage from ops to services (bigger disk and memory; the apps reach them over the private network). - [ ] Move the app stacks to their own flakes on asxpio-services, one at a time (blog → czsk → datacenterbingo → asxpio → vhpbot).