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
|
|
@ -36,15 +36,22 @@ The servers themselves (and DNS, firewalls, buckets) are OpenTofu in
|
|||
|
||||
## Changing something
|
||||
|
||||
Edit, push a branch (CI evaluates every host), merge to `main`: CI
|
||||
builds each host on itself and switches to it, ops first. A host that
|
||||
does not run NixOS yet is skipped. By hand, over WireGuard:
|
||||
Edit, push a branch (CI evaluates every host), merge to `main`: each
|
||||
host's comin (`modules/comin.nix`) pulls `main` within a minute, builds
|
||||
`nixosConfigurations.<hostname>` on the host and switches to it. A
|
||||
branch `testing-<hostname>` on top of `main` is applied to that host
|
||||
alone with `test`. `comin status` on the host shows the state.
|
||||
|
||||
By hand, when comin can't fetch (Forgejo or Traefik on ops broken),
|
||||
over WireGuard, building on the host itself:
|
||||
|
||||
```sh
|
||||
nixos-rebuild switch --flake .#asxpio-services \
|
||||
--target-host root@10.20.0.20 --build-host root@10.20.0.20
|
||||
git archive HEAD | ssh root@10.20.0.10 'rm -rf /root/iac; mkdir /root/iac; tar -x -C /root/iac'
|
||||
ssh root@10.20.0.10 'cd /root/iac/nixos && nixos-rebuild switch --flake .#asxpio-ops'
|
||||
```
|
||||
|
||||
comin moves on from there with the next commit on `main`.
|
||||
|
||||
Only units whose definition changed restart. Undo with
|
||||
`nixos-rebuild switch --rollback` on the host, or pick the previous
|
||||
generation in the boot menu (Hetzner console). Package updates come from
|
||||
|
|
@ -134,7 +141,7 @@ tofu apply # puts the rebuild protection back
|
|||
```
|
||||
|
||||
Then continue at step 2 above. The server gets new SSH host keys, so
|
||||
step 3's `sops updatekeys` is needed, and `known_hosts` entries change.
|
||||
step 3's `sops updatekeys` is needed.
|
||||
|
||||
## Secrets
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue