Infrastructure as Code of asxp.io https://asxp.io
  • Nix 68.2%
  • HCL 16.7%
  • Python 12.2%
  • Shell 2.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Sergei Poljanski b7414c2ad1
All checks were successful
nixos / nixos (push) Successful in 1m8s
runner: connect with UUID and token instead of registering
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
.forgejo/workflows ci: wait for a running activation before switching a host 2026-11-17 10:35:44 +04:00
nixos runner: connect with UUID and token instead of registering 2026-11-17 10:57:02 +04:00
tofu tofu: rename from terraform, state in its own bucket, Loki buckets 2026-11-17 09:42:53 +04:00
.gitignore add wg: sanya 2026-04-05 19:17:18 +03:00
known_hosts docs: the full migration plan; ci: deploy NixOS hosts 2026-11-17 05:15:16 +04:00
README.md main: the current setup only 2026-11-17 10:08:40 +04:00
renovate.json main: the current setup only 2026-11-17 10:08:40 +04:00
RESTORE.md main: the current setup only 2026-11-17 10:08:40 +04:00

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: .forgejo/workflows/nixos.yaml builds each host on itself and switches to it, ops first. Only units whose definition changed restart. Undo with nixos-rebuild switch --rollback on the host.

Versions are pinned (flake.lock, image tags); Renovate opens a PR per bump and updates flake.lock weekly.

Things to know:

  • The runner executes the deploy. A change to it restarts it mid-job: the change lands, the job shows as cancelled, the next run confirms.
  • 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/<host> 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/<host>.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 only SSH_DEPLOY_KEY. 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.
  • Rotate the secrets that sat in the old repository history: Forgejo's INTERNAL_TOKEN and JWT secrets, the runner token; give Grafana its own secret_key.
  • Move the app stacks to their own flakes on asxpio-services, one at a time (blog → czsk → datacenterbingo → asxpio → vhpbot).