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
This commit is contained in:
parent
9290a4e181
commit
29dcc8915a
1 changed files with 31 additions and 77 deletions
21
README.md
21
README.md
|
|
@ -24,18 +24,25 @@ 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.
|
||||
Edit `nixos/`, push a branch (CI evaluates every host), merge to `main`.
|
||||
Each host pulls `main` within a minute, builds its own configuration and
|
||||
switches to it ([comin](https://github.com/nlewo/comin),
|
||||
`nixos/modules/comin.nix`). Only units whose definition changed restart.
|
||||
Undo by reverting on `main`, or `nixos-rebuild switch --rollback` on the
|
||||
host (the next commit on `main` replaces it).
|
||||
|
||||
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.
|
||||
- Try a change on one host first: push it to `testing-<hostname>` on
|
||||
top of `main`; that host applies it with `test` (not the boot
|
||||
default). Merge it to `main` to keep it.
|
||||
- `comin status` on a host shows what it fetched, built and deployed. A
|
||||
failing fetch, build or switch alerts in Grafana after 15 minutes.
|
||||
- comin on ops fetches from Forgejo on ops. A change that breaks
|
||||
Forgejo or Traefik has to be fixed by hand (`nixos/README.md`).
|
||||
- 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
|
||||
|
|
@ -72,7 +79,7 @@ and restores: `RESTORE.md`.
|
|||
|
||||
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
|
||||
them at boot. CI holds no server credentials. Keep a copy of the admin
|
||||
age key (`~/.config/sops/age/keys.txt`) outside this machine.
|
||||
|
||||
## TODO
|
||||
|
|
|
|||
Loading…
Reference in a new issue