[object Object]

← back to Rentv

deploy.sh: reload procs separately + retrying health check (auto-deploy hook)

3cc7888674dbf883596a8a1d0a8c3c9cae9a6a2f · 2026-08-06 11:53:15 -0700 · Steve Abrams

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 3cc7888674dbf883596a8a1d0a8c3c9cae9a6a2f
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Aug 6 11:53:15 2026 -0700

    deploy.sh: reload procs separately + retrying health check (auto-deploy hook)
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 deploy.sh | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/deploy.sh b/deploy.sh
index 30c21ccf..ccf3d200 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -70,14 +70,22 @@ REMOTE
 fi
 
 # ── 3. pm2 reload ────────────────────────────────────────────────────────────
+# Reload each proc SEPARATELY — a combined `pm2 reload a b` was observed to skip
+# the second app. rentv is fork-mode, so reload = a brief restart (handled by the
+# retrying health check below).
 if [ "$DO_RELOAD" = 1 ]; then
-  ssh "${SSHOPTS[@]}" "$HOST" 'pm2 reload rentv rentv-pr-worker --update-env >/dev/null 2>&1 && echo reloaded' >> "$LOG" 2>&1
+  ssh "${SSHOPTS[@]}" "$HOST" 'pm2 reload rentv --update-env >/dev/null 2>&1; pm2 reload rentv-pr-worker --update-env >/dev/null 2>&1; echo reloaded' >> "$LOG" 2>&1
   say "  ✓ pm2 reloaded (rentv + rentv-pr-worker)"
 fi
 
-# ── 4. Health check ──────────────────────────────────────────────────────────
+# ── 4. Health check (retry through the fork-mode reload window) ──────────────
 # Anon hit is expected to 401 (the auth gate) — that means the app is up + gated.
-CODE=$(ssh "${SSHOPTS[@]}" "$HOST" "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:$PORT/api/pr/health" 2>/dev/null || echo 000)
+CODE=000
+for i in 1 2 3 4 5 6; do
+  sleep 2
+  CODE=$(ssh "${SSHOPTS[@]}" "$HOST" "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:$PORT/api/pr/health" 2>/dev/null || echo 000)
+  { [ "$CODE" = 401 ] || [ "$CODE" = 200 ]; } && break
+done
 if [ "$CODE" = 401 ] || [ "$CODE" = 200 ]; then
   say "DEPLOY ok — app healthy (health=$CODE)"
 else

← 1f840675 fix(sitemap): xmlEsc the <loc> (sibling-drift — feed.xml/dea  ·  back to Rentv  ·  consulting: skip daynight injection on /consulting (DTD verd 9cf5e94e →