iac/nixos/hosts/rehearsal/ops.nix
Sergei Poljanski 2ca56d595c
All checks were successful
nixos / nixos (push) Successful in 44s
nixos: containers come back after a reboot; ops-data.sh fixes
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

74 lines
2.4 KiB
Nix

# asxpio-ops on a throwaway server: the same system with its own keys,
# its own addresses and SSH open to the world. Pairs with ./services.nix
# on a private network with the production addresses (10.10.0.10/.20).
{ lib, ... }:
{
networking.hostName = "rehearsal-ops";
sops.defaultSopsFile = ../../secrets/rehearsal-ops.yaml;
asxpio.sshFrom = [ "*" ];
# Same script and schedule, into repositories on its own disk
asxpio.backup.repositories = lib.mkForce {
hel1 = "/var/backups/test-repo-hel1";
fsn1 = "/var/backups/test-repo-fsn1";
};
systemd.network.networks."10-public".address = lib.mkForce [ "2a01:4f9:c015:f949::1/64" ];
# A restored copy of production must not mail anyone, sync mirrors or
# call webhooks
services.forgejo.settings = {
mailer.ENABLED = false;
service.ENABLE_NOTIFY_MAIL = lib.mkForce false;
mirror.ENABLED = false;
webhook.ALLOWED_HOST_LIST = "loopback";
"cron.update_mirrors".ENABLED = false;
};
# The names point at production, so no challenge can succeed here:
# ask the staging CA, and expect Traefik's self-signed certificate
asxpio.letsencryptCA = "https://acme-staging-v02.api.letsencrypt.org/directory";
# No alert mail from a test pair
asxpio.alertEmail = "nobody@example.invalid";
services.grafana.settings.smtp.enabled = lib.mkForce false;
systemd.timers.crawler-alert.enable = false;
# No services host behind 10.10.0.20 on the test network
systemd.paths.xmpp-cert-sync.enable = false;
systemd.timers.xmpp-cert-sync.enable = false;
systemd.timers.crawler-weekly.enable = false;
services.loki.configuration = {
# No Object Storage keys here: everything on local disk
schema_config.configs = lib.mkForce [
{
from = "2026-11-01";
store = "tsdb";
object_store = "filesystem";
schema = "v13";
index = {
prefix = "index_";
period = "24h";
};
}
];
compactor.delete_request_store = lib.mkForce "filesystem";
};
asxpio.wireguard.peers = [
{
name = "asxpio-services";
publicKey = "DwCNEfzgV1fU2ZPwEwkxun/s8vMZYrzdp74ZDrrSTD4=";
allowedIPs = [
"10.20.0.20/32"
"fd69:69:69::20/128"
];
}
{
name = "laptop";
publicKey = "iTY+NChSd8pcm/vke8s8EqsxjwEJpBEc07PfEg1Q0zQ=";
allowedIPs = [
"10.20.0.2/32"
"fd69:69:69::2/128"
];
}
];
}