Commit graph iac/nixos/modules
Author SHA1 Message Date
acf5260414
nixos: never restart podman-restart on a deploy
All checks were successful
nixos / nixos (push) Successful in 40s
Its stop step is `podman stop --all`. A deploy that changes the unit,
such as a Podman update, would restart it and so stop XMPP, running CI
jobs and every app, only to start them again. It does its work at boot;
leave it alone on a switch.

Assisted-by: Claude:opus-5-5
2026-11-17 08:31:51 +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
f49dd72172
nixos: podman without sudo for the admins; re-key the rehearsal ops
All checks were successful
nixos / nixos (push) Successful in 35s
`podman` run as an admin showed that user's own, empty rootless store,
so `podman ps` needed sudo while `docker ps` did not. Point CONTAINER_HOST
at the system Podman's socket, which group podman (the admins) may use.

The rehearsal ops server was rebuilt and has a new host key.

Assisted-by: Claude:opus-5-5
2026-11-17 08:10:13 +04:00
3aca8a85a3
nixos: break-glass root login on ops for its conversion
All checks were successful
nixos / nixos (push) Successful in 33s
ops is the WireGuard hub. If WireGuard does not come back after the
switch, root may still log in from the admin's exit address (services'
IPv4, where the admin's traffic leaves through Xray). Root only, ops
only; the dead-man reboot covers the rest. Remove after Phase 2.

Assisted-by: Claude:opus-5-5
2026-11-17 07:51:59 +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
a80134f6ff
nixos: Podman DNS on every container network
Some checks failed
nixos / nixos (push) Failing after 1m45s
The NixOS Podman module opens DNS (aardvark-dns, port 53) on podman0
only. CI jobs and compose stacks run on networks of their own, whose
bridges are podman1, podman2 and so on, so their containers could not
resolve anything. The first CI run on the converted asxpio-services
failed this way: nix could not reach cache.nixos.org. The rehearsal
jobs had not downloaded anything, so it went unnoticed there.

Open 53 on every podman* interface. Tried on the rehearsal host with a
container on its own network.

Assisted-by: Claude:opus-5-5
2026-11-17 07:12:52 +04:00
39ed5d17b7
nixos: zsh and fastfetch for the admins
Some checks failed
nixos / nixos (push) Failing after 3m20s
zsh as on the admin's workstation (asxpi/nixOS modules/shell.nix):
completion, autosuggestions, syntax highlighting, the same history
options, key bindings and blue prompt, without what only the
workstation needs. asxpi logs in with it; deploy and root keep bash,
because the app CI and scripts run commands through their login shell.
The new-user wizard is off, since fresh homes have no ~/.zshrc.

fastfetch prints a system summary on interactive SSH logins only, so
scp, CI and `ssh host <command>` stay quiet. bat and eza come along.

Tried on the rehearsal services host.

Assisted-by: Claude:opus-5-5
2026-11-17 07:07:37 +04:00
fa46d26f89
nixos: app stacks on Podman, unchanged
The apps keep deploying themselves: their CI copies a compose file and
a .env and runs docker compose as user deploy. `docker` is now the real
Docker CLI against rootful Podman's socket, so compose, inspect and
logs behave as before and every user sees the same containers.

Their compose files still expect the storage stack's network and the
hosts postgres and garage. On ops every container resolves those two
names to the host, where the native services run, and an empty storage
network exists, so nothing in the app repositories has to change for
the move itself.

Tried on the rehearsal pair with the real asxpio and datacenterbingo
images on the restored database and Garage (mail and IndexNow
disabled): both serve through Traefik, and a local compose build works.

One thing does need the app repositories: Podman ignores the
HEALTHCHECK of OCI-format images, which is what the CI builds, so the
deploy's wait for "healthy" would time out. Declaring the healthcheck
in each compose file fixes it, also under Docker; see MIGRATION.md.

ops-data.sh now also moves the monitoring history, Traefik's
certificates and the app directories, and pulls the images again.

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