https://github.com/notharshhaa/ci-cd_eks-github_actions
A fully automated CI/CD pipeline that builds, tests, and deploys a Node.js application on Amazon EKS using GitHub Actions, Terraform, and Kubernetes.
https://github.com/notharshhaa/ci-cd_eks-github_actions
aws aws-eks cicd devops eks eks-cluster github-actions jenkins nodejs
Last synced: 17 days ago
JSON representation
A fully automated CI/CD pipeline that builds, tests, and deploys a Node.js application on Amazon EKS using GitHub Actions, Terraform, and Kubernetes.
- Host: GitHub
- URL: https://github.com/notharshhaa/ci-cd_eks-github_actions
- Owner: NotHarshhaa
- Created: 2023-09-09T16:54:09.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2025-03-27T05:48:25.000Z (3 months ago)
- Last Synced: 2025-03-27T06:28:26.184Z (3 months ago)
- Topics: aws, aws-eks, cicd, devops, eks, eks-cluster, github-actions, jenkins, nodejs
- Language: HCL
- Homepage:
- Size: 18.6 KB
- Stars: 74
- Watchers: 2
- Forks: 56
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **π End-to-End CI/CD Pipeline for Node.js App Deployment on EKS using GitHub Actions**

---

## **π Table of Contents**
- [**π End-to-End CI/CD Pipeline for Node.js App Deployment on EKS using GitHub Actions**](#-end-to-end-cicd-pipeline-for-nodejs-app-deployment-on-eks-using-github-actions)
- [**π Table of Contents**](#-table-of-contents)
- [**π Repository Structure**](#-repository-structure)
- [**π§ Prerequisites**](#-prerequisites)
- [**βοΈ CI/CD Workflow**](#οΈ-cicd-workflow)
- [**π¨ Build Job**](#-build-job)
- [**π Deployment Job**](#-deployment-job)
- [**ποΈ Infrastructure Details**](#οΈ-infrastructure-details)
- [**π¦ Application Deployment Strategy**](#-application-deployment-strategy)
- [**π GitOps Principles**](#-gitops-principles)
- [**π Security Best Practices**](#-security-best-practices)
- [**π’ Notifications \& Alerts**](#-notifications--alerts)
- [**π Monitoring \& Logging**](#-monitoring--logging)
- [**π Contributing**](#-contributing)
- [**β Support \& Author**](#-support--author)
- [**β Hit the Star!**](#-hit-the-star)
- [π οΈ **Author \& Community**](#οΈ-author--community)
- [π§ **Let's Connect!**](#-lets-connect)
- [π’ **Stay Updated!**](#-stay-updated)---
## **π Repository Structure**
The repository is structured for **modularity and maintainability**.:
```tree
π root
βββ π app # Application source code
β βββ app.py # Python application logic (if applicable)
β βββ calculator.js # Business logic for calculations
β βββ calculator.test.js # Unit tests for calculator functions
β βββ Dockerfile # Dockerfile for building the Node.js app
β βββ Dockerfile-python # Dockerfile for a Python-based version (if needed)
β βββ index.js # Main entry point of the Node.js application
β βββ package.json # Project dependencies and scripts
β
βββ π kustomize # Kubernetes manifests managed with Kustomize
β βββ π base # Base configurations common for all environments
β β βββ deploy.yaml # Deployment definition for the application
β β βββ ingress.yaml # Ingress configuration for routing traffic
β β βββ kustomization.yaml # Kustomize configuration file
β β βββ svc.yaml # Kubernetes Service definition
β β
β βββ π overlays # Environment-specific configurations
β β βββ π dev # Dev environment-specific Kustomize configs
β β β βββ deploy-dev.yaml # Dev-specific deployment file
β β β βββ ingress-dev.yaml # Dev-specific ingress settings
β β β βββ kustomization.yaml # Kustomize configuration for Dev
β β β βββ svc-dev.yaml # Dev-specific service settings
β β β
β β βββ π prod # Production environment-specific Kustomize configs
β β β βββ deploy-prod.yaml # Production-specific deployment file
β β β βββ ingress-prod.yaml # Production-specific ingress settings
β β β βββ kustomization.yaml # Kustomize configuration for Prod
β β β βββ svc-prod.yaml # Production-specific service settings
β β β
β β βββ π staging # Staging environment-specific Kustomize configs
β β β βββ deploy-staging.yaml # Staging-specific deployment file
β β β βββ ingress-staging.yaml # Staging-specific ingress settings
β β β βββ kustomization.yaml # Kustomize configuration for Staging
β β β βββ svc-staging.yaml # Staging-specific service settings
β
βββ README.md # Project documentation and setup guide
β
βββ π terraform # Terraform configuration for infrastructure provisioning
β βββ ingress-nginx.tf # Terraform script for setting up NGINX Ingress
β βββ main.tf # Main Terraform file defining AWS infrastructure
β βββ outputs.tf # Defines Terraform outputs (e.g., cluster endpoints)
β βββ terraform.tf # Backend configuration for Terraform state management
β βββ variables.tf # Input variables for Terraform modules
β
βββ VERSION # Tracks application versioning (Semantic Versioning)
```---
## **π§ Prerequisites**
Before you proceed, ensure you have the following installed:
- π **Node.js (>=14.x)**
- π³ **Docker (latest version)**
- ποΈ **Terraform (>=1.0)**
- βΈ **kubectl (latest version)**
- π **Kustomize**
- β **AWS CLI & eksctl**
- βοΈ **GitHub Actions configured**
- π **AWS IAM permissions to manage EKS**---
## **βοΈ CI/CD Workflow**
The **CI/CD pipeline** automates the entire deployment process using **GitHub Actions**.
### **π¨ Build Job**
1οΈβ£ **Set Up the Environment**
- Install **Node.js dependencies** using `npm install`.
- Lint the code to ensure quality standards.2οΈβ£ **Run Tests**
- Execute **unit tests** with `npm test`.
- Generate test reports for visibility.3οΈβ£ **Version Management**
- Uses **Semantic Versioning** (`major.minor.patch`).
- Auto-increments the version based on commit messages.4οΈβ£ **Build & Push Docker Image**
- **Builds a Docker image** of the application.
- Pushes it to **Amazon Elastic Container Registry (ECR)**.---
### **π Deployment Job**
1οΈβ£ **Terraform Setup**
- Initializes Terraform with `terraform init`.
- Ensures correct **state management**.2οΈβ£ **Infrastructure Provisioning**
- Executes `terraform plan` and `terraform apply`.
- Deploys EKS clusters, networking, and storage.3οΈβ£ **Kubernetes Configuration**
- Configures `kubectl` to interact with the cluster.
- Applies `Kustomize` overlays for environment-specific settings.4οΈβ£ **Ingress Controller Setup**
- Uses **Helm** to install **NGINX Ingress**.
5οΈβ£ **Application Deployment**
- Deploys the latest **Docker image** to Kubernetes.
- Exposes the service via **Ingress and Load Balancer**.---
## **ποΈ Infrastructure Details**
| Environment | Instance Type | Replica Count |
|-------------|--------------|---------------|
| **Dev** | `t3.small` | 1 |
| **Staging** | `t3.medium` | 3 |
| **Prod** | `t3.large` | 3 |β **DNS Automation via Cloudflare**
- Environment-specific subdomains:
- `dev.example.com`
- `staging.example.com`
- `prod.example.com`---
## **π¦ Application Deployment Strategy**
This project supports **multiple deployment strategies**:
β **Rolling Updates** β Default strategy, ensuring zero downtime.
β **Blue-Green Deployment** β Used in production environments.
β **Canary Deployments** β Gradual rollout for safe updates.---
## **π GitOps Principles**
β **Git as the Source of Truth**
β **Declarative Infrastructure** (Terraform & Kubernetes)
β **Automated Deployments via GitHub Actions**Every infrastructure change must be made via a **Git commit**.
---
## **π Security Best Practices**
π **Secrets Management**
- Uses **AWS Secrets Manager** & GitHub Actions **encrypted secrets**.
π‘ **Container Security**
- Uses **Trivy** and **Docker Bench Security** for vulnerability scanning.
π§ **IAM & Least Privilege**
- Uses **AWS IAM roles** with restricted access.
---
## **π’ Notifications & Alerts**
π **Slack & Email Notifications**
- **CI/CD Job Updates** β Pipeline status alerts.
- **DNS Updates** β Cloudflare integration for alerts.π‘ **Monitoring & Logging**
- **AWS CloudWatch** for logs & metrics.
- **Prometheus & Grafana** for observability.---
## **π Monitoring & Logging**
β **Application Logs** β Aggregated using **Fluent Bit**.
β **Infrastructure Logs** β Stored in **AWS CloudWatch Logs**.
β **Metrics Monitoring** β Tracked using **Prometheus & Grafana**.---
## **π Contributing**
Want to contribute? Hereβs how:
1. **Fork the repository** & create a new branch.
2. Make your changes and **commit with a descriptive message**.
3. Open a **Pull Request (PR)** for review.---
## **β Support & Author**
## **β Hit the Star!**
If you find this repository helpful and plan to use it for learning, please consider giving it a star β. Your support motivates me to keep improving and adding more valuable content! π
---
## π οΈ **Author & Community**
This project is crafted with passion by **[Harshhaa](https://github.com/NotHarshhaa)** π‘.
Iβd love to hear your feedback! Feel free to open an issue, suggest improvements, or just drop by for a discussion. Letβs build a strong DevOps community together!
---
## π§ **Let's Connect!**
Stay connected and explore more DevOps content with me:
[](https://linkedin.com/in/harshhaa-vardhan-reddy) [](https://github.com/NotHarshhaa) [](https://t.me/prodevopsguy) [](https://dev.to/notharshhaa) [](https://hashnode.com/@prodevopsguy)
---
## π’ **Stay Updated!**
Want to stay up to date with the latest DevOps trends, best practices, and project updates? Follow me on my blogs and social channels!
