summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-01-21 08:53:39 +0100
committerRory& <root@rory.gay>2026-01-21 08:53:39 +0100
commit6732690b119dc71d728fcc9c23dc248c5c2ff913 (patch)
treee0bd34eda0fb50243fcaf8ca657a84039c2239b6
parentFix shellcheck complaint (diff)
downloadRory-Open-Architecture-6732690b119dc71d728fcc9c23dc248c5c2ff913.tar.xz
Attempt to wait for network via netcat
-rw-r--r--host/Rory-ovh/services/containers/spacebar/root.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/host/Rory-ovh/services/containers/spacebar/root.nix b/host/Rory-ovh/services/containers/spacebar/root.nix

index e790b4b..75825d6 100644 --- a/host/Rory-ovh/services/containers/spacebar/root.nix +++ b/host/Rory-ovh/services/containers/spacebar/root.nix
@@ -1,4 +1,4 @@ -{ ... }: +{ pkgs, ... }: { networking.useHostResolvConf = true; @@ -18,4 +18,15 @@ 3003 ]; }; + + # check that we can reach the database server before starting the service + systemd.services."spacebar-apply-migrations" = + let + address = "192.168.100.1"; + in + { + serviceConfig = { + ExecStartPre = "${pkgs.coreutils}/bin/sh -c 'until ${pkgs.netcat}/bin/nc -z ${address} 5432; do echo \"Waiting for database server...\"; sleep 0.2; done'"; + }; + }; }