From d9d58b7055bbb26c53022479fec78dc4357a727a Mon Sep 17 00:00:00 2001 From: Tobias Pflug Date: Thu, 14 May 2020 15:15:38 +0200 Subject: [PATCH] Use pg_ctl for readiness check Using `pg_ctl status` is more reliable than relying checking an open port via netcat. --- flake.nix | 2 +- run-hydra.nix | 4 ++-- scripts/start-hydra.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index df8708ba..87e402dd 100644 --- a/flake.nix +++ b/flake.nix @@ -295,7 +295,7 @@ runHydra = pkgs.callPackage ./run-hydra.nix {}; devShell = pkgs.hydra.overrideAttrs (old: { - buildInputs = old.buildInputs ++ [ pkgs.foreman pkgs.netcat ]; + buildInputs = old.buildInputs ++ [ pkgs.foreman ]; shellHook = old.shellHook + '' export HYDRA_HOME="src/" mkdir -p .hydra-data diff --git a/run-hydra.nix b/run-hydra.nix index fc410f43..59eb2740 100644 --- a/run-hydra.nix +++ b/run-hydra.nix @@ -1,8 +1,8 @@ -{ foreman, mkShell, hydra, netcat, postgresql95 }: +{ foreman, mkShell, hydra, postgresql95 }: { doCheck ? true }: mkShell { buildInputs = [ - foreman (hydra.overrideAttrs (_: { inherit doCheck; })) netcat postgresql95 + foreman (hydra.overrideAttrs (_: { inherit doCheck; })) postgresql95 ]; shellHook = '' diff --git a/scripts/start-hydra.sh b/scripts/start-hydra.sh index 815ee500..4898a1f3 100755 --- a/scripts/start-hydra.sh +++ b/scripts/start-hydra.sh @@ -1,7 +1,7 @@ #!/bin/sh -# wait for postgresql to listen -while ! nc -z localhost 64444; do sleep 1; done +# wait for postgresql to be up +while ! pg_ctl -D $(pwd)/.hydra-data/postgres status; do sleep 1; done createdb -h $(pwd)/.hydra-data/postgres -p 64444 hydra