Commit graph iac/nixos/hosts/asxpio-services
Author SHA1 Message Date
1a3d283e63
asxpio: container removed; its monitor runs on services now
All checks were successful
nixos / nixos (push) Successful in 24s
The asxpio and asxpio-monitor containers, their images and /opt/asxpio
are gone from asxpio-ops, so the native monitor worker starts and the
routes no longer have to outrank container labels.

Assisted-by: Claude:opus-5-5
2026-11-17 14:16:20 +04:00
0ee1c600e6
services: run asxpio from its flake, beside the container
All checks were successful
nixos / nixos (push) Successful in 26s
asxpi/asxpio now exports the app (bundlerEnv, ImageMagick 7) and a
module running the site and its monitor worker as hardened systemd
services. services runs the site on :3001 next to the container on ops;
no route yet, and the monitor stays off until the container's stops.
pg_hba lets the asxpio role in from 10.10.0.20 too (restarts Postgres
once); the settings and secrets, copied from the container's
environment with the database and Garage on ops' private address, are
in services' sops file. Renovate automerges its bumps like the other
apps'.

Assisted-by: Claude:opus-5-5
2026-11-17 14:12:45 +04:00
4e967372ae
datacenterbingo: route to the service on asxpio-services
All checks were successful
nixos / nixos (push) Successful in 23s
Priority 2000 over the container's labels (1000), until the container
is removed. The listening process is puma, as the baseline sees it.

Assisted-by: Claude:opus-5-5
2026-11-17 13:54:59 +04:00
0b30461938
services: run datacenterbingo from its flake, beside the container
All checks were successful
nixos / nixos (push) Successful in 22s
asxpi/datacenterbingo now exports the app (bundlerEnv) and a module
running it as a hardened systemd service. services runs it on :3002
next to the container on ops; no route yet. It reaches Postgres and
Garage on ops over the private network: pg_hba lets the read-only bingo
role in from 10.10.0.20 (this restarts Postgres once), and its secrets,
copied from the container's environment, are in services' sops file.
Renovate automerges its bumps like the other apps'.

Assisted-by: Claude:opus-5-5
2026-11-17 13:52:15 +04:00
0b3bb707ae
services: serve czsk.it from its flake, beside the container
All checks were successful
nixos / nixos (push) Successful in 22s
czsk/czsk now exports the site and a module serving it from an nginx
virtual host with its headers, gzip and caching. services runs it on
:8082 next to the container on ops; no route yet. Renovate automerges
its bumps like the blog's.

Assisted-by: Claude:opus-5-5
2026-11-17 13:18:47 +04:00
4a6c4ac3a3
services: serve the blog from its flake, beside the container
All checks were successful
nixos / nixos (push) Successful in 22s
The blog's repository now exports the built site and a module serving it
from an nginx virtual host. services runs it on :8081 next to the
container on ops; Traefik does not route to it yet. Routes get an
optional priority, so the new route can take over from the container's
labels (1000) without removing them first. nginx now reloads for a
changed virtual host instead of restarting.

Assisted-by: Claude:opus-5-5
2026-11-17 12:19:50 +04:00
2635b887c7
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
2026-11-17 11:11:33 +04:00
c9ac900b3d
xray: restart only when its own config changes
All checks were successful
nixos / nixos (push) Successful in 1m15s
Xray restarted whenever anything in services' secrets file changed,
because its restart trigger was the whole sops file; the runner token
change just now restarted it. Xray may carry the admin's uplink. Tie the
restart to its own secret.

Assisted-by: Claude:opus-5-5
2026-11-17 11:00:57 +04:00
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
0a54caa7d4
nixos: rotate the runner registration token
All checks were successful
nixos / nixos (push) Successful in 1m14s
The token sat in the old repository history. Forgejo generated a new
one, which retires the old; the runner re-registers with it on this
deploy (the job running the deploy shows as cancelled; the next run
confirms). The old runner entry stays behind offline.

Assisted-by: Claude:opus-5-5
2026-11-17 10:40:56 +04:00
b8cbf0fbf5
nixos: deploys do not kill a running backup or replica
Some checks failed
nixos / nixos (push) Failing after 1m15s
The daily replica that started at 06:09:59 was stopped 41 seconds later
by a deploy that changed its unit, and mailed a failure. Long one-shot
jobs keep running through a switch now; the next run uses the new unit.

Assisted-by: Claude:opus-5-5
2026-11-17 10:21:13 +04:00
e27baf32ee
replica: give rclone a home directory
All checks were successful
nixos / nixos (push) Successful in 33s
rclone looked for one and logged three errors per bucket on every run,
though its remotes come from the environment.

Assisted-by: Claude:opus-5-5
2026-11-17 10:06:13 +04:00
796331815d
tofu: rename from terraform, state in its own bucket, Loki buckets
All checks were successful
nixos / nixos (push) Successful in 34s
The infrastructure is applied with OpenTofu; name it so. terraform/
becomes tofu/, the files end in .tofu (OpenTofu 1.8+ prefers them), the
local variables file is secrets.auto.tfvars, and both servers carry
managed_by=opentofu (an in-place label change).

The state moved to new buckets asxpio-tofu-main/-repl, key
tofu/state/tofu.tfstate, with `tofu init -migrate-state`; a plan against
it shows no changes. The old asxpio-terraform-* buckets stay, renamed
in the config with moved blocks, until the new state has been used for
a while.

asxpio-loki-main, created by hand, is adopted with an import block, and
a new asxpio-loki-repl in fsn1 receives it in the daily replica, which
now also copies the new state bucket instead of the old one.

What keeps the Terraform name is OpenTofu's own: the `terraform {}`
block and .terraform.lock.hcl.

Assisted-by: Claude:opus-5-5
2026-11-17 09:42:53 +04:00
106bba969f
nixos: drop the access the ops conversion needed
All checks were successful
nixos / nixos (push) Successful in 39s
asxpio-ops runs NixOS since 2026-11-17. Remove the break-glass root
login from the admin's exit address, and on services the key Debian
ops pushed certificates with: ops now pushes with its own key from
sops, which services keeps.

Assisted-by: Claude:opus-5-5
2026-11-17 09:20:57 +04:00
72a14a1b1b
nixos: zsh for every account, security summary on login, XMPP over IPv6
All checks were successful
nixos / nixos (push) Successful in 1m3s
Every account now logs in with zsh, including ones added later, except
deploy and git: the app CI and Forgejo run commands through their login
shells. root gets the same zsh with a red prompt ending in #.

Interactive SSH logins show, under fastfetch, the host's security state
as the Grafana alerts see it, read from the local metrics files:
anything unexpected (peers, devices, accounts, ports, containers),
who is logged in, the last good backup per repository, the bucket
replica, failed units and fail2ban bans.

XMPP gets a Podman network of its own with IPv6. xmpp.asxp.io has an
AAAA record, and Podman's default network forwards published ports over
IPv4 only, where Docker on Debian did both: since the conversion, XMPP
over IPv6 was refused. Tried on the rehearsal host with a published port
on the new network, reached over IPv6 and IPv4.

Assisted-by: Claude:opus-5-5
2026-11-17 07:28:36 +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
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