wip: headscale script to wait until authentik is alive
This commit is contained in:
parent
3e26629de7
commit
fc99b36839
@ -1,4 +1,4 @@
|
|||||||
{ headscale-list ? [] }: { config, lib, inputs, ... }:
|
{ headscale-list ? [] }: { config, lib, inputs, pkgs, ... }:
|
||||||
let
|
let
|
||||||
domain = "wg.ataraxiadev.com";
|
domain = "wg.ataraxiadev.com";
|
||||||
in {
|
in {
|
||||||
@ -42,6 +42,20 @@ in {
|
|||||||
};
|
};
|
||||||
systemd.services.headscale = {
|
systemd.services.headscale = {
|
||||||
serviceConfig.TimeoutStopSec = 10;
|
serviceConfig.TimeoutStopSec = 10;
|
||||||
|
serviceConfig.ExecStartPre = let
|
||||||
|
waitAuthnetikReady = pkgs.writeShellScript "waitAuthnetikReady" ''
|
||||||
|
# Check until authentik is alive
|
||||||
|
retries=0
|
||||||
|
until [[ curl -fsSL http://auth.ataraxiadev.com/-/health/ready/ ]]; do
|
||||||
|
# Wait for 10 minutes
|
||||||
|
[ $retries -ge 200 ] && echo "Could not connect to authentik" && exit 1
|
||||||
|
echo "Waiting for the authentik..."
|
||||||
|
sleep 3
|
||||||
|
((retries++))
|
||||||
|
done
|
||||||
|
echo "Authentik is alive."
|
||||||
|
'';
|
||||||
|
in waitAuthnetikReady;
|
||||||
# after = lib.mkIf config.services.authentik.enable [
|
# after = lib.mkIf config.services.authentik.enable [
|
||||||
# "authentik-server.service"
|
# "authentik-server.service"
|
||||||
# "authentik-worker.service"
|
# "authentik-worker.service"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user