From 78805a86801ea074170fd5b4dd3bd5d5a6eb75d6 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Mon, 21 Oct 2024 06:12:15 +0200 Subject: [PATCH] Properly track readiness of authentik for gts --- modules/cloud/authentik/default.nix | 9 ++++++++- modules/cloud/gotosocial/default.nix | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/cloud/authentik/default.nix b/modules/cloud/authentik/default.nix index a5a8851..e0d6459 100644 --- a/modules/cloud/authentik/default.nix +++ b/modules/cloud/authentik/default.nix @@ -48,7 +48,14 @@ in }; config = mkIf cfg.enable { - systemd.services.arion-authentik.serviceConfig.EnvironmentFile = cfg.envFile; + systemd.services.arion-authentik = { + serviceConfig.EnvironmentFile = cfg.envFile; + serviceConfig.Type = "notify"; + serviceConfig.NotifyAccess = "all"; + script = lib.mkBefore '' + ${lib.getExe pkgs.wait4x} http http://127.0.0.1:${toString cfg.port} --expect-status-code 200 -t 0 -q -- systemd-notify --ready & + ''; + }; virtualisation.arion.projects.authentik.settings = { services.postgresql.service = { image = images.postgresql; diff --git a/modules/cloud/gotosocial/default.nix b/modules/cloud/gotosocial/default.nix index 8b3e2b6..17c304c 100644 --- a/modules/cloud/gotosocial/default.nix +++ b/modules/cloud/gotosocial/default.nix @@ -85,7 +85,7 @@ in # instance-inject-mastodon-version = true; }; }; - systemd.services.gotosocial.requires = mkAfter [ "postgresql.service" ]; - systemd.services.gotosocial.after = mkAfter [ "postgresql.service" ]; + systemd.services.gotosocial.requires = mkAfter [ "postgresql.service" "arion-authentik.service" ]; + systemd.services.gotosocial.after = mkAfter [ "postgresql.service" "arion-authentik.service" ]; }; }