This repository contains GitHub Actions workflows that keep Azure Container Apps warm and monitor their health.
- Scheduled Keep-Warm Pings: Prevents cold starts by pinging health endpoints every 10 minutes
- Health Monitoring: Tracks response codes and response times
- Email Alerts: Sends email notifications when health checks fail
- Status Tracking: Differentiates between healthy (200), warning (503/timeout), and unhealthy states
- GitHub Summaries: Creates detailed summaries for each workflow run
File: .github/workflows/keep-warm.yml
Schedule: Every 10 minutes (24/7)
Environments Monitored:
- PRODUCTION (
spartangym-api-prod) - TEST (
spartangym-api-test)
Set up the following variables in Settings ? Secrets and variables ? Actions ? Variables:
| Variable Name | Description | Example |
|---|---|---|
PROD_API_URL |
Production API base URL (without protocol) | spartangym-api-prod.nicegrass-12345678.canadacentral.azurecontainerapps.io |
TEST_API_URL |
Test API base URL (without protocol) | spartangym-api-test.nicegrass-12345678.canadacentral.azurecontainerapps.io |
Set up the following secrets in Settings ? Secrets and variables ? Actions ? Secrets:
| Secret Name | Description | How to Get |
|---|---|---|
BREVO_SMTP_USERNAME |
Brevo SMTP login (email or key) | From Brevo Dashboard ? SMTP & API ? SMTP settings |
BREVO_SMTP_PASSWORD |
Brevo SMTP password/key | From Brevo Dashboard ? SMTP & API ? SMTP settings |
ALERT_EMAIL |
Email address to receive alerts | Your admin email (e.g., bojan.ruzic@gmail.com) |
- Log in to Brevo
- Go to SMTP & API ? SMTP tab
- Note your SMTP credentials:
- Server:
smtp-relay.brevo.com - Port:
587 - Login: Your email or SMTP key
- Password: Your SMTP password or API key
- Server:
- Add these credentials as GitHub secrets (see above)
Important: The workflow uses bojan.ruzic@gmail.com as the sender email. This must be a verified sender in your Brevo account. To verify:
- Go to Brevo ? Senders & IP ? Senders
- Ensure
bojan.ruzic@gmail.comis listed and verified - If not, add and verify it before using email alerts
- Trigger: HTTP status code is NOT 200, 503, or timeout
- Subject:
?? SpartanGym PROD Health Check Failed - Priority: High
- Action: Immediate investigation required
- Trigger: HTTP status code is NOT 200, 503, or timeout
- Subject:
?? SpartanGym TEST Health Check Failed - Priority: Normal
- Action: Investigate during business hours
| Status | HTTP Code | Behavior | Alert? |
|---|---|---|---|
| ? Healthy | 200 | Normal operation | No |
| ?? Warning | 503, 000 | Cold start or temporary issue | No |
| ? Unhealthy | Other codes | Unexpected error | Yes |
Note: 503 (Service Unavailable) and 000 (timeout/connection error) are treated as warnings because they often occur during cold starts when the container is waking up. These are expected and do not trigger alerts.
Each workflow run creates a GitHub Summary showing:
- Health status for each environment
- Response codes and response times
- Timestamps
- Direct links to troubleshooting resources
Access: Go to Actions ? Select a workflow run ? View Summary tab
-
Verify Secrets:
# Check if secrets are configured (they should show as ****) Settings ? Secrets and variables ? Actions ? Secrets
-
Test Brevo SMTP:
- Log in to Brevo and check SMTP credentials
- Verify daily email limit (300/day on free tier)
- Check Brevo logs for failed sends
-
Check Workflow Logs:
- Go to Actions ? Select a failed run
- Expand "Send Email Alert" step
- Review error messages
-
Verify URLs:
- Check
PROD_API_URLandTEST_API_URLvariables - Ensure URLs do NOT include
https://prefix - Test manually:
curl https://<URL>/spartan/health
- Check
-
Check Azure Container Apps:
- Verify apps are running in Azure Portal
- Check if apps scaled to zero
- Review Application Insights for errors
-
Review Response Codes:
- 503: Container waking up (normal for cold starts)
- 000: Connection timeout or network issue
- 404: Health endpoint not found (check URL)
- 500: Server error (check logs)
GitHub disables scheduled workflows after 60 days of repository inactivity!
To prevent workflow disruption:
- Commit to this repository at least once every 50 days
- Set up a calendar reminder
- See Maintenance Strategy below
Option 1: Manual Commits (Recommended)
- Update README.md or documentation every 45-50 days
- Bump version numbers
- Add monitoring notes
Option 2: Automated Maintenance Commit Create a workflow that auto-commits every 50 days (coming soon)
Check last commit date:
git log -1 --format="%ai"If approaching 50 days, create a maintenance commit:
git commit --allow-empty -m "chore: maintenance commit to keep workflows active"
git push- GitHub Actions: FREE (workflows use ~5 minutes/day, well within 2,000 min/month free tier)
- Brevo Emails: FREE (alerts use ~1-5 emails/day, within 300/day limit)
- Azure Container Apps: Keeps apps warm, prevents cold start delays
- Estimated Savings: $5-10 CAD/month by avoiding frequent cold starts
- Azure Portal: Container Apps Dashboard
- Brevo Dashboard: Email Monitoring
- Application Insights: Check logs for detailed error traces
- Documentation: See
_DevNotes/Maintenance/Monitoring.mdin Spartan.Backend repo
- Set up keep-warm workflow
- Add health monitoring and alerting
- Configure Brevo SMTP secrets in GitHub
- Configure alert email address
- Test email alerts (trigger a manual failure)
- Set up calendar reminder for 50-day maintenance commits
- Monitor workflow execution logs weekly
Last Updated: February 2025
Maintained By: DevOps Team
Contact: Bojan Ruzic (bojan.ruzic@gmail.com)