Skip to content

feat: implement staging deployment pipeline with Docker support, auto… - #95

Merged
3m1n3nc3 merged 2 commits into
learnault:mainfrom
akinboyewaSamson:feat/staging-deployment-rollback-smoke-tests
Jul 18, 2026
Merged

feat: implement staging deployment pipeline with Docker support, auto…#95
3m1n3nc3 merged 2 commits into
learnault:mainfrom
akinboyewaSamson:feat/staging-deployment-rollback-smoke-tests

Conversation

@akinboyewaSamson

Copy link
Copy Markdown

closes #74

Phase 0: Staging Deployment, Rollback, and Smoke Tests
Overview
Implements a multi-stage Docker deployment pipeline with configuration validation, safe database migrations, automated smoke tests, and automatic rollback support to fulfill the "Phase 0" API roadmap requirements.

Changes Made
New Files
Dockerfile - Multi-stage, pnpm-optimized image build process for the API.
.dockerignore - Prevents local artifacts and dependencies from bloating the Docker image.
docker-compose.staging.yml - Orchestration manifest for the staging API and database services.
config/staging.env.example - Explicit staging secrets contract containing required variables.
scripts/deploy-staging.sh - Automates configuration checks, safe Prisma migrations (npx prisma migrate deploy), container deployment, and readiness polling.
scripts/smoke-test.sh - Validates the deployment using the /health endpoint.
scripts/rollback-staging.sh - Automates a safe, migration-forward rollback using previous image digests.
.github/workflows/deploy-staging.yml - CI/CD pipeline combining build, deployment, smoke testing, and conditional rollbacks on failure.
docs/RUNBOOK.md - Technical runbook documenting the deployment strategy, manual execution, and the strict migration-forward schema policy.
Technical Details
Deployment Strategy
Utilizes immutable Docker image tags based on the Git commit SHA (type=sha,format=long).
Database migrations are isolated and applied in an ephemeral container before the application containers are updated to ensure code-schema consistency.
A readiness check continuously polls the /health endpoint for up to 30 seconds before proceeding to smoke tests.
Rollback Strategy (Migration-Forward)
If the deployment or smoke tests fail, the rollback script is automatically invoked.
Rollback intentionally omits database schema downgrades to prevent accidental data loss in staging/production environments.
The system safely reverts only the API container to the previous Docker image digest.
Acceptance Criteria Met
✅ Staging deploys from a known image digest.
✅ Failed readiness or smoke tests stop the promotion and fail the workflow.
✅ Rollback procedure avoids unsafe DB downgrades (migration-forward).
✅ Evidence of deployments, actors, and tests is retained via GitHub Action workflow logs.
✅ The required RUNBOOK.md documentation has been created.

@3m1n3nc3 3m1n3nc3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your docker additions are not required for this pr, you should remove them, that should fix the conflicts

@3m1n3nc3
3m1n3nc3 merged commit b13cd81 into learnault:main Jul 18, 2026
1 check 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.

Feature: Add Staging Deployment Rollback and Smoke Tests

3 participants