fix(deploy): robust health check via node inside container
Some checks failed
CI / Deploy production (on server) (push) Successful in 1m55s
CI / Lint, Test & Build (push) Has been cancelled

This commit is contained in:
Antigravity
2026-05-21 19:39:17 +00:00
parent 2ae08538f0
commit a801d18b12

View File

@@ -75,16 +75,8 @@ fi
nginx -t 2>/dev/null && systemctl reload nginx 2>/dev/null || true
CONTAINER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' memento-web 2>/dev/null || true)
for i in $(seq 1 24); do
BODY=""
if [ -n "$CONTAINER_IP" ]; then
BODY=$(curl -sf --max-time 3 "http://${CONTAINER_IP}:3000/api/build-info" 2>/dev/null || true)
fi
if [ -z "$BODY" ]; then
BODY=$(curl -sf --max-time 3 http://127.0.0.1:3000/api/build-info 2>/dev/null || true)
fi
BODY=$(docker compose exec -T memento-note node -e "require('http').get('http://localhost:3000/api/build-info',r=>{let d='';r.on('data',c=>d+=c);r.on('end',()=>{console.log(d);process.exit(0)})}).on('error',()=>process.exit(1))" 2>/dev/null || true)
ACTUAL=$(echo "$BODY" | jq -r '.commit // empty' 2>/dev/null || true)
if [ "$ACTUAL" = "$GIT_COMMIT" ]; then
echo "OK build-info commit=$ACTUAL"