From 03995ca9220140ca0e56592bdefeeb6fa00c7010 Mon Sep 17 00:00:00 2001 From: Nicolas Jeannerod Date: Tue, 10 Sep 2024 12:41:53 +0000 Subject: [PATCH] Wait until Garage is up by polling port 3900 --- garage.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/garage.nix b/garage.nix index bd2c38e..b58738d 100644 --- a/garage.nix +++ b/garage.nix @@ -172,8 +172,10 @@ in { path = [ cfg.package pkgs.perl pkgs.awscli ]; script = '' set -xeuo pipefail - # give garage time to start up - sleep 10 + + # Give garage time to start up by waiting until somethings speaks HTTP + # behind localhost:3900. + until curl -sio /dev/null http://localhost:3900/; do sleep 1; done # XXX: this is very sensitive to being a single instance # (doing the bare minimum to get garage up and running)