Skip to content

Add safer deployments and enhanced health checks#499

Merged
bokelley merged 2 commits into
mainfrom
bokelley/addie-dm-not-responding
Jan 3, 2026
Merged

Add safer deployments and enhanced health checks#499
bokelley merged 2 commits into
mainfrom
bokelley/addie-dm-not-responding

Conversation

@bokelley

@bokelley bokelley commented Jan 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Migrations now run via release_command instead of on every machine startup
  • If migrations fail, Fly automatically rolls back the deployment
  • Enhanced /health endpoint checks database and Addie status
  • Returns 503 when degraded, enabling external uptime monitors to alert

Why this matters

When migration 101 failed, both machines crashed and kept restarting in a loop. With release_command:

  1. Migrations run once before any machines are updated
  2. If they fail, deployment stops and old machines stay running
  3. No more infinite restart loops from bad migrations

Changes

fly.toml

  • Added [deploy] section with release_command = "node dist/db/migrate.js"
  • Set strategy = "rolling" for safer deployments
  • Disabled RUN_MIGRATIONS env var (no longer needed at startup)

/health endpoint

  • Checks database connectivity (runs SELECT 1)
  • Checks Addie readiness via isAddieBoltReady()
  • Returns 503 if any check fails
  • External uptime monitors (UptimeRobot, etc.) can trigger alerts on 503

For alerting

The enhanced health check makes it easy to set up external monitoring:

  1. Sign up for UptimeRobot (free tier)
  2. Add a monitor for https://agenticadvertising.org/health
  3. Get alerts via email/Slack/SMS when it returns 503

🤖 Generated with Claude Code

bokelley and others added 2 commits January 3, 2026 13:48
PostgreSQL requires partial index predicates to use IMMUTABLE functions,
but CURRENT_DATE is STABLE. The date filtering can happen at query time
instead.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1. Use release_command for migrations
   - Migrations now run ONCE before deployment, not on every machine
   - If migrations fail, deployment is automatically rolled back
   - Prevents both machines from crashing on bad migrations

2. Enhanced /health endpoint
   - Checks database connectivity
   - Checks Addie readiness
   - Returns 503 if any check fails (triggers Fly health alerts)
   - External uptime monitors can use this for alerting

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit 8ae4ee7 into main Jan 3, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant