feat(staging): add orchestrator deploy hook with health-check and auto-rollback (ORCH-34) #30

Merged
admin merged 1 commits from feature/ORCH-34-deploy-hook into main 2026-06-05 09:46:18 +03:00
Owner

ORCH-34: Deploy hook with health-check and auto-rollback

Summary

Adds scripts/orchestrator-deploy-hook.sh — bash deploy hook for orchestrator with:

  • PREV_IMG capture before restart
  • git pull + docker compose up
  • Health-check loop: 10 attempts × 6s = up to 60s (HTTP 200 + "status":"ok")
  • Auto-rollback if health fails: restore PREV_IMG + restart + 5×3s post-rollback health
  • Parametrised via env vars, default = staging (safe)
  • Separate PREV_IMAGE_FILE for staging vs prod

New files

  • scripts/orchestrator-deploy-hook.sh (176 lines)
  • docs/DEPLOY_HOOK.md

Tests (all on staging, port 8501)

  • Happy-path: deploy → health OK at attempt 1 → exit 0
  • Auto-rollback: broken image → 10 health failures → auto-rollback → staging healthy → exit 1
  • Prod untouched: StartedAt unchanged (2026-06-04T13:08:13Z), health ok

Stage

Etap 4/5 — staging only. DEPLOY_HOOK_SCRIPT prod change is Etap 5.

## ORCH-34: Deploy hook with health-check and auto-rollback ### Summary Adds `scripts/orchestrator-deploy-hook.sh` — bash deploy hook for orchestrator with: - PREV_IMG capture before restart - git pull + docker compose up - **Health-check loop**: 10 attempts × 6s = up to 60s (HTTP 200 + `"status":"ok"`) - **Auto-rollback** if health fails: restore PREV_IMG + restart + 5×3s post-rollback health - Parametrised via env vars, **default = staging** (safe) - Separate `PREV_IMAGE_FILE` for staging vs prod ### New files - `scripts/orchestrator-deploy-hook.sh` (176 lines) - `docs/DEPLOY_HOOK.md` ### Tests (all on staging, port 8501) - ✅ Happy-path: deploy → health OK at attempt 1 → exit 0 - ✅ Auto-rollback: broken image → 10 health failures → auto-rollback → staging healthy → exit 1 - ✅ Prod untouched: StartedAt unchanged (2026-06-04T13:08:13Z), health ok ### Stage Etap 4/5 — staging only. DEPLOY_HOOK_SCRIPT prod change is Etap 5.
admin added 1 commit 2026-06-05 09:26:27 +03:00
feat(staging): add orchestrator deploy hook with health-check and auto-rollback (ORCH-34)
All checks were successful
CI / test (push) Successful in 13s
CI / test (pull_request) Successful in 9s
a6cbacb62c
admin merged commit e405a55f9d into main 2026-06-05 09:46:18 +03:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/orchestrator#30