Files
timmy-tower/vps/health-check.sh
Replit Agent bb3b14029e fix: webhook fail-closed, /api/healthz endpoint, queued deploy
- webhook.js: fail-closed on missing WEBHOOK_SECRET (exits at startup,
  never accepts unsigned requests)
- webhook.js: single-slot queue — push during deploy is held and runs
  after current deploy completes (not silently dropped)
- deploy.sh + health-check.sh: URL corrected to /api/healthz
2026-03-20 21:07:32 +00:00

25 lines
817 B
Bash

#!/usr/bin/env bash
# =============================================================================
# /opt/timmy-tower/health-check.sh
# Run by systemd timer every 5 minutes.
# Restarts timmy-tower if /api/healthz returns non-200.
# =============================================================================
HEALTH_URL="http://localhost:8088/api/healthz"
LOG="/opt/timmy-tower/health.log"
log() { echo "[$(date -u +%FT%TZ)] [health] $*" | tee -a "$LOG"; }
if curl -sf --max-time 10 "$HEALTH_URL" > /dev/null; then
exit 0
fi
log "Health check FAILED — restarting timmy-tower"
systemctl restart timmy-tower
sleep 5
if curl -sf --max-time 10 "$HEALTH_URL" > /dev/null; then
log "Service recovered after restart"
else
log "CRITICAL: service did not recover after restart — manual intervention needed"
fi