SUSTAINABILITY

CI/CD Pipeline with Auto-Migrate

Automated deployment pipeline with secret sync, deterministic startup, post-deploy health checks, and zero manual steps.

3 months3 engineers6 min read

Key Results

Deploy Method1-Click
MigrationsAuto
Health Check40s
Manual StepsZero

Client

Enterprise SaaS Client

Industry

Sustainability & ESG

Location

Europe

Overview

Reliable deployments require more than pushing code—migrations must run before traffic hits new code, secrets must be in sync, and broken deploys need immediate visibility. Manual deployments were error-prone and inconsistent.

We built a CI/CD pipeline that syncs secrets to Key Vault, sets a deterministic startup command, deploys via zip, and validates the site is up—all in one automated flow. Production and staging share the same workflow with environment-specific variables.

Architecture Overview

CI/CD Pipeline with Auto-Migrate architecture

The Challenge

Migration Timing

New code might reference database columns that don’t exist yet. Migrations had to run before the app served any traffic.

Secret Synchronization

App Settings and Key Vault could drift—a secret updated in one place but not the other caused runtime failures.

Silent Failures

A broken deploy might not be noticed until users reported errors. The pipeline needed to fail visibly if the site wasn’t healthy.

Our Solution

Architecture Overview

Secret Sync

App Settings → Key Vault before deploy

Zip Deploy

Direct zip upload to App Service

Health Check

Post-deploy site validation

1

Secret Sync Before Deploy

A script reads current App Settings and writes each mapped value to Key Vault. When the new app starts, it loads fresh secrets—guaranteed in sync with what CI knows about.

Key VaultAzure CLISync
2

Deterministic Startup

The pipeline sets a startup command that runs migrate, collectstatic, then starts Gunicorn. Every deploy and every restart behaves identically—no manual steps, no forgotten migrations.

Gunicornmigratecollectstatic
3

Zip Deploy

No Docker build in the main path—the repo is zipped and deployed directly, keeping the pipeline fast and simple. Branch mapping ensures master deploys to production and staging branch deploys to staging.

Zip DeployAzureBranch Mapping
4

Post-Deploy Health Check

After deployment, the pipeline waits for the app to restart, then hits the site URL. If the response isn’t healthy, the workflow fails—broken deploys are visible in CI, not discovered by users.

Health CheckCIMonitoring
CI/CD Pipeline with Auto-Migrate illustration 1
CI/CD Pipeline with Auto-Migrate illustration 2

Performance Metrics

Transaction Throughput

Response Time Distribution

1-Click

Deployments

Auto

Migrations

40s

Health Check

Zero

Manual Steps

Technology Stack

CI/CD

  • GitHub Actions
  • Zip Deploy
  • Azure CLI

Runtime

  • Gunicorn
  • Django
  • PostgreSQL

Infrastructure

  • Azure App Service
  • Key Vault
  • Managed Identity

Outcomes & Impact

Deployment Impact

  • Every deployment runs migrations automatically—no manual steps, no schema drift
  • Secrets synced to Key Vault before deploy ensures runtime consistency
  • Production and staging share the same workflow with environment-specific variables

Reliability

  • Broken deploys fail the pipeline within 60 seconds of completion
  • Deterministic startup—migrate → collectstatic → exec gunicorn on every restart
  • The exec replaces the shell process so signals propagate correctly

Operational Simplicity

  • No Docker build in the main path keeps pipeline fast and simple
  • Azure login uses AZURE_CREDENTIALS; the app uses Managed Identity
  • No secrets stored in the workflow file—everything sourced from Key Vault
Deployments went from a nerve-wracking manual process to a one-click operation with full confidence. The health check alone has saved us from multiple potential outages.
DevOps Lead

DevOps Lead

Enterprise Client

Ready to build something similar?

Let's discuss how we can apply the same engineering excellence to your project.