Skip to main content

Deployment Overview

The multi-region shopping mall platform adopts the GitOps paradigm, using the Git repository as the Single Source of Truth. Infrastructure changes are managed with Terraform, and application deployments are managed with ArgoCD and Kustomize.

Deployment Pipeline Overview

GitOps Principles

1. Declarative Configuration

All infrastructure and application states are declared as code:

multi-region-architecture/
├── terraform/ # Infrastructure code
│ ├── environments/
│ │ └── production/
│ │ ├── us-east-1/ # Primary region
│ │ └── us-west-2/ # Secondary region
│ └── modules/ # Reusable modules
├── k8s/ # Kubernetes manifests
│ ├── base/ # Common settings
│ ├── services/ # Service deployments
│ ├── overlays/ # Regional overlays
│ │ ├── us-east-1/
│ │ └── us-west-2/
│ └── infra/ # Infrastructure components
└── .github/workflows/ # CI/CD pipelines

2. Version Controlled

  • All changes are tracked via Git commits
  • Changes reviewed through Pull Requests
  • Rollbacks performed via Git revert

3. Automated

  • Automatic Plan/Preview on PR creation
  • Automatic deployment on merge to main branch
  • ArgoCD continuously synchronizes Git state with cluster state

4. Auditable

  • Track change history via Git history
  • Review deployment records via GitHub Actions logs
  • ArgoCD synchronization history

Deployment Flow

Infrastructure Changes (Terraform)

Application Changes

Environment Configuration

Regional Roles

RegionRoleDeployment OrderDatabase Mode
us-east-1Primary1stWriter
us-west-2Secondary2nd (after us-east-1 completes)Reader / Failover

Deployment Order

Deployment Order Important

When making infrastructure changes, you must deploy to us-east-1 (Primary) first. For global databases, the Primary region creates the global cluster, then the Secondary joins.

Tool Stack

ToolPurposeVersion
TerraformInfrastructure provisioning1.7.0
ArgoCDKubernetes GitOps2.10.x
KustomizeKubernetes manifest management5.x
GitHub ActionsCI/CD pipeline-
DockerContainer image builds-
ECRContainer registry-

Branch Strategy

Branch Rules

BranchPurposeProtection Rules
mainProduction deploymentPR required, 1+ reviewers, CI must pass
feature/*Feature development-
fix/*Bug fixes-
hotfix/*Emergency fixesBranch from main, can merge directly

Rollback Strategy

Infrastructure Rollback

# Revert to previous state in Git
git revert <commit-hash>
git push origin main

# Or rollback to a specific version directly
cd terraform/environments/production/us-east-1
terraform plan -target=module.eks
terraform apply -target=module.eks

Application Rollback

# Using ArgoCD CLI
argocd app rollback <app-name> <revision>

# Or Git revert
git revert <commit-hash>
git push origin main
# ArgoCD automatically syncs to previous state

Next Steps