nitrokite/deployment/scripts/health-check.sh
Farid Siddiqi 47be003f6d
Some checks failed
Build and Deploy API Server / deploy (push) Has been cancelled
Build and Deploy API Server / build (push) Has been cancelled
Simplify deployment structure and consolidate documentation
- Remove redundant manual setup (setup-vps.sh) - Ansible handles all VPS setup
- Remove config templates directory - Ansible creates .env.production
- Delete verbose DEPLOYMENT_SETUP.md - info consolidated into deployment/README.md
- Rewrite deployment/README.md with clear 3-step workflow
- Simplify deployment/ansible/README.md to quick reference
- Reduce total documentation from 1159 lines to 225 lines

The deployment process is now easier to understand:
1. Run Ansible playbook (one-time setup)
2. Push code to Gitea (auto-builds)
3. SSH and promote to production

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 17:47:50 -08:00

36 lines
831 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
HEALTH_ENDPOINT="${HEALTH_ENDPOINT:-http://localhost:8080/hello}"
MAX_RETRIES="${MAX_RETRIES:-10}"
RETRY_DELAY="${RETRY_DELAY:-3}"
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
if ! systemctl is-active --quiet api-server.service; then
log_error "Service is not running"
exit 1
fi
for i in $(seq 1 $MAX_RETRIES); do
log_info "Health check attempt $i/$MAX_RETRIES..."
if response=$(curl -sf -m 5 "$HEALTH_ENDPOINT" 2>/dev/null); then
log_info "Health check passed!"
echo "$response" | head -c 200
exit 0
fi
if [ $i -lt $MAX_RETRIES ]; then
sleep $RETRY_DELAY
fi
done
log_error "Health check failed after $MAX_RETRIES attempts"
exit 1