Commit graph iac/nixos/flake.nix
Author SHA1 Message Date
b96928f472
deps: Update blog digest to 5ff625f
All checks were successful
nixos / nixos (push) Successful in 26s
2026-11-17 10:08:03 +00: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
3522fdb4f1
czsk: take the fix for nginx's header check
All checks were successful
nixos / nixos (push) Successful in 22s
The previous czsk commit failed services' build: gixy refused a location
whose add_header dropped the server's security headers. comin kept the
running system; this moves the input to the fixed commit.

Assisted-by: Claude:opus-5-5
2026-11-17 13:30:05 +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
352f69855f
deps: Update blog digest to bbd489c
All checks were successful
nixos / nixos (push) Successful in 22s
2026-11-17 08:53:02 +00:00
17bf20cdbc
flake: pin the blog input's commit in its URL, for Renovate
All checks were successful
nixos / nixos (push) Successful in 25s
Renovate's nix manager follows a flake input along its branch only when
the URL names a commit (rev=); without one it leaves the input to lock
file maintenance, which bumps every input at once. The blog input now
carries ref=main and the deployed rev, which Renovate moves forward.

Assisted-by: Claude:opus-5-5
2026-11-17 12:44:22 +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
35bc42b01b
crawler: use the tool's own flake instead of a copy of the script
All checks were successful
nixos / nixos (push) Successful in 21s
crawler-alert.py was a byte-identical copy of the one in
asxpi/traefik-crawlers-statistics. That repository now has a package and
a NixOS module with the same three units and timers; iac takes it as a
flake input and keeps only the settings. The package also puts dig on
the script's path, which the Meta ASN check needs and lacked here.

Assisted-by: Claude:opus-5-5
2026-11-17 12:00:16 +04:00
9290a4e181
nixos: add comin, hosts pull their configuration from main
All checks were successful
nixos / nixos (push) Successful in 3m22s
Each host runs comin, which polls main of this repository every minute,
builds nixosConfigurations.<hostname> on the host and switches to it.
A branch testing-<hostname> on top of main is applied with `test` to
that host alone. Prometheus scrapes comin over the private network, and
a failing fetch, evaluation, build or switch alerts after 15 minutes.

CI still deploys this commit, which starts comin; the CI deploy job and
its SSH key go in the next commit, once comin runs on both hosts.

Assisted-by: Claude:opus-5-5
2026-11-17 11:39:03 +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
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
ebbf458983
docs: the full migration plan; ci: deploy NixOS hosts
All checks were successful
nixos / nixos (push) Successful in 55s
MIGRATION.md is now the complete plan for moving production from
Ansible and Terraform to NixOS and OpenTofu: what was rehearsed and
how, the preparation that needs no downtime, one runbook per host with
its checks and rollback, the clean-up including the branch renames,
and the rules for running restored production data on test servers.

The NixOS workflow now deploys on main, ops first, building on each
host. It checks /etc/NIXOS before touching a host, so it skips both
servers until their conversion and cannot reach a Debian one.
known_hosts moves to the repository root for it.

Renovate learns the Nix files: version comments, the runner's job
images and flake.lock (weekly). The Ansible patterns stay until
Ansible is gone.

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