From 737acfde87220a9a64a1ec7a19b34905f4ef1e01 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Wed, 27 Nov 2024 17:57:35 +0100 Subject: [PATCH] fix: require postgresql for forgejo and vaultwarden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Storing data for Forgejo and Vaultwarden in the postgres database results in a rather wonky behavior during restarts of the VPS and potential restarts of the postgres itself. Based on some observations Forgejo is capable of recovering from such issues, but Vaultwarden falls into a retry loop trying to reconnect to the database while failing on resolving the hostname / connecting, e.g., [2024-11-27 16:52:43.646][r2d2][ERROR] connection to server at "host.containers.internal" (XXX.XXX.XXX.XXX), port 5432 failed: Connection refused Therefore adjust the quadlet definitions to require and boot containers »after« the postgres is running to minimalize the possible issues. Signed-off-by: Matej Focko --- roles/forgejo/templates/forgejo.container | 2 ++ roles/vaultwarden/templates/vaultwarden.container | 2 ++ 2 files changed, 4 insertions(+) diff --git a/roles/forgejo/templates/forgejo.container b/roles/forgejo/templates/forgejo.container index 59b7b65..08a08e8 100644 --- a/roles/forgejo/templates/forgejo.container +++ b/roles/forgejo/templates/forgejo.container @@ -2,6 +2,8 @@ [Unit] Description=Forgejo +After=postgresql.service +Requires=postgresql.service [Container] ContainerName=forgejo diff --git a/roles/vaultwarden/templates/vaultwarden.container b/roles/vaultwarden/templates/vaultwarden.container index 47ef09e..0b7bd17 100644 --- a/roles/vaultwarden/templates/vaultwarden.container +++ b/roles/vaultwarden/templates/vaultwarden.container @@ -2,6 +2,8 @@ [Unit] Description=Vaultwarden +After=postgresql.service +Requires=postgresql.service [Container] ContainerName=vaultwarden