wait for grafana's socket and read the forge's user list whole in the mint
This commit is contained in:
parent
c0429bf617
commit
279428a66f
1 changed files with 95 additions and 8 deletions
|
|
@ -310,6 +310,30 @@ let
|
|||
&& lib.elem "swarm-bao-grafana-admin.service" unit.after
|
||||
&& grafanaRemoteAuthelia.systemd.timers ? swarm-bao-grafana-controller-token;
|
||||
}
|
||||
{
|
||||
# The container is ready when the guest's boot finishes, which can be
|
||||
# before Grafana listens, so the unit waits for the socket inside its own
|
||||
# start job, ahead of every call that needs it. The wait is bounded and
|
||||
# sits inside the unit's own timeout, or systemd kills the job first.
|
||||
name = "the controller's Grafana token waits a bounded time for Grafana's socket before its first call";
|
||||
ok =
|
||||
let
|
||||
unit = grafanaRemoteAuthelia.systemd.services.swarm-bao-grafana-controller-token;
|
||||
s = unit.script;
|
||||
parts = lib.splitString "if ! retry_in_job " s;
|
||||
budget = lib.toInt (lib.head (lib.splitString " " (lib.elemAt parts 1)));
|
||||
at = needle: lib.stringLength (lib.head (lib.splitString needle s));
|
||||
in
|
||||
lib.length parts == 2
|
||||
&& lib.hasInfix "retry_in_job() {" s
|
||||
&& lib.hasInfix "${toString budget} grafana_listening; then" s
|
||||
&& lib.hasInfix "http://localhost/api/health" s
|
||||
&& budget > 0
|
||||
&& budget <= 120
|
||||
&& unit.serviceConfig.TimeoutStartSec == "4min"
|
||||
&& at "retry_in_job ${toString budget} grafana_listening" < at "no Grafana admin password at"
|
||||
&& at "retry_in_job ${toString budget} grafana_listening" < at "status=\"$(grafana \"$admin\" GET";
|
||||
}
|
||||
{
|
||||
# Same 403-not-a-miss reason as the matrix and queue arms below: the
|
||||
# reader's grant covers the `services` prefix, so a path outside it is
|
||||
|
|
|
|||
Loading…
Reference in a new issue