nix: re-run the host's store fetches on a ten-minute timer
Seven host oneshots fetch a secret from the swarm secret store into a file their consumer loads at start: swarm-bao-grafana-oidc, swarm-bao-otel-oidc, swarm-bao-matrix-oidc, swarm-bao-ci-runner, swarm-bao-forge-oidc, swarm-bao-hive-otel-oidc and swarm-bao-forwarder-oidc. Each was RemainAfterExit with no timer, so it ran at boot or deploy and never again: a secret re-minted in the store reached its consumer only through an operator restarting the fetch. lib/store-refresh-timer.nix gives each one a timer (OnUnitInactiveSec 10min, RandomizedDelaySec 1min, the agent's own store re-read interval), and each drops RemainAfterExit so a timer start is not a no-op. Each script already writes the file only when secret_differs, and refresh_consumer/refresh_unit restart the consumer only when the file is newer than its last start, so a run reading an unchanged value restarts nothing. Two docs said these units do not run on a timer; credentials.md's ci-runner row said the runner token is not re-pulled. Part of #5017 (slice T).
This commit is contained in:
parent
c2dc18413b
commit
2f05e2db28
12 changed files with 146 additions and 13 deletions
|
|
@ -160,8 +160,8 @@ needs `deploy.forgejo.enable` or a hive on its host.
|
|||
with the `ci-runner` leaf, whose `swarm-ci-runner` role reads that one path
|
||||
and nothing else, retrying every 30 seconds until the token is there. It
|
||||
writes the token to a root-only file inside the container, and restarts
|
||||
the runner when the value changes. It runs at boot and on deploy, not on a
|
||||
timer.
|
||||
the runner when the value changes. It runs at boot, on deploy, and every
|
||||
ten minutes on a timer.
|
||||
3. **`swarm-ci-runner-register.service`** in the container is the only unit
|
||||
that loads that file, with `LoadCredential=`. systemd hands a unit's
|
||||
credentials to all of its processes, and for a `host` label act_runner
|
||||
|
|
|
|||
|
|
@ -134,8 +134,9 @@ reads its secret from the swarm's secret store under the hive's own leaf
|
|||
(`deploy.bao.clientCertFile`): `swarm-bao-hive-otel-oidc.service` fetches
|
||||
`swarm/hives/<hive>/oidc/client`, which the publisher on authelia's host
|
||||
writes. It runs at boot and retries every 30s until the store answers; when a
|
||||
run lands a changed value it restarts the collector. It doesn't run on a timer,
|
||||
so a secret rotated later arrives the next time the unit runs. On a hive that
|
||||
run lands a changed value it restarts the collector. A timer runs it again
|
||||
every ten minutes, so a secret rotated later reaches the collector within
|
||||
about ten minutes. On a hive that
|
||||
runs the store the leaf is already there; elsewhere it's the credential you
|
||||
place — see [secret placement](../swarm/secrets.md).
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue