This repository demonstrates the deployment of a Strapi application on AWS ECS Fargate with full infrastructure automation via Terraform, and a CI/CD pipeline built with GitHub Actions for seamless containerized deployments.
- Tools/Tech: AWS, Terraform, ECS Fargate, DockerHub
- Highlights:
- Automated deployment of Strapi using Terraform.
- Provisioned ECS Fargate Cluster, IAM roles, and Application Load Balancer (ALB).
- Terraform pulls the latest Docker image from DockerHub.
- Tools/Tech: GitHub Actions, Docker, DockerHub, ECS
- Highlights:
- Automated build, test, and push pipeline using GitHub Actions.
- Dockerized Strapi application pushed to DockerHub.
- Deployment is triggered by running
terraform apply. - Secure handling of DockerHub credentials using GitHub Secrets.
┌───────────────┐
│ GitHub Repo │
└───────┬───────┘
│
▼
┌─────────────────────┐
│ GitHub Actions CI/CD│
└─────────┬──────────┘
│ (Build & Push Docker Image)
▼
┌─────────────────────┐
│ DockerHub │
└─────────┬──────────┘
│ (terraform apply pulls image)
▼
┌────────────────────────────┐
│ AWS ECS Fargate Cluster │
│ (Terraform Provisioned) │
└──────────────┬─────────────┘
│
▼
┌─────────────────────┐
│ Application Load Bal │
│ (Routes traffic) │
└─────────────────────┘
├── strapi-app/ # Strapi application (Dockerized)
├── terraform/ # Terraform IaC for ECS, ALB, IAM
├── .github/workflows/ # GitHub Actions CI/CD pipelines
├── strapi-app/Dockerfile # Container setup for Strapi
├── README.md # Project Documentation
└── ...
git clone[ https://github.com/Vaidik-Raval/strapi-terraform-deploy.gitCreate a .env file inside strapi-app/:
DATABASE_CLIENT=sqlite
JWT_SECRET=your-secret-key
APP_KEYS=your-app-keysFor GitHub Actions (Settings > Secrets and variables > Actions), add:
DOCKER_USERNAMEDOCKER_PASSWORDAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_REGION
cd terraform
terraform init
terraform plan
terraform apply -auto-approveTerraform will:
- Pull the latest Strapi Docker image from DockerHub
- Deploy to ECS Fargate
- Attach ALB for routing
- On push to
mainbranch:- Docker image is built.
- Image is pushed to DockerHub.
- To deploy the new version, run:
terraform apply -auto-approve
✅ Fully automated Strapi deployment on AWS ECS Fargate
✅ Infrastructure as Code (IaC) with Terraform
✅ CI/CD with GitHub Actions + DockerHub
✅ Scalable & fault-tolerant architecture with ALB integration
- Automate deployment trigger (Terraform Cloud or GitHub Actions Terraform step).
- Add Blue/Green Deployment with AWS CodeDeploy.
- Set up Monitoring & Logging (CloudWatch, Grafana, Prometheus).
- Multi-environment support (dev/staging/prod).
- Strapi (Headless CMS)
- Terraform (Infrastructure as Code)
- AWS ECS Fargate (Serverless containers)
- DockerHub (Container registry)
- GitHub Actions (CI/CD)
- Docker (Containerization)
MIT License © 2025