From 32bced29272aed6c1a215927da020abd4fb3e19a Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 29 Nov 2025 13:52:19 -0500 Subject: [PATCH] Enable blue-green deployment strategy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: - Added [deploy] strategy = "bluegreen" to fly.toml - Increased min_machines_running from 1 to 2 - Disabled auto_stop_machines to keep both environments ready - Updated GitHub Actions workflow with --strategy bluegreen flag How Blue-Green Works: 1. Deploy creates new "green" environment alongside current "blue" 2. Health checks verify green environment is healthy 3. Traffic switches instantly from blue to green 4. Old blue environment kept briefly for instant rollback 5. Zero downtime during deployments Cost Impact: - Runs minimum 2 machines instead of 1 - Ensures true zero-downtime deployments - Instant rollback capability 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/fly-deploy.yml | 2 +- fly.toml | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/fly-deploy.yml b/.github/workflows/fly-deploy.yml index 5949bf9..56d9200 100644 --- a/.github/workflows/fly-deploy.yml +++ b/.github/workflows/fly-deploy.yml @@ -26,6 +26,6 @@ jobs: steps: - uses: actions/checkout@v4 - uses: superfly/flyctl-actions/setup-flyctl@master - - run: flyctl deploy --remote-only + - run: flyctl deploy --remote-only --strategy bluegreen env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} diff --git a/fly.toml b/fly.toml index fc1a455..e4869b8 100644 --- a/fly.toml +++ b/fly.toml @@ -6,14 +6,17 @@ app = 'kjvstudy' primary_region = 'iad' +[deploy] +strategy = "bluegreen" + [build] [http_service] internal_port = 8000 force_https = true -auto_stop_machines = 'suspend' +auto_stop_machines = 'off' auto_start_machines = true -min_machines_running = 1 +min_machines_running = 2 processes = ['app'] [http_service.concurrency]