Health Monitor - Railway Production #2008
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Health Monitor - Railway Production | |
| # Pings the Railway production app every 14 minutes as a health monitor. | |
| # Railway Hobby plan keeps the container always-on (no spin-down), | |
| # but this workflow serves as an external health check and uptime monitor. | |
| on: | |
| schedule: | |
| - cron: '*/14 * * * *' | |
| workflow_dispatch: | |
| jobs: | |
| ping: | |
| name: Ping AskRuvNet | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 2 | |
| env: | |
| APP_URL: https://ask-ruvnet-production.up.railway.app | |
| steps: | |
| - name: Ping health endpoint | |
| run: | | |
| echo "Pinging $APP_URL/health at $(date -u)" | |
| STATUS=$(curl --silent --max-time 30 --write-out "%{http_code}" --output /dev/null "$APP_URL/health") | |
| echo "Health status: $STATUS" | |
| if [ "$STATUS" -ge 200 ] && [ "$STATUS" -lt 400 ]; then | |
| echo "App is healthy and responding" | |
| else | |
| echo "Warning: status $STATUS - app may be unhealthy" | |
| fi | |
| - name: Check KB connection | |
| run: | | |
| RESPONSE=$(curl --silent --max-time 30 "$APP_URL/api/kb-stats") | |
| echo "KB stats: $RESPONSE" | |
| CONNECTED=$(echo "$RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin).get('connected', False))" 2>/dev/null || echo "unknown") | |
| echo "KB connected: $CONNECTED" |