swarm-bao-forge-publisher starts on the deploy that adds it
The publisher was wanted only by container@hive-forge.service. A switch starts a new unit only through the targets that want it, and the container is already running, so the deploy that introduced the publisher left it dead until the next container restart or boot; the path unit cannot help, because the mint's only-once guard never rewrites the file. - The publisher is also wanted by multi-user.target, like swarm-secret-publish. - A token file that is not there yet exits 0 instead of waiting 120s and failing: the path unit runs the publisher when the mint writes it, so a switch with the forge container down does not fail. TimeoutStartSec is 60. - swarm-controller loses its After= on the publisher: a switch issues the two jobs separately, so it ordered nothing there, and the background re-read covers the gap. - The controller's background re-read logs at info once the backoff is capped, one line per five minutes, so a forge host that never got its publisher leaf stays visible; earlier retries stay at debug. Refs #4998
This commit is contained in:
parent
2d2d7529fc
commit
597fdebaf3
4 changed files with 52 additions and 32 deletions
|
|
@ -292,12 +292,16 @@ let
|
|||
&& lib.hasInfix "bao kv put secret/swarm/controller/swarm-controller/forge/token value=@\"$src\"" u.script
|
||||
&& lib.hasInfix "/var/lib/nixos-containers/hive-forge/var/lib/forgejo/swarm-controller-token" u.script
|
||||
&& lib.elem "container@hive-forge.service" u.wantedBy
|
||||
# The deploy that adds the unit starts it only through a target.
|
||||
&& lib.elem "multi-user.target" u.wantedBy
|
||||
&& !(allLocal.systemd.services ? hive-forge-swarm-controller-token);
|
||||
}
|
||||
{
|
||||
# What makes it re-run. A oneshot left `active (exited)` makes every later
|
||||
# start a no-op, so `RemainAfterExit` would silence both triggers: the
|
||||
# container's start (`wantedBy`, above) and a write of the token file.
|
||||
# start a no-op, so `RemainAfterExit` would silence every trigger: the
|
||||
# targets and the container's start (`wantedBy`, above) and a write of
|
||||
# the token file. A missing file exits 0, so a switch with the container
|
||||
# down does not fail.
|
||||
name = "the forge publisher re-runs on each container start and each write of the token file";
|
||||
ok =
|
||||
let
|
||||
|
|
@ -308,6 +312,8 @@ let
|
|||
p.pathConfig.PathChanged
|
||||
== "/var/lib/nixos-containers/hive-forge/var/lib/forgejo/swarm-controller-token"
|
||||
&& p.pathConfig.Unit == "swarm-bao-forge-publisher.service"
|
||||
&& lib.hasInfix "the path unit publishes it when it does" (publisher allLocal).script
|
||||
&& lib.hasInfix "exit 0" (publisher allLocal).script
|
||||
&& lib.elem "multi-user.target" p.wantedBy
|
||||
&& !(bare.systemd.paths ? swarm-bao-forge-publisher);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue