From 40c22e8d477886d821d726dc16b628f18a257d96 Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Thu, 19 Mar 2026 21:27:41 +0000 Subject: [PATCH] Fix: add retry loop for API health check (same as frontend) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit API takes time to initialize — immediate curl always fails. Co-Authored-By: Claude Sonnet 4.6 --- deploy.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 7f2b117..01aa465 100755 --- a/deploy.sh +++ b/deploy.sh @@ -300,7 +300,15 @@ info "Step 12: Verifying deployment..." FAIL=0 -if curl -sf "http://127.0.0.1:${API_PORT}/docs" > /dev/null; then +info " Waiting for API to be ready..." +API_OK=0 +for i in $(seq 1 24); do + if curl -sf "http://127.0.0.1:${API_PORT}/docs" > /dev/null 2>&1; then + API_OK=1; break + fi + sleep 5 +done +if [ "$API_OK" -eq 1 ]; then info " API (port ${API_PORT}): OK" else warn " API (port ${API_PORT}): not responding — check 'docker compose logs api'"