Files
Mimante/Mimante/.gitea/workflows/health-check.yml
Alberto Balbo 61f0945db2 Supporto PostgreSQL, statistiche avanzate e nuova UI
Aggiornamento massivo: aggiunto backend PostgreSQL per statistiche aste con fallback SQLite, nuovi modelli e servizi, UI moderna con grafici interattivi, refactoring stato applicazione (ApplicationStateService), documentazione completa per deploy Docker/Unraid/Gitea, nuovi CSS e script JS per UX avanzata, template Unraid, test database, e workflow CI/CD estesi. Pronto per produzione e analisi avanzate.
2026-01-18 17:52:05 +01:00

71 lines
2.1 KiB
YAML

name: Health Check Monitor
on:
schedule:
# Verifica ogni ora
- cron: '0 * * * *'
workflow_dispatch: # Permette trigger manuale
jobs:
health-check:
runs-on: ubuntu-latest
steps:
- name: Check application health
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
script: |
echo "?? Health Check Starting..."
# Verifica container running
if ! docker ps | grep -q "autobidder"; then
echo "? Container NOT running!"
exit 1
fi
# Verifica Docker healthcheck
HEALTH_STATUS=$(docker inspect --format='{{.State.Health.Status}}' autobidder 2>/dev/null || echo "unknown")
echo "Docker Health: $HEALTH_STATUS"
if [ "$HEALTH_STATUS" != "healthy" ]; then
echo "?? Container not healthy!"
echo "Recent logs:"
docker logs autobidder --tail=50
exit 1
fi
# Test HTTP endpoint
if curl -f -s http://localhost:5000/health > /dev/null; then
echo "? HTTP endpoint: OK"
else
echo "? HTTP endpoint: FAILED"
exit 1
fi
# Verifica database
cd /opt/autobidder
if [ -f ./data/autobidder.db ]; then
DB_SIZE=$(du -h ./data/autobidder.db | cut -f1)
echo "?? Database size: $DB_SIZE"
else
echo "?? Database file not found!"
fi
# Verifica risorse container
echo "?? Container resources:"
docker stats autobidder --no-stream --format " CPU: {{.CPUPerc}}\n Memory: {{.MemUsage}}"
echo "? All health checks passed!"
- name: Health check summary
if: always()
run: |
if [ "${{ job.status }}" == "success" ]; then
echo "? Health check PASSED"
else
echo "? Health check FAILED - Check server status!"
fi