mirror of
https://github.com/lordmathis/dev-cluster.git
synced 2025-12-22 16:44:24 +00:00
59 lines
1.6 KiB
YAML
59 lines
1.6 KiB
YAML
name: Cluster Health Monitor
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 * * * *'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
health-check:
|
|
name: Monitor Cluster Endpoints
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check endpoints
|
|
run: |
|
|
# Simple and clean endpoint checker
|
|
ENDPOINTS="${{ secrets.CLUSTER_ENDPOINTS }}"
|
|
|
|
# Validate input
|
|
if [[ -z "$ENDPOINTS" ]]; then
|
|
echo "❌ No endpoints found in CLUSTER_ENDPOINTS secret"
|
|
exit 1
|
|
fi
|
|
|
|
# Initialize counters
|
|
total=0
|
|
failed=0
|
|
|
|
# Process each endpoint
|
|
while IFS= read -r url; do
|
|
# Skip empty lines and comments
|
|
[[ -z "$url" || "$url" =~ ^[[:space:]]*# ]] && continue
|
|
url=$(echo "$url" | xargs)
|
|
[[ -z "$url" ]] && continue
|
|
|
|
total=$((total + 1))
|
|
echo "Testing: $url"
|
|
|
|
# Simple curl check - fail if HTTP code >= 400 or connection fails
|
|
if curl -sfLI --max-time 10 "$url" >/dev/null 2>&1; then
|
|
echo "✅ OK"
|
|
else
|
|
echo "❌ FAILED"
|
|
failed=$((failed + 1))
|
|
fi
|
|
echo ""
|
|
|
|
done <<< "$ENDPOINTS"
|
|
|
|
# Summary
|
|
echo "📊 Summary: $((total - failed))/$total endpoints OK"
|
|
|
|
# Exit with error if any failed
|
|
if [[ $failed -gt 0 ]]; then
|
|
echo "💥 $failed endpoint(s) failed!"
|
|
exit 1
|
|
else
|
|
echo "🎉 All endpoints healthy!"
|
|
fi
|