feat: implement staging deployment pipeline with Docker support, auto… - #95
Merged
3m1n3nc3 merged 2 commits intoJul 18, 2026
Conversation
…mated migrations, and rollback procedures
3m1n3nc3
requested changes
Jul 18, 2026
3m1n3nc3
left a comment
Contributor
There was a problem hiding this comment.
Your docker additions are not required for this pr, you should remove them, that should fix the conflicts
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.
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.