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
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
The NixOS module writes the routes (dynamicConfigOptions) into the
static configuration, so every route change restarted Traefik: about 15
seconds with every site down (08:24 and 09:14 today; the second broke
czsk's image push). The routes now go to /etc/traefik/dynamic.toml, a
copy activation replaces, and Traefik's file provider watches it; the
static configuration stays the same. This deploy restarts Traefik once.
Assisted-by: Claude:opus-5-5
The blog container and /opt/blog are gone from asxpio-ops, so the route
to the NixOS service no longer has to outrank its labels.
Assisted-by: Claude:opus-5-5
comin status --json | jq -r '.deployer.deployment.status'
loginctl list-users --no-legend | awk '{print \$2, \$3}' | tr '\n' ' '; echo
ls /var/lib/systemd/linger
EOF
git log --oneline -1
nixos: keep the login users' systemd managers running (linger)
Every SSH login starts a user's systemd manager and the logout stops it:
a git push as git, a CI deploy, an admin session. A switch that reloads
user units while one is starting or stopping fails with status 4
although the system did switch, and comin reports the deployment as
failed; at 08:50 a push as git did this on ops and the "Deploy failing"
alert mailed. With linger the managers run permanently.
Assisted-by: Claude:opus-5-5
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
One row per host: deployed commit (linked to Forgejo), last deployment,
whether the head of main is signed or still waiting, failing stages,
reboot needed, suspended, last activation. Below: the stage and head
history, fetch rate, activations, and comin's log from Loki.
Assisted-by: Claude:opus-5-5
Traefik routes blog.asxp.io to the blog's NixOS service at priority
2000, above the container's labels; removing the route falls back to the
container. Renovate merges bumps of the app inputs (blog for now) onto
main by itself once CI passes, as a signed fast-forward, so comin deploys
an app commit without anyone merging it.
Assisted-by: Claude:opus-5-5
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
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
The process listening on 4243 is .comin-wrapped, so the baseline flagged
it as unknown. After a restart comin reports an empty status until the
next commit arrives; count the head as pending only when it differs from
both the evaluated and the deployed commit.
Assisted-by: Claude:opus-5-5
The head of main must carry the admin's GPG signature or Renovate's SSH
signature (nixos/keys), so write access to the repository alone, such
as renovate-bot's API token, no longer reaches root on the hosts.
comin skips an unsigned head without a metric of its own, so a timer
exports whether the head is signed and whether it still waits for
evaluation; both alert.
Assisted-by: Claude:opus-5-5
comin on each host pulls main and switches, so the CI deploy job, its
SSH configuration and the known_hosts it used go. CI keeps evaluating
every host on every push and no longer holds a key to the servers;
SSH_DEPLOY_KEY can be removed from the repository secrets.
Assisted-by: Claude:opus-5-5
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
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
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
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
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
Forgejo's INTERNAL_TOKEN, JWT_SECRET and LFS_JWT_SECRET sat in the old
repository history for a year; Grafana ran on its public default
secret_key. New values, generated by Forgejo and openssl, straight into
sops. SECRET_KEY stays: changing it would break 2FA.
sops-nix does not restart anything when a secret changes. The secrets
now name the unit that reads them (Forgejo, Grafana, postgres-roles,
garage-bootstrap), so a changed value takes effect on the deploy.
Assisted-by: Claude:opus-5-5
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
Both servers run NixOS. The Ansible code and the move itself leave main
for their own branches: `ansible` is the Debian/Ansible setup as it was
before the migration, `migration` keeps the plan and record, the data
scripts and everything else the move needed.
README and RESTORE describe the setup as it is now: NixOS, Podman,
sops, OpenTofu, the backup paths and hooks of the new layout. The
README carries the TODO list that MIGRATION.md had. The Forgejo
sanitising script stays, under hosts/rehearsal, with the rules for
rehearsing on restored production data in the NixOS README. Renovate
no longer looks at Ansible files.
Assisted-by: Claude:opus-5-5
On NixOS an activation rewrites accounts and authorized_keys whenever
the configuration changes them, so every such deploy fired the alert
and resolved it minutes later. Each host now records when it last
activated a configuration (nixos_activation_timestamp_seconds, written
on every deploy and boot), and the rule ignores changes within 20
minutes of one. A change outside a deploy, which on these hosts can only
be a hand edit, still fires.
Assisted-by: Claude:opus-5-5
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
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
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
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
`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
A restored /opt/<app>/.env holds production credentials: vhpbot would
log in as the production bot, asxpio-monitor would probe the internet,
the apps could send mail. On a rehearsal host the script now stops
before starting them; they are started by hand, sanitized.
Assisted-by: Claude:opus-5-5
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
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
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
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
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
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
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
Same script, schedule and threshold. It now mails through SMTP with the
alert account from sops instead of reading Forgejo's app.ini out of its
container, and reads Traefik's log at its new place. Forgejo's router
is forgejo@file now.
Tried on the rehearsal pair against generated GPTBot traffic.
Assisted-by: Claude:opus-5-5
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
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
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
Anyone with the repo and the secrets should be able to rebuild the
servers. nixos/README.md covers building from nothing, reinstalling in
place and the rehearsal pair; RESTORE.md covers restoring from the
restic backups; MIGRATION.md is the plan and runbook for moving
production over, with what was learned on the test servers.
CI evaluates every host on a push under nixos/. It does not deploy yet:
no production host runs NixOS.
Assisted-by: Claude:fable-5-2
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