deploy: split the forge's host decisions out of swarm.forge
`swarm.*` is what a hive needs to be a *client* of the swarm. For the forge that is what it IS from any hive's point of view: its package, the names and ports it answers on, the URLs it advertises, and the client id it is registered under. How it is served, what it mirrors and where its host-local secrets sit are decisions of the machine running it, so behindGateway, openFirewall, mirrors, sso.clientSecretFile and hostSwarmControllerTokenFile move to `deploy.forgejo.*`. Unlike the wireguard mesh this SPLITS a module rather than relocating a whole namespace. `sso` splits with it: `clientId` stays because it must match the id in authelia's register, while the secret beside it is a path on one host. Moving the whole `sso` block for symmetry with `ci` was considered and rejected on exactly that asymmetry. Declared in hive-forge/default.nix under the `deploy.*` path, following swarm-victorialogs.nix; deploy.nix carries only the renames. `mirrors` renames in one entry rather than one per field — it is a single option of a list-of-submodule type, so the rename carries its whole value, where `ci` needed five because it is a plain attrset of options. Readers outside the module: hive-ci.nix binds `deploy.forgejo` for its behindGateway assertion; swarm-authelia.nix and swarm-controller.nix read theirs off the `deployCfg` they already bind. hivectl's `open` printed `services.hyperhive.forge.behindGateway` in an operator-facing hint — a path that never existed, missing `swarm.` — and hive-c0re's state_snapshot doc comment carried the same defect; both now name the new path. The rendered docs put the two halves on separate pages, so the five descriptions of staying options that explain themselves in terms of `behindGateway` now qualify it in full. module-eval gains a forge case configured entirely through the old paths, asserting the rendered firewall ports and the mirror env var c0re seeds from: the new paths evaluate fine without the shims, so dropping them reads as a clean tree. All five old paths are defined in the fixture, so removing any single shim entry fails the eval rather than only the two the assertion reads.
This commit is contained in:
parent
368f5d82aa
commit
1db2ac26a7
13 changed files with 211 additions and 122 deletions
|
|
@ -72,6 +72,23 @@ let
|
|||
swarm.wireguard.privateKeyFile = "/etc/wireguard/hive.key";
|
||||
};
|
||||
|
||||
# Same shape for the forge, which SPLIT rather than moving whole: the five
|
||||
# host-side options are set here through their pre-rename paths while the
|
||||
# rest of `swarm.forge` stays put. All five are defined so that dropping any
|
||||
# single shim entry fails the eval, not just the two the assertion reads.
|
||||
forgeOldPath = hive {
|
||||
swarm.forge.behindGateway = true;
|
||||
swarm.forge.openFirewall = true;
|
||||
swarm.forge.hostSwarmControllerTokenFile = "/etc/forge/sc.token";
|
||||
swarm.forge.sso.clientSecretFile = "/etc/forge/oidc.secret";
|
||||
swarm.forge.mirrors = [
|
||||
{
|
||||
upstream = "https://example.invalid/tool";
|
||||
dest = "mirrors/tool";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
baoPkcs11 = hive {
|
||||
deploy.bao.enable = true;
|
||||
deploy.bao.seal = "pkcs11";
|
||||
|
|
@ -205,6 +222,20 @@ let
|
|||
in
|
||||
wg.ips == [ "10.100.0.1/24" ] && wg.privateKeyFile == "/etc/wireguard/hive.key";
|
||||
}
|
||||
{
|
||||
# Same reasoning one namespace over, plus the shape the mesh did not
|
||||
# have: `mirrors` is a single option of a list-of-submodule type, so its
|
||||
# one rename entry has to carry a whole compound value rather than a
|
||||
# scalar. Both arms read a rendered effect — the host firewall and the
|
||||
# env var c0re seeds mirrors from — not the option.
|
||||
name = "a config written against the pre-rename forge paths still opens the firewall and seeds the mirror";
|
||||
ok =
|
||||
let
|
||||
ports = forgeOldPath.networking.firewall.allowedTCPPorts;
|
||||
seeded = builtins.fromJSON forgeOldPath.systemd.services.hive-c0re.environment.HYPERHIVE_FORGE_MIRRORS;
|
||||
in
|
||||
builtins.elem 3000 ports && builtins.any (m: m.dest == "mirrors/tool") seeded;
|
||||
}
|
||||
{
|
||||
# The gateway's per-name issuer choice. If this ever collapses to a
|
||||
# constant, every swarm-service vhost serves a certificate its CA
|
||||
|
|
|
|||
Loading…
Reference in a new issue