diff --git a/root/etc/cont-init.d/98-wait-for-db b/root/etc/cont-init.d/98-wait-for-db index 3e4160d..eff8288 100644 --- a/root/etc/cont-init.d/98-wait-for-db +++ b/root/etc/cont-init.d/98-wait-for-db @@ -18,6 +18,12 @@ else fi ############# -# Run wait-for-it.sh to confirm DB comes up before we proceed -echo "Waiting up to 60s for $dbhost:$eport..." -/srv/wait-for $dbhost:$eport --timeout=60 -- echo "Done" +# Run wait-for to confirm DB comes up before we proceed +# Reduce default timeout to 1s because if the DB is not instantly available, +# Then it's even if it _happens_ to become available while we're testing, +# it won't be ready for us yet. Better to exit and restart the container altogether, +# So set "S6_BEHAVIOUR_IF_STAGE2_FAILS=2" below + +S6_BEHAVIOUR_IF_STAGE2_FAILS=2 +echo "Checking database responds within 1s on $dbhost:$eport..." +/srv/wait-for $dbhost:$eport --timeout=1