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
|
|
@ -427,6 +427,12 @@ let
|
|||
privateNetwork = true;
|
||||
storeRetry = import ./lib/store-retry.nix { };
|
||||
storeRefreshTimer = import ./lib/store-refresh-timer.nix { };
|
||||
retryInJob = import ./lib/retry-in-job.nix { };
|
||||
|
||||
# How long the controller-token unit waits for Grafana's socket before it
|
||||
# fails into `storeRetry`'s restart. `container@` is ready when the guest's
|
||||
# boot finishes, which can be before Grafana listens.
|
||||
socketWaitSec = 60;
|
||||
in
|
||||
{
|
||||
# What the service IS to every hive is `swarm.grafana` in
|
||||
|
|
@ -1127,9 +1133,9 @@ in
|
|||
SyslogIdentifier = "swarm-bao-grafana-controller-token";
|
||||
# Grafana's answers, the new token among them, pass through a temp file.
|
||||
PrivateTmp = true;
|
||||
# Each call below is bounded by curl's own timeouts; a run makes up to
|
||||
# about ten of them.
|
||||
TimeoutStartSec = "3min";
|
||||
# The socket wait (`socketWaitSec`) plus the calls below, each bounded
|
||||
# by curl's own timeouts; a run makes up to about ten of them.
|
||||
TimeoutStartSec = "4min";
|
||||
};
|
||||
environment = {
|
||||
BAO_ADDR = "https://${baoCfg.domain}:${toString baoCfg.port}";
|
||||
|
|
@ -1173,6 +1179,18 @@ in
|
|||
exit 1
|
||||
}
|
||||
|
||||
${retryInJob}
|
||||
|
||||
# Any HTTP answer counts; a refused connection is curl's exit status 7.
|
||||
grafana_listening() {
|
||||
curl --silent --output /dev/null --connect-timeout 5 --max-time 15 \
|
||||
--unix-socket ${lib.escapeShellArg socketPath} http://localhost/api/health
|
||||
}
|
||||
if ! retry_in_job ${toString socketWaitSec} grafana_listening; then
|
||||
echo "Grafana's socket ${socketPath} did not answer within ${toString socketWaitSec} seconds." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -s ${lib.escapeShellArg adminPasswordPath} ]; then
|
||||
echo "no Grafana admin password at ${adminPasswordPath} yet; swarm-bao-grafana-admin writes it." >&2
|
||||
exit 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue