From 244eeee1428783ae93f565f879707396646b362b Mon Sep 17 00:00:00 2001 From: elpatron Date: Sun, 5 Oct 2025 20:21:31 +0200 Subject: [PATCH] Prod: rebuild script Healthcheck ohne jq (docker inspect fallback) --- scripts/rebuild-prod.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/scripts/rebuild-prod.sh b/scripts/rebuild-prod.sh index 20fa4ee..06c2431 100644 --- a/scripts/rebuild-prod.sh +++ b/scripts/rebuild-prod.sh @@ -26,17 +26,22 @@ echo "[5/7] Start services in background" sudo docker compose -f "$COMPOSE_FILE" up -d echo "[6/7] Wait for app healthcheck to pass" -# Wait up to ~90s for healthy status +# Wait up to ~90s for healthy status using docker inspect (no jq dependency) for i in {1..18}; do - STATUS=$(sudo docker compose -f "$COMPOSE_FILE" ps --format json | jq -r '.[] | select(.Name=="stargirlnails-app" or .Service=="stargirlnails") | .State') || true - if echo "$STATUS" | grep -qi "running"; then - # Optional: also check the container health if reported - HEALTH=$(sudo docker compose -f "$COMPOSE_FILE" ps --format json | jq -r '.[] | select(.Name=="stargirlnails-app" or .Service=="stargirlnails") | .Health') || true - if [ -z "$HEALTH" ] || echo "$HEALTH" | grep -qi "healthy"; then - echo "Service is running${HEALTH:+ and healthy}." - break - fi + # Check health status if available + HEALTH=$(sudo docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{end}}' stargirlnails-app 2>/dev/null || true) + if [ "$HEALTH" = "healthy" ]; then + echo "Service is healthy." + break fi + + # Fallback: ensure container is running + STATE=$(sudo docker inspect -f '{{.State.Status}}' stargirlnails-app 2>/dev/null || true) + if [ "$STATE" = "running" ] && [ -z "$HEALTH" ]; then + echo "Service is running (no healthcheck reported)." + break + fi + sleep 5 done