{"id":31109393,"url":"https://github.com/devopspradeepyadav/3-tier-architecture-application","last_synced_at":"2025-10-16T15:38:00.120Z","repository":{"id":314466218,"uuid":"1049942879","full_name":"devopspradeepyadav/3-Tier-Architecture-Application","owner":"devopspradeepyadav","description":"3-Tier-Architecture-Application deployment","archived":false,"fork":false,"pushed_at":"2025-09-12T15:02:01.000Z","size":1340,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-12T17:59:11.222Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devopspradeepyadav.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-03T18:08:49.000Z","updated_at":"2025-09-12T15:02:06.000Z","dependencies_parsed_at":"2025-09-12T17:59:14.619Z","dependency_job_id":"8f33fa30-2095-4613-80c5-0a82a8735f41","html_url":"https://github.com/devopspradeepyadav/3-Tier-Architecture-Application","commit_stats":null,"previous_names":["devopspradeepyadav/3-tier-architecture-application"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/devopspradeepyadav/3-Tier-Architecture-Application","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devopspradeepyadav%2F3-Tier-Architecture-Application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devopspradeepyadav%2F3-Tier-Architecture-Application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devopspradeepyadav%2F3-Tier-Architecture-Application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devopspradeepyadav%2F3-Tier-Architecture-Application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devopspradeepyadav","download_url":"https://codeload.github.com/devopspradeepyadav/3-Tier-Architecture-Application/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devopspradeepyadav%2F3-Tier-Architecture-Application/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275549741,"owners_count":25484687,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-17T02:00:09.119Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-17T06:59:28.088Z","updated_at":"2025-09-17T06:59:29.707Z","avatar_url":"https://github.com/devopspradeepyadav.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **My Three-Tier Web Application Challenge**\n\n## Overview\n\nWelcome to my **Three-Tier Web Application** challenge! This project  is about deploying scalable and robust applications on AWS using **ReactJS**, **NodeJS**, and **MongoDB**. It's a full-stack app, with a backend API, a frontend React app, and a persistent MongoDB database, all running seamlessly on **AWS EKS (Elastic Kubernetes Service)**.\n\nThe goal is:\n\n* Architect and deploy a Three-Tier Web Application\n* Use modern DevOps tools and practices (Terraform, Jenkins, Kubernetes)\n* Manage containerized applications in AWS using EKS\n* Implement CI/CD pipelines for continuous integration and delivery\n* Implement DevSecOps practices for security and vulnerablity testing (Trivy)\n\n\n## **Tech Stack**\n\nHere’s a quick rundown of the core technologies used in this project:\n\n* **Frontend:** ReactJS\n* **Backend:** Node.js (Express)\n* **Database:** MongoDB\n* **Deployment:** AWS EKS (Elastic Kubernetes Service)\n* **CI/CD:** Jenkins \u0026 Terraform\n* **Monitoring:** Prometheus \u0026 Grafana\n* **GitOps:** ArgoCD\n* **Containerization:** Docker\n* **Cloud Services:** AWS (EC2, ECR, IAM, ALB)\n\n![Three-Tier Web Application](assets/Three-Tier.gif)\n\n---\n\n## **Project Structure**\n\nThe repository contains the following key directories:\n\n### **1. Application Code**\n\nThe `Application-Code` directory holds the source code for both the frontend and backend of the application. You’ll find:\n\n* A **Node.js backend API** that handles CRUD operations for a **Todo app**.\n* A **ReactJS frontend** that communicates with the backend API.\n\n### **2. Jenkins Pipeline Code**\n\nInside the `Jenkins-Pipeline-Code` directory, you’ll find Jenkins pipeline scripts designed to automate the build, test, and deployment processes. These scripts ensure that any changes pushed to the repository go through a seamless CI/CD pipeline.\n\n### **3. Jenkins Server Terraform**\n\nThe `Jenkins-Server-TF` directory contains Terraform scripts to deploy a **Jenkins Server** on AWS. This helps automate the deployment and scaling of Jenkins for CI/CD purposes.\n\n### **4. Kubernetes Manifests Files**\n\nThis directory includes Kubernetes manifests required for deploying the app to **AWS EKS**. These manifests define the services, deployments, and ingress needed to run the application in a Kubernetes environment.\n\n---\n\n## **Project Details**\n\nThis project is a **full-stack cloud-native application** that:\n\n* Runs the backend on **AWS EKS**.\n* Utilizes **MongoDB** for data persistence.\n* Incorporates a **ReactJS frontend** that interacts with the backend via REST APIs.\n* Implements **CI/CD pipelines** using Jenkins for automated testing, building, and deploying.\n* Uses **Terraform** to provision AWS infrastructure.\n\nI’ve also incorporated **GitOps** with **ArgoCD** for efficient Kubernetes deployment management.\n\n---\n\n## **Why This Project?**\n\nThis project is a showcase of my ability to:\n\n* Architect scalable web applications using modern tools and practices.\n* Set up **CI/CD pipelines** that automate deployments and reduce manual effort.\n* Work with **AWS services** like EKS, EC2, and ECR to create production-ready cloud infrastructure.\n* Leverage **Kubernetes** for container orchestration and management at scale.\n\n---\n\n## **How to Run the Project**\n\n### **Prerequisites**\n\nBefore you begin, you’ll need:\n\n* An **AWS account** with the necessary permissions to provision EKS, EC2, and other AWS resources.\n* Familiarity with **Docker**, **Kubernetes**, and **AWS**.\n* **Terraform**, **kubectl**, **eksctl**, and **Jenkins** installed.\n\n### **Steps to Set Up**\n\n#### **1. IAM Configuration**\n\n* Create an `eks-admin` IAM user with **AdministratorAccess** and generate **Access Keys**.\n\n```bash\naws iam create-user --user-name eks-admin\naws iam attach-user-policy --user-name eks-admin --policy-arn arn:aws:iam::aws:policy/AdministratorAccess\n```\n\n#### **2. Provision EC2**\n\n* Launch an **Ubuntu EC2 instance** on your preferred AWS region and SSH into it.\n\n```bash\nssh -i your-key.pem ubuntu@your-ec2-public-ip\n```\n\n#### **3. Install Required Tools**\n\n* Install **AWS CLI**, **Docker**, **kubectl**, and **eksctl** on your EC2 instance.\n\n```bash\n# Install AWS CLI\ncurl \"https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip\" -o \"awscliv2.zip\"\nsudo apt install unzip\nunzip awscliv2.zip\nsudo ./aws/install -i /usr/local/aws-cli -b /usr/local/bin --update\n\n# Configure AWS CLI\naws configure\n\n# Install Docker\nsudo apt-get update\nsudo apt install docker.io\ndocker ps\nsudo chown $USER /var/run/docker.sock\n\n# Install kubectl\ncurl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectl\nchmod +x ./kubectl\nsudo mv ./kubectl /usr/local/bin\n\n# Install eksctl\ncurl --silent --location \"https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz\" | tar xz -C /tmp\nsudo mv /tmp/eksctl /usr/local/bin\n```\n\n#### **4. Set up EKS Cluster**\n\nUse **eksctl** to create the EKS cluster and configure `kubectl` to interact with it.\n\n```bash\neksctl create cluster --name three-tier-cluster --region us-west-2 --node-type t2.medium --nodes-min 2 --nodes-max 2\naws eks update-kubeconfig --region us-west-2 --name three-tier-cluster\nkubectl get nodes\n```\n\n#### **5. Deploy the Application**\n\n1. **Create Kubernetes Namespace**:\n\n```bash\nkubectl create namespace workshop\n```\n\n2. **Deploy the App**:\n   Apply the Kubernetes manifests to deploy the application.\n\n```bash\nkubectl apply -f kubernetes-manifests/\n```\n\nTo delete the deployment:\n\n```bash\nkubectl delete -f kubernetes-manifests/\n```\n\n#### **6. Set up CI/CD Pipeline**\n\n1. **Jenkins Pipeline**:\n   The Jenkins pipeline scripts are located in the `Jenkins-Pipeline-Code` directory. You can set up Jenkins to pull these scripts and automate the build and deployment process.\n\n2. **Install Jenkins**:\n   If Jenkins is not already installed, use the following script to install it:\n\n```bash\nsudo apt update\nsudo apt install openjdk-11-jdk\nwget -q -O - https://pkg.jenkins.io/keys/jenkins.io.key | sudo tee /etc/apt/trusted.gpg\necho deb http://pkg.jenkins.io/debian/ / \u003e sudo tee /etc/apt/sources.list.d/jenkins.list\nsudo apt update\nsudo apt install jenkins\n```\n\n3. **Configure Jenkins for CI/CD**:\n   Create and configure the Jenkins pipeline for the backend and frontend components using the scripts found in `Jenkins-Pipeline-Code`.\n\n4. **Push Docker Images to ECR**:\n   Push the backend and frontend images to **AWS ECR** for deployment.\n\n```bash\naws ecr create-repository --repository-name 3tierapp-backend\naws ecr create-repository --repository-name 3tierapp-frontend\n```\n\n#### **7. Install AWS Load Balancer**\n\n1. **Create IAM Policy for Load Balancer**:\n\n```bash\ncurl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.5.4/docs/install/iam_policy.json\naws iam create-policy --policy-name AWSLoadBalancerControllerIAMPolicy --policy-document file://iam_policy.json\n```\n\n2. **Deploy Load Balancer**:\n\n```bash\neksctl utils associate-iam-oidc-provider --region=us-west-2 --cluster=three-tier-cluster --approve\neksctl create iamserviceaccount --cluster=three-tier-cluster --namespace=kube-system --name=aws-load-balancer-controller --role-name AmazonEKSLoadBalancerControllerRole --attach-policy-arn=arn:aws:iam::626072240565:policy/AWSLoadBalancerControllerIAMPolicy --approve --region=us-west-2\n```\n\n3. **Install AWS Load Balancer Controller**:\n\n```bash\nsudo snap install helm --classic\nhelm repo add eks https://aws.github.io/eks-charts\nhelm repo update eks\nhelm install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system --set clusterName=three-tier-cluster --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller\n```\n\n4. **Apply Load Balancer Configuration**:\n\n```bash\nkubectl apply -f full_stack_lb.yaml\n```\n\n#### **8. Cleanup**\n\n* **Delete the EKS Cluster**:\n\n```bash\neksctl delete cluster --name three-tier-cluster --region us-west-2\n```\n\n* **Clean up Resources**:\n\n  * Terminate the EC2 instance.\n  * Delete Load Balancer and associated\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevopspradeepyadav%2F3-tier-architecture-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevopspradeepyadav%2F3-tier-architecture-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevopspradeepyadav%2F3-tier-architecture-application/lists"}