Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Containerized-Node.js-App-with-CI-CD-Environment-Separation-Rollback

📌 Overview

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.

Demo

Tech Stack

  • Node.js (Express)
  • Docker (multi-stage builds)
  • Docker Hub (image registry)
  • GitHub Actions (CI/CD)
  • AWS EC2 (deployment target)
  • Terraform (infrastructure provisioning)

Features

  • 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)

CI/CD Flow

  1. Code pushed to main or staging branch
  2. GitHub Actions triggers automatically
  3. Docker image built using multi-stage Dockerfile
  4. Image tagged with unique commit SHA for versioning
  5. Image pushed to Docker Hub
  6. GitHub Actions SSHs into EC2 server
  7. Server pulls the new image from Docker Hub
  8. Old container stopped and removed
  9. New container started with environment-specific variables

Environments

Branch Environment
main production
staging staging

Rollback Strategy

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

Endpoints

  • / → App info (version + environment)
  • /health → Health check

Run Locally

docker build -t myapp .
docker run -p 3000:3000 myapp

Terraform (infrastructure provisioning)

image

Docker Installed

image

Github Secrects

image

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages