Add safer deployments and enhanced health checks#499
Merged
Conversation
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>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
release_commandinstead of on every machine startup/healthendpoint checks database and Addie statusWhy this matters
When migration 101 failed, both machines crashed and kept restarting in a loop. With
release_command:Changes
fly.toml
[deploy]section withrelease_command = "node dist/db/migrate.js"strategy = "rolling"for safer deploymentsRUN_MIGRATIONSenv var (no longer needed at startup)/health endpoint
SELECT 1)isAddieBoltReady()For alerting
The enhanced health check makes it easy to set up external monitoring:
https://agenticadvertising.org/health🤖 Generated with Claude Code