Skip to content

17J/DevSecOps-Three-Tier-Todo-Application-Pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

81 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ DevSecOps Three-Tier Todo Application Pipeline

A production-grade DevSecOps pipeline for a Three-Tier Todo Application, demonstrating end-to-end security integration from code to deployment on AWS EKS with ALB Ingress.

Pipeline Status Security Scan Kubernetes ALB Ingress


πŸ“‹ Overview

This project showcases a complete DevSecOps Three-Tier pipeline with multiple security scanning tools integrated at every stageβ€”from secret detection to container vulnerability scanningβ€”before deploying to AWS EKS with Application Load Balancer (ALB) Ingress Controller.


πŸ—οΈ Architecture Overview

Three-Tier Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  ALB Ingress Controller             β”‚
β”‚           (Internet-facing Load Balancer)           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚                   β”‚
    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”
    β”‚Frontend β”‚        β”‚Backend  β”‚
    β”‚(React)  │───────▢│(Java)   β”‚
    β”‚Service  β”‚        β”‚Service  β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
                            β”‚
                       β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”
                       β”‚Database β”‚
                       β”‚(MySQL)  β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Pipeline Flow

DevSecOps Pipeline Flow


πŸ”§ Tech Stack

Application Layer

Frontend (Tier 1):
β”œβ”€β”€ React.js          # UI Framework
β”œβ”€β”€ Node.js     # JavaScript Runtime
└── npm               # Package Manager

Backend (Tier 2):
β”œβ”€β”€ JDK 17          # Java Development Kit
β”œβ”€β”€ Maven           # Build Tool
└── Spring Boot       # Backend Framework

Database (Tier 3):
└── MySQL             # Relational Database

DevOps & Infrastructure

CI/CD:
β”œβ”€β”€ Jenkins           # Pipeline Orchestration
β”œβ”€β”€ Git/GitHub        # Version Control
└── kubectl           # Kubernetes CLI

Containerization:
β”œβ”€β”€ Docker            # Container Platform
└── Docker Hub        # Container Registry (17rj)

Orchestration:
β”œβ”€β”€ AWS EKS           # Managed Kubernetes (ap-south-1)
β”œβ”€β”€ ALB Ingress       # Application Load Balancer Controller
└── RBAC              # Role-Based Access Control

Artifact Repository:
└── Nexus             # Artifact Management

Security Tools (DevSecOps)

Secret Scanning:
└── TruffleHog        # Detect hardcoded secrets in Git

Dependency Scanning (SCA):
β”œβ”€β”€ Snyk              # Software Composition Analysis
└── OWASP Dependency  # Check known vulnerabilities

Code Quality (SAST):
└── SonarQube         # Static Application Security Testing

Container Security:
└── Dockle            # Docker Image Best Practices Linter

Dynamic Testing (DAST):
└── OWASP ZAP         # Web Application Security Scanner

πŸš€ Complete Pipeline Stages (23 Stages)

Stage # Stage Name Tool/Action Purpose Status
1 Clean Workspace Jenkins Clean previous build artifacts βœ…
2 Checkout Code Git Clone repository from GitHub βœ…
3 Frontend Compilation Node.js Validate JavaScript syntax βœ…
4 Backend Compilation Maven Compile Java source code βœ…
5 TruffleHog Secret Scan TruffleHog Detect secrets in Git history βœ…
6 Snyk Frontend SCA Snyk Scan npm dependencies βœ…
7 Snyk Backend SCA Snyk Scan Maven dependencies βœ…
8 SonarQube Code Analysis SonarQube SAST - Code quality & security βœ…
9 Quality Gate SonarQube Enforce quality standards βœ…
10 Build Artifact Maven Package backend JAR file βœ…
11 Publish to Nexus Nexus Upload artifacts to repository βœ…
12 OWASP Dependency Check OWASP DP Check for vulnerable dependencies βœ…
13 Docker Build Frontend Docker Build frontend container image βœ…
14 Docker Build Backend Docker Build backend container image βœ…
15 Docker Tag Images Docker Tag images for registry βœ…
16 Dockle Frontend Scan Dockle Scan frontend image security βœ…
17 Dockle Backend Scan Dockle Scan backend image security βœ…
18 Push Docker Images Docker Hub Push to container registry βœ…
19 Kubernetes Deploy kubectl Deploy to EKS cluster βœ…
20 Retrieve ALB URL kubectl Get Application Load Balancer URL βœ…
21 Kubernetes Verify kubectl Verify all resources running βœ…
22 OWASP ZAP Security Scan ZAP Dynamic application security testing βœ…
23 Cleanup Docker Remove old images βœ…

πŸ› οΈ Prerequisites

1. Infrastructure Requirements

AWS EKS Cluster

# Cluster Configuration
Name: expdevops-cluster
Region: ap-south-1 (Mumbai)
Kubernetes Version: 1.28+
Node Type: t3.medium (minimum)
Nodes: 2-3 worker nodes

AWS Load Balancer Controller

# ALB Ingress Controller must be installed
Version: v2.7.0+
IAM OIDC Provider: Enabled
Service Account: aws-load-balancer-controller
Namespace: kube-system

# Required IAM Permissions:
- ec2:DescribeRouteTables
- ec2:DescribeSubnets
- ec2:DescribeSecurityGroups
- elasticloadbalancing:*

Setup Guide: See ALB Controller Installation

2. Jenkins Configuration

Required Plugins

βœ“ Pipeline Plugin
βœ“ Git Plugin
βœ“ Docker Pipeline Plugin
βœ“ Kubernetes CLI Plugin
βœ“ SonarQube Scanner Plugin
βœ“ OWASP Dependency-Check Plugin
βœ“ Config File Provider Plugin
βœ“ Snyk Security Plugin
βœ“ Credentials Plugin

Tool Configuration

Jenkins β†’ Global Tool Configuration:

JDK:
  Name: jdk-17.0
  Install automatically: Yes
  Version: JDK 17.0.10

Maven:
  Name: maven-3.9
  Install automatically: Yes
  Version: 3.9.6

NodeJS:
  Name: nodejs-23.9
  Install automatically: Yes
  Version: 23.9.0

SonarQube Scanner:
  Name: sonar-scanner
  Install automatically: Yes
  Version: Latest

3. Required Credentials in Jenkins

Credential ID          | Type              | Purpose
----------------------|-------------------|---------------------------
docker-cred           | Username/Password | Docker Hub login
kube-cred             | Secret file       | Kubernetes config
sonar-cred            | Secret text       | SonarQube token
snyk-cred             | Secret text       | Snyk API token
nvd-api-key           | Secret text       | NVD API key
nexus-settings        | Config file       | Maven settings.xml

4. External Services

SonarQube Server

URL: http://your-sonarqube-server:9000
Project Key: devsecopsthreetier
Quality Gate: Configured

Nexus Repository

URL: http://your-nexus-server:8081
Repository: maven-releases
Authentication: Configured in settings.xml

Docker Registry

Registry: Docker Hub
Username: 17rj
Repositories:
  - three-tier-todo-frontend
  - three-tier-todo-backend

5. Security Tools Installation

On Jenkins Server

# TruffleHog
pip3 install trufflehog

# Snyk
npm install -g snyk

# Dockle
wget https://github.com/goodwithtech/dockle/releases/download/v0.4.14/dockle_0.4.14_Linux-64bit.tar.gz
tar zxvf dockle_0.4.14_Linux-64bit.tar.gz
sudo mv dockle /usr/local/bin/

# Docker
sudo apt install docker.io -y
sudo usermod -aG docker $USER && newgrp docker


# HELM
sudo snap install helm --classic

6. Kubernetes RBAC Setup

# Create namespace
kubectl create namespace threetierapp

# Apply RBAC for Jenkins
kubectl apply -f jenkins-rbac.yaml

πŸ“ Project Structure

Three-Tier-Todo-Application/
β”œβ”€β”€ frontend/                    # React.js application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   └── App.jsx
β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”œβ”€β”€ package.json
β”‚   └── nginx.conf
β”‚
β”œβ”€β”€ backend/                     # Spring Boot application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”‚   β”œβ”€β”€ java/
β”‚   β”‚   β”‚   └── resources/
β”‚   β”‚   └── test/
β”‚   β”œβ”€β”€ pom.xml
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ K8s/                         # Kubernetes manifests
β”‚   β”œβ”€β”€ secrets-configmap.yml
β”‚   β”œβ”€β”€ db-ds-service.yml
β”‚   β”œβ”€β”€ backend-ds-service.yml
β”‚   β”œβ”€β”€ frontend-ds-service.yml
β”‚   β”œβ”€β”€ ingress.yml
β”‚   └── jenkins-rbac.yaml
β”‚
β”œβ”€β”€ Jenkinsfile      # Pipeline Defination
β”œβ”€β”€ istio/
β”œβ”€β”€ docker-compose.yaml          # Local development
β”œβ”€β”€ snapshot/                    # Screenshots
└── README.md

🚦 Getting Started

1. Clone Repository

git clone https://github.com/17J/Three-Tier-Todo-Application.git
cd Three-Tier-Todo-Application

*2. Setup EKS Cluster

Clone Terraform repository

git clone https://github.com/17J/Terraform-AWS-EKS.git
cd Terraform-AWS-EKS/terraform/

Initialize Terraform

terraform init

Review the plan

terraform plan

Apply configuration

terraform apply -auto-approve

Verify cluster

kubectl get nodes

3. Install ALB Controller

# Associate OIDC provider
eksctl utils associate-iam-oidc-provider \
  --region ap-south-1 \
  --cluster expdevops-cluster \
  --approve

# Create IAM policy
curl -o iam_policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.7.0/docs/install/iam_policy.json

aws iam create-policy \
  --policy-name AWSLoadBalancerControllerIAMPolicy \
  --policy-document file://iam_policy.json

# Create service account
eksctl create iamserviceaccount \
  --cluster=expdevops-cluster \
  --namespace=kube-system \
  --name=aws-load-balancer-controller \
  --attach-policy-arn=arn:aws:iam::YOUR_ACCOUNT_ID:policy/AWSLoadBalancerControllerIAMPolicy \
  --override-existing-serviceaccounts \
  --approve

# Install controller via Helm
helm repo add eks https://aws.github.io/eks-charts
helm install aws-load-balancer-controller eks/aws-load-balancer-controller \
  -n kube-system \
  --set clusterName=expdevops-cluster \
  --set serviceAccount.create=false \
  --set serviceAccount.name=aws-load-balancer-controller

4. Create Namespace & RBAC

# Create namespace
kubectl create namespace threetierapp

# Apply Jenkins RBAC
kubectl apply -f K8s/jenkins-rbac.yaml

5. Configure Jenkins Pipeline

1. Create new Pipeline job
2. Configure Git repository
3. Point to Jenkinsfile
4. Add all required credentials
5. Run pipeline

πŸ“Š Pipeline Results

Jenkins Pipeline Stages View

Jenkins Pipeline - 23 Stages

OWASP Dependency Check Results

OWASP Dependency Check Report

Kubernetes Deployment Status

K8s Resources Running

ALB Ingress Controller

ALB Ingress Configuration

SonarQube SAST Analysis

SonarQube Code Quality Report

Nexus Artifact Repository

Nexus Published Artifacts


πŸ–ΌοΈ Application Screenshots

Todo List View
Todo List Dashboard
Add Task
Add New Task
Task Management
Task Management

πŸ” Security Features Implemented

Shift-Left Security

  • βœ… Secret Detection (TruffleHog) - Scans Git history for leaked credentials
  • βœ… Dependency Scanning (Snyk + OWASP) - Identifies vulnerable packages
  • βœ… SAST (SonarQube) - Static code analysis for bugs & vulnerabilities
  • βœ… Container Scanning (Dockle) - Docker image best practices validation

Runtime Security

  • βœ… DAST (OWASP ZAP) - Dynamic application security testing
  • βœ… Quality Gates - Automated quality enforcement
  • βœ… RBAC in Kubernetes - Least privilege access control
  • βœ… Network Policies - Ingress controller security

Compliance & Governance

  • βœ… Artifact Traceability - Nexus repository integration
  • βœ… Build Reproducibility - Tagged Docker images
  • βœ… Audit Trails - Jenkins build logs

🎯 Key Features

DevOps Best Practices

  • πŸ”„ CI/CD Automation - Fully automated pipeline from code to production
  • 🐳 Containerization - Docker multi-stage builds
  • ☸️ Orchestration - Kubernetes with auto-scaling
  • πŸ”€ GitOps - Version-controlled infrastructure

Security Best Practices

  • πŸ”’ Zero Trust - RBAC and network policies
  • πŸ›‘οΈ Defense in Depth - Multiple security layers
  • πŸ“Š Continuous Monitoring - Security scans at every stage
  • 🚨 Fail Fast - Early detection of vulnerabilities

Production Ready

  • ⚑ High Availability - Multi-replica deployments
  • πŸ“ˆ Scalability - Kubernetes HPA support
  • πŸ” Observability - Logging and monitoring ready
  • 🌐 Load Balancing - AWS ALB with health checks

πŸ“ Environment Variables

Required in Jenkinsfile

SCANNER_HOME         # SonarQube scanner path
FRONTEND_IMAGE_NAME  # Frontend Docker image name
BACKEND_IMAGE_NAME   # Backend Docker image name
IMAGE_TAG            # Build number
DOCKER_REGISTRY      # Docker Hub username
K8S_NAMESPACE        # Kubernetes namespace

Application Environment

# Backend
SPRING_DATASOURCE_URL=jdbc:mysql://mysql-service:3306/tododb
SPRING_DATASOURCE_USERNAME=root
SPRING_DATASOURCE_PASSWORD=***

# Frontend
REACT_APP_API_URL=/api

πŸ› Troubleshooting

ALB Controller Issues

# Check controller logs
kubectl logs -n kube-system deployment/aws-load-balancer-controller

# Verify IAM permissions
kubectl describe sa aws-load-balancer-controller -n kube-system

# Check ingress status
kubectl describe ingress todo-app-ingress -n threetierapp

Jenkins RBAC Issues

# Test permissions
kubectl auth can-i create deployments \
  --as=system:serviceaccount:threetierapp:jenkins \
  -n threetierapp

# Recreate service account token
kubectl delete secret jenkins-token -n threetierapp
kubectl create secret generic jenkins-token \
  --from-literal=token=$(kubectl create token jenkins -n threetierapp)

Pipeline Failures

# Check pod logs
kubectl logs -n threetierapp <pod-name>

# Verify secrets
kubectl get secrets -n threetierapp

# Check service endpoints
kubectl get endpoints -n threetierapp

πŸš€ Deployment

Manual Deployment

# Deploy to Kubernetes
kubectl apply -f K8s/secrets-configmap.yml -n threetierapp
kubectl apply -f K8s/db-ds-service.yml -n threetierapp
kubectl apply -f K8s/backend-ds-service.yml -n threetierapp
kubectl apply -f K8s/frontend-ds-service.yml -n threetierapp
kubectl apply -f K8s/ingress.yml -n threetierapp

# Get ALB URL
kubectl get ingress todo-app-ingress -n threetierapp

Via Jenkins Pipeline

# Trigger pipeline
# Pipeline will automatically:
# 1. Run all security scans
# 2. Build and push Docker images
# 3. Deploy to Kubernetes
# 4. Configure ALB ingress
# 5. Run DAST scan

πŸ“ˆ Monitoring & Logging

View Logs

# Frontend logs
kubectl logs -f deployment/frontend -n threetierapp

# Backend logs
kubectl logs -f deployment/backend -n threetierapp

# Database logs
kubectl logs -f statefulset/mysql -n threetierapp

Check Resources

# All resources
kubectl get all -n threetierapp

# Ingress status
kubectl get ingress -n threetierapp

# Pod status
kubectl get pods -n threetierapp -o wide

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘¨β€πŸ’» Author

Rahul Joshi
πŸ“§ Email: 17rahuljoshi@gmail.com
πŸ”— GitHub: @17J


⭐ Show Your Support

Give a ⭐ if this project helped you learn DevSecOps practices!


πŸ“š Additional Resources


Built with ❀️ for the DevSecOps Community

About

Three-Tier To-Do Application app built with frontend (React), Backend (JAVA), providing robust Todo List features (filtering, authentication)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors