This project demonstrates a production-style DevOps workflow for deploying a Node.js application. It includes containerization using Docker, automated CI/CD with GitHub Actions, infrastructure provisioning with Terraform, environment-based deployments, and version-controlled rollback capability.
The goal is to simulate a real-world deployment pipeline where code changes are automatically built, versioned, and deployed to a cloud environment with minimal manual intervention.
- Node.js (Express)
- Docker (multi-stage builds)
- Docker Hub (image registry)
- GitHub Actions (CI/CD)
- AWS EC2 (deployment target)
- Terraform (infrastructure provisioning)
- Dockerized Node.js application (multi-stage build)
- Automated CI/CD pipeline with GitHub Actions
- Environment-based deployment (staging & production via branches)
- Versioned deployments using commit SHA
- Manual rollback capability via workflow re-run
- Health check endpoint (
/health)
- Code pushed to
mainorstagingbranch - GitHub Actions triggers automatically
- Docker image built using multi-stage Dockerfile
- Image tagged with unique commit SHA for versioning
- Image pushed to Docker Hub
- GitHub Actions SSHs into EC2 server
- Server pulls the new image from Docker Hub
- Old container stopped and removed
- New container started with environment-specific variables
| Branch | Environment |
|---|---|
| main | production |
| staging | staging |
Each deployment is tagged with a unique commit SHA.
To rollback:
- Re-run the GitHub Actions workflow on a previous commit
- This redeploys the previous version of the application
/→ App info (version + environment)/health→ Health check
docker build -t myapp .
docker run -p 3000:3000 myapp