Add dependencies and health check

This commit is contained in:
niten 2023-10-12 14:45:43 -07:00
parent cd23ae3bc9
commit 8ebaa4cae4
1 changed files with 9 additions and 1 deletions

View File

@ -28,6 +28,7 @@ let
user = "${toString teslaMateUid}:${toString teslaMateUid}"; user = "${toString teslaMateUid}:${toString teslaMateUid}";
env_file = [ teslaMateEnvFile ]; env_file = [ teslaMateEnvFile ];
capabilities.ALL = false; capabilities.ALL = false;
depends_on = { postgres.condition = "service_healthy"; };
}; };
}; };
postgres = { postgres = {
@ -37,6 +38,13 @@ let
volumes = [ "${stateDirectory}/postgres:/var/lib/postgresql/data" ]; volumes = [ "${stateDirectory}/postgres:/var/lib/postgresql/data" ];
env_file = [ postgresEnvFile ]; env_file = [ postgresEnvFile ];
user = "${toString postgresUid}:${toString postgresUid}"; user = "${toString postgresUid}:${toString postgresUid}";
healthcheck = {
test = [ "CMD" "pg_isready" "-U" "lemmy" "-d" "lemmy" ];
start_period = "20s";
interval = "30s";
retries = 5;
timeout = "3s";
};
}; };
}; };
grafana = { grafana = {
@ -47,6 +55,7 @@ let
env_file = [ grafanaEnvFile ]; env_file = [ grafanaEnvFile ];
user = "${toString grafanaUid}:${toString grafanaUid}"; user = "${toString grafanaUid}:${toString grafanaUid}";
ports = [ "${toString grafanaPort}:3000" ]; ports = [ "${toString grafanaPort}:3000" ];
depends_on = [ "teslamate" ];
}; };
}; };
}; };
@ -189,7 +198,6 @@ in {
[ "fudo-secrets.target" "network-online.target" "podman.service" ]; [ "fudo-secrets.target" "network-online.target" "podman.service" ];
requires = [ "network-online.target" "podman.service" ]; requires = [ "network-online.target" "podman.service" ];
}; };
}; };
virtualisation.arion.projects.teslamate.settings = let virtualisation.arion.projects.teslamate.settings = let