fix: require postgresql for forgejo and vaultwarden

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 <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-11-27 17:57:35 +01:00
parent da56e3acd6
commit 737acfde87
Signed by: mfocko
SSH key fingerprint: SHA256:icm0fIOSJUpy5+1x23sfr+hLtF9UhY8VpMC7H4WFJP8
2 changed files with 4 additions and 0 deletions

View file

@ -2,6 +2,8 @@
[Unit] [Unit]
Description=Forgejo Description=Forgejo
After=postgresql.service
Requires=postgresql.service
[Container] [Container]
ContainerName=forgejo ContainerName=forgejo

View file

@ -2,6 +2,8 @@
[Unit] [Unit]
Description=Vaultwarden Description=Vaultwarden
After=postgresql.service
Requires=postgresql.service
[Container] [Container]
ContainerName=vaultwarden ContainerName=vaultwarden