Staging Deployment & CI/CD Pipeline Documentation
Staging Deployment & CI/CD Pipeline Documentation
1. Overview
This document provides a clear, end-to-end description of the staging deployment setup and the unified CI/CD pipeline implemented for the HeliumAI platform. A single pipeline is used to manage deployments for both staging and production, with strict controls enforced through branch-based execution.
The staging environment is currently deployed and validated in the ap-south-1 (Mumbai) region.
2. Architecture Summary
๐ Frontend Domain:
https://www.heliumai.space๐ Backend API Domain:
https://api.heliumai.space๐งฎ Compute Platform: AWS ECS (Fargate)
๐ฆ Container Registry: Amazon ECR
⚖️ Load Balancer: Application Load Balancer (ALB)
๐ Traffic Acceleration: AWS Global Accelerator
๐ CI/CD Platform: GitHub Actions
3. Environments & Branch Mapping
| Environment | Git Branch | Deployment Scope |
|---|---|---|
| Staging | kartik-stg | Mumbai (ap-south-1) |
| Production | migrated-demo2 | Mumbai, Singapore, Virginia |
Branch-based mapping ensures strong isolation between environments and prevents accidental cross-environment deployments.
4. CI/CD Pipeline Overview
A single GitHub Actions pipeline is responsible for:
๐️ Building Docker images
๐ค Pushing images to Amazon ECR
๐ข Deploying services to Amazon ECS
Pipeline execution is strictly gated by Git branch, enabling controlled promotion from staging to production without maintaining multiple workflows.
5. Pipeline Trigger Strategy
Trigger Conditions
๐ Automatic trigger on
git pushto environment-specific branches
This approach keeps the pipeline simple while ensuring deployments only occur from explicitly approved branches.
6. Global Pipeline Configuration
Image Tagging Strategy
๐ท️ Docker images are tagged using:
v${github.run_number}๐ Guarantees unique, incremental, and traceable image versions
Image Repository Strategy
๐ฆ Single Amazon ECR repository:
helium-backend♻️ The same image artifact is reused across environments, eliminating unnecessary rebuilds
7. Build Stage – Docker Image Creation
Purpose
๐งฑ Build ARM64-compatible Docker images
๐ค Push images to Amazon ECR
Build Flow
๐ฅ Checkout application source code
๐ ️ Initialize Docker Buildx
๐ Authenticate with AWS
๐️ Build ARM64 Docker image
๐ท️ Tag image with pipeline run number
๐ฆ Push image to ECR
๐ค Export image URI for downstream deployment stages
8. Staging Deployment – End-to-End Flow (Mumbai)
This section documents the complete staging deployment lifecycle, from infrastructure readiness to application validation.
8.1 Preconditions
๐ฟ Git branch:
kartik-stg๐งฉ ECS cluster:
helium-mumbai-staging-cluster๐ฆ ECR repository available in
ap-south-1⚖️ ALB and target groups configured for staging services
8.2 Deployment Trigger
๐ Deployment is automatically initiated on:
git pushto thekartik-stgbranch
8.3 Staging Networking & Access Setup (Pre-Deployment)
๐ AWS Global Accelerator configured for staging traffic
๐ฏ Accelerator endpoint attached to the staging ALB in
ap-south-1๐ Separate staging domain configured:
heliumai.space๐ New ACM certificate created for
heliumai.space✅ Certificate validated using DNS validation
๐งญ CNAME record added in Route 53 pointing the domain to the Global Accelerator DNS name
8.4 Build Phase (CI)
๐ GitHub Actions workflow is triggered
๐ฅ Source code is checked out
๐ ️ Docker Buildx is initialized
๐️ ARM64 Docker image is built
๐ท️ Image is tagged using
v${github.run_number}๐ฆ Image is pushed to Amazon ECR (Mumbai)
๐ค Image URI is exported for deployment
8.5 Deploy Phase (CD)
Execution Condition:
๐จ Runs only when the active branch is
kartik-stg
Services Deployed:
๐ต Backend service
⚙️ Worker service
Deployment Steps:
๐ Configure AWS credentials for
ap-south-1๐ฅ Download the current ECS task definition
๐งน Remove AWS-managed metadata fields
๐ผ️ Inject the newly built Docker image
๐งพ Register a new task definition revision
๐ Update the ECS service to use the new revision
⏳ Wait for ECS service stability
8.6 Post-Deployment Validation
✅ Confirm ECS services are stable
๐ Verify new task definition revisions are running
๐ Validate application access via the staging domain
9. Production Deployment Flow (Multi-Region)
Execution Condition
๐จ Triggered only when code is pushed to the
migrated-demo2branch
Safety Controls
๐ Strict branch-based gating
๐ Prevents unintended production deployments
Target Regions & Clusters
| Region | ECS Cluster |
|---|---|
| Mumbai | helium-mumbai-cluster |
| Singapore | helium-singapore-cluster |
| Virginia | helium-virginia-cluster |
Deployment Steps (Per Region)
๐ Configure AWS credentials for the target region
๐ฅ Retrieve existing ECS task definition
๐งน Remove AWS-managed fields
๐ผ️ Inject region-specific Docker image
๐งพ Register a new task definition revision
๐ Deploy the updated task definition to ECS
⏳ Wait for service stability confirmation
10. Security & Secrets Management
๐ AWS credentials are securely stored in GitHub Secrets
๐ซ No credentials or sensitive values are hardcoded
11. Benefits of the Current Setup
✅ Single CI/CD pipeline for all environments
๐ Strong deployment safety through branch isolation
♻️ Reusable Docker artifacts across environments
๐ Multi-region production readiness
๐งผ Clean, scalable, and maintainable architecture
12. Final Summary
This document captures a well-structured, production-ready CI/CD and staging deployment architecture for HeliumAI. The approach ensures safe staging validation, seamless promotion to production, and consistent deployments using a single, controlled pipeline.
Comments
Post a Comment