iac/nixos/hosts/rehearsal/ops.nix
Sergei Poljanski e95d97869f
nixos: Traefik and the CI runners as native services
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
2026-11-16 23:17:09 +04:00

49 lines
1.6 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";
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"
];
}
];
}