deploy: rename enableAllLocalDefaults to deploy.singleHostSwarm
Same defect as the switch below it, one tier up: it sat at the TOP of `services.hyperhive`, a namespace that is meant to be everything about hyperhive rather than the settings of a single hive. Whether this box is the whole deployment is as per-host as a decision gets. The name follows mara's sentence for what it means — "everything in the swarm is running on this host" — rather than naming its mechanism. "Defaults" was doing no work: it is not a defaults toggle, it is a claim about where the swarm lives, and the pair now reads as the containment it already was, singleHostSwarm implying allSwarmServices plus this hive. One site was a setter rather than a reference: module-eval's `allLocal` fixture passes an attrset merged into `services.hyperhive`, so its key carries the path and had to become `deploy.singleHostSwarm`. A rename by bare identifier is right for the twelve prose mentions and wrong for exactly this one, which is worth knowing before the next rename.
This commit is contained in:
parent
585269b8a3
commit
97a7b518ea
13 changed files with 35 additions and 25 deletions
|
|
@ -24,7 +24,7 @@ the root, so setting the swarm CA up is an operator action rather than
|
|||
something a host assumes. Turn it on for an all-on-one-host deployment
|
||||
and the hierarchy costs no configuration.
|
||||
|
||||
It defaults from `services.hyperhive.enableAllLocalDefaults`, the single
|
||||
It defaults from `services.hyperhive.deploy.singleHostSwarm`, the single
|
||||
switch that says "this box is the whole deployment".
|
||||
|
||||
**A hive given neither artifact keeps the self-signed CA it has always
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ scraped; otherwise no secret is needed and none is placed.
|
|||
### Minting the queue's callout nkeys
|
||||
|
||||
`nats.autoGenerateCallout` mints both keypairs on the host before the queue
|
||||
starts. It is on by default only under `enableAllLocalDefaults` — the one
|
||||
starts. It is on by default only under `singleHostSwarm` — the one
|
||||
topology where the queue, its responder and the operator are the same person. On
|
||||
every other topology, mint them yourself:
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ matrix homeserver, the SSO provider, the CA. Two options say where the
|
|||
optional ones live, and everything else derives:
|
||||
|
||||
```nix
|
||||
services.hyperhive.enableAllLocalDefaults = true; # everything on this box
|
||||
services.hyperhive.deploy.singleHostSwarm = true; # everything on this box
|
||||
# or, for a dedicated services host with hives elsewhere:
|
||||
services.hyperhive.deploy.allSwarmServices = true;
|
||||
```
|
||||
|
||||
`enableAllLocalDefaults` is the all-on-one-box switch: it defaults both
|
||||
`singleHostSwarm` is the all-on-one-box switch: it defaults both
|
||||
`deploy.allSwarmServices` (the shared services run here) and
|
||||
`swarm.ca.autoConfigure` (the swarm CA is generated here). Each derived
|
||||
toggle can still be set on its own, so "all local except X" needs no
|
||||
|
|
@ -33,7 +33,7 @@ Those two options are what makes the difference between deployments, so
|
|||
the shapes worth naming are the ones they produce:
|
||||
|
||||
- **All-local.** Everything on one machine:
|
||||
`enableAllLocalDefaults = true`. Setup is automatic apart from
|
||||
`singleHostSwarm = true`. Setup is automatic apart from
|
||||
choosing a domain and creating the first user.
|
||||
- **Services on the swarm controller host.**
|
||||
`deploy.allSwarmServices = true` there; the required services
|
||||
|
|
|
|||
|
|
@ -119,6 +119,16 @@ in
|
|||
[ "services" "hyperhive" "swarm" "enableRequiredServices" ]
|
||||
[ "services" "hyperhive" "deploy" "allSwarmServices" ]
|
||||
)
|
||||
|
||||
# The mode above that one. It sat at the TOP of `services.hyperhive`,
|
||||
# which is the same defect one tier up: that namespace is everything
|
||||
# about hyperhive, not the settings of a single hive. The new name says
|
||||
# what the mode asserts — the whole swarm runs on this host — instead of
|
||||
# naming its mechanism.
|
||||
(lib.mkRenamedOptionModule
|
||||
[ "services" "hyperhive" "enableAllLocalDefaults" ]
|
||||
[ "services" "hyperhive" "deploy" "singleHostSwarm" ]
|
||||
)
|
||||
];
|
||||
|
||||
# ⚠️ `deploy.forgejo` is declared in ./hive-ci.nix, not here, and it is the
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ in
|
|||
DNS shouldn't have a stale `/etc/hosts` entry sticking
|
||||
around. Requires `services.hyperhive.domain` to be set.
|
||||
|
||||
`services.hyperhive.enableAllLocalDefaults` turns this on as
|
||||
`services.hyperhive.deploy.singleHostSwarm` turns this on as
|
||||
part of saying "this box is the whole deployment": that mode
|
||||
means there is no real DNS for these names and the operator is
|
||||
browsing them from the host itself. Set it here explicitly to
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
# `enableAllLocalDefaults` is declared in ./local-defaults.nix, with
|
||||
# `singleHostSwarm` is declared in ./local-defaults.nix, with
|
||||
# the values it asserts. It is a deployment mode rather than a setting
|
||||
# this module's options read, so it lives with its consequences.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# The all-local deployment mode.
|
||||
#
|
||||
# `enableAllLocalDefaults` is a *mode*, not a default other options read:
|
||||
# `singleHostSwarm` is a *mode*, not a default other options read:
|
||||
# it says "this box is the whole deployment" and then asserts the values
|
||||
# that follow from that. mara, on the issue: it is "more of a deployment
|
||||
# mode via settings set, less a default setting".
|
||||
|
|
@ -23,7 +23,7 @@ let
|
|||
cfg = config.services.hyperhive;
|
||||
in
|
||||
{
|
||||
options.services.hyperhive.enableAllLocalDefaults = lib.mkOption {
|
||||
options.services.hyperhive.deploy.singleHostSwarm = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
|
|
@ -69,23 +69,23 @@ in
|
|||
# every agent at its own netns. That guard already existing is what
|
||||
# makes turning this on by default safe; without it this line would
|
||||
# break every agent's access to the forge.
|
||||
config.services.hyperhive.gateway.localHostsEntry = lib.mkDefault cfg.enableAllLocalDefaults;
|
||||
config.services.hyperhive.gateway.localHostsEntry = lib.mkDefault cfg.deploy.singleHostSwarm;
|
||||
|
||||
# Out of the `swarm` attrset below, because it is a `deploy.*` option now
|
||||
# (./deploy.nix): "does THIS host run the swarm's services" is a per-host
|
||||
# decision. Written as a path rather than folded into a second
|
||||
# `config.services.hyperhive.deploy = { … }` attrset, for the same reason
|
||||
# the ⚠️ below gives about `swarm`.
|
||||
config.services.hyperhive.deploy.allSwarmServices = lib.mkDefault cfg.enableAllLocalDefaults;
|
||||
config.services.hyperhive.deploy.allSwarmServices = lib.mkDefault cfg.deploy.singleHostSwarm;
|
||||
|
||||
config.services.hyperhive.swarm = {
|
||||
ca.autoConfigure = lib.mkDefault cfg.enableAllLocalDefaults;
|
||||
ca.autoConfigure = lib.mkDefault cfg.deploy.singleHostSwarm;
|
||||
# The queue's auth-callout nkeys. Generating them is safe exactly
|
||||
# when one operator owns both the queue and its responder, which is
|
||||
# what this mode asserts. On any other topology the seeds have to
|
||||
# reach whoever runs the responder, and minting them here would move
|
||||
# that hand-off somewhere less visible rather than removing it.
|
||||
nats.autoGenerateCallout = lib.mkDefault cfg.enableAllLocalDefaults;
|
||||
nats.autoGenerateCallout = lib.mkDefault cfg.deploy.singleHostSwarm;
|
||||
# The controller's queue coordinates. Co-location is what makes these
|
||||
# derivable at all — loopback only reaches the queue when the queue is
|
||||
# here, and the minted client secret only exists on the host authelia
|
||||
|
|
@ -107,10 +107,10 @@ in
|
|||
# The *requirement* stays in `swarm-controller.nix` as an assertion:
|
||||
# needing a queue is the controller's own property in every topology,
|
||||
# and only the convenience is local.
|
||||
controller.queue.natsUrl = lib.mkIf cfg.enableAllLocalDefaults (
|
||||
controller.queue.natsUrl = lib.mkIf cfg.deploy.singleHostSwarm (
|
||||
lib.mkDefault "nats://127.0.0.1:${toString config.services.hyperhive.swarm.nats.port}"
|
||||
);
|
||||
controller.queue.clientSecretFile = lib.mkIf cfg.enableAllLocalDefaults (
|
||||
controller.queue.clientSecretFile = lib.mkIf cfg.deploy.singleHostSwarm (
|
||||
lib.mkDefault "${config.services.hyperhive.swarm.authelia.hostClientSecretDir}/swarm-controller.secret"
|
||||
);
|
||||
};
|
||||
|
|
@ -128,5 +128,5 @@ in
|
|||
# the per-host fact `swarm.*` may not carry. The ⚠️ collision note above
|
||||
# does not apply here — that one is about two definitions of `swarm`
|
||||
# itself, and this is a different top-level path.
|
||||
config.services.hyperhive.deploy.swarm-controller.enable = lib.mkDefault cfg.enableAllLocalDefaults;
|
||||
config.services.hyperhive.deploy.swarm-controller.enable = lib.mkDefault cfg.deploy.singleHostSwarm;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
# Two provisioning modes, ONE structure — what differs is who puts the
|
||||
# artifacts on disk, never what the artifacts are:
|
||||
#
|
||||
# - autoconfigured (`services.hyperhive.enableAllLocalDefaults`, or
|
||||
# - autoconfigured (`services.hyperhive.deploy.singleHostSwarm`, or
|
||||
# `autoConfigure` set directly): the unit below generates the root
|
||||
# here on first boot.
|
||||
# - operator-provided (multi-host): the operator installs the root cert
|
||||
|
|
@ -68,7 +68,7 @@ in
|
|||
Run the whole swarm CA on this one host: generate the swarm
|
||||
root when it is missing, and issue this hive's CA under it.
|
||||
|
||||
`services.hyperhive.enableAllLocalDefaults` turns this on as
|
||||
`services.hyperhive.deploy.singleHostSwarm` turns this on as
|
||||
part of the all-on-one-box mode. Set it here directly to run the
|
||||
CA on a host that is not otherwise all-local.
|
||||
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ in
|
|||
};
|
||||
|
||||
# `enable` moved to `services.hyperhive.deploy.swarm-controller.enable` — see
|
||||
# ./deploy.nix. `services.hyperhive.enableAllLocalDefaults` still
|
||||
# ./deploy.nix. `services.hyperhive.deploy.singleHostSwarm` still
|
||||
# asserts it, and that was never an exception to "not derived from
|
||||
# services.hyperhive.enable": that mode says "this box is the whole
|
||||
# deployment", which answers the topology question outright, where
|
||||
|
|
@ -320,7 +320,7 @@ in
|
|||
Empty means unset, which the assertion below refuses — a
|
||||
controller with no queue is not a lighter controller.
|
||||
|
||||
`enableAllLocalDefaults` fills this in with loopback, because
|
||||
`singleHostSwarm` fills this in with loopback, because
|
||||
that address is only correct when the queue is on this host:
|
||||
its container shares the host netns. That derivation lives with
|
||||
the mode rather than here, so this option describes itself
|
||||
|
|
@ -354,7 +354,7 @@ in
|
|||
The controller cannot mint its own — minting happens inside
|
||||
authelia's state directory during its first boot — so away from
|
||||
that host the operator places the secret and names it here.
|
||||
`enableAllLocalDefaults` points this at the minted file, which
|
||||
`singleHostSwarm` points this at the minted file, which
|
||||
is exactly the case where one exists locally.
|
||||
|
||||
Read by `LoadCredential`, so it needs to be readable by root at
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ in
|
|||
Leave it off wherever the queue and its clients are not the same
|
||||
operator's problem: the seeds must reach whoever runs the
|
||||
responder, and minting them here only moves that distribution
|
||||
somewhere less visible. `enableAllLocalDefaults` turns it on.
|
||||
somewhere less visible. `singleHostSwarm` turns it on.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ in
|
|||
canonical store for the meta flake and every agent's config repo,
|
||||
so it deploys with hyperhive itself and is not optional.
|
||||
|
||||
`services.hyperhive.enableAllLocalDefaults` turns this on as part
|
||||
`services.hyperhive.deploy.singleHostSwarm` turns this on as part
|
||||
of the all-on-one-box mode. Set it directly to run the swarm's
|
||||
services on a host that is not otherwise all-local — a dedicated
|
||||
services box with hives elsewhere is exactly that shape.
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ let
|
|||
# turned on matrix and authelia but NOT nats, so an ordinary all-local
|
||||
# hive resolved authelia's two coordinates and not the queue URL. Two of
|
||||
# three set is exactly what the assertion below rejects, so every
|
||||
# `enableAllLocalDefaults` hive would have stopped evaluating.
|
||||
# `singleHostSwarm` hive would have stopped evaluating.
|
||||
#
|
||||
# (The queue does derive from that switch now — ./swarm-required-services.nix
|
||||
# — so the original asymmetry is gone. The reasoning below is why the
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ let
|
|||
];
|
||||
}).config;
|
||||
|
||||
allLocal = hive { enableAllLocalDefaults = true; };
|
||||
allLocal = hive { deploy.singleHostSwarm = true; };
|
||||
bare = hive { };
|
||||
withCi = hive { deploy.forgejo.ci.enable = true; };
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue