{"id":33235912,"url":"https://github.com/sm-simplifies/myweb","last_synced_at":"2025-11-16T18:03:00.307Z","repository":{"id":321940626,"uuid":"1087691446","full_name":"sm-simplifies/myweb","owner":"sm-simplifies","description":"AWS EKS + Jenkins CI/CD — Project ","archived":false,"fork":false,"pushed_at":"2025-11-10T06:25:02.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-10T08:19:15.505Z","etag":null,"topics":["aws","aws-ec2","aws-eks","aws-eks-cluster","docker","dockerhub","git","github","jenkins","jenkinspipeline","kubectl","kubernetes","kubernetes-cluster","kubernetes-deployment"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sm-simplifies.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-11-01T12:51:29.000Z","updated_at":"2025-11-10T06:25:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab0cf361-7def-462b-85b0-6ba8d9d444b1","html_url":"https://github.com/sm-simplifies/myweb","commit_stats":null,"previous_names":["sm-simplifies/myweb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sm-simplifies/myweb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sm-simplifies%2Fmyweb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sm-simplifies%2Fmyweb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sm-simplifies%2Fmyweb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sm-simplifies%2Fmyweb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sm-simplifies","download_url":"https://codeload.github.com/sm-simplifies/myweb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sm-simplifies%2Fmyweb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284750955,"owners_count":27057456,"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-11-16T02:00:05.974Z","response_time":65,"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":["aws","aws-ec2","aws-eks","aws-eks-cluster","docker","dockerhub","git","github","jenkins","jenkinspipeline","kubectl","kubernetes","kubernetes-cluster","kubernetes-deployment"],"created_at":"2025-11-16T18:01:48.021Z","updated_at":"2025-11-16T18:03:00.299Z","avatar_url":"https://github.com/sm-simplifies.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca id=\"top\"\u003e\u003c/a\u003e\r\n# 🚀 AWS EKS + Jenkins CI/CD — Project Workflow Execution.\r\n\r\n\u003e **Repository:** [myweb](https://github.com/sm-simplifies/myweb.git)\r\n\r\n---\r\n\r\n## 🧩 About the Project\r\nThis project demonstrates a **DevOps pipeline** integrating **Jenkins**, **Docker**, and **AWS EKS (Kubernetes)** to achieve **Continuous Integration and Continuous Deployment (CI/CD)** for a Java web application. The application is containerized using **Tomcat**, monitored with **Prometheus** and **Grafana**, and automatically deployed to **EKS** using a Jenkins pipeline.\r\n\r\n---\r\n\r\n## 📚 Table of Contents\r\n1. [Overview](#overview)\r\n2. [Prerequisites](#prerequisites)\r\n3. [Prepare AWS and IAM](#prepare-aws-and-iam)\r\n4. [Launch EC2 for Jenkins](#launch-ec2-for-jenkins)\r\n5. [Install Required Software](#install-required-software)\r\n6. [Configure Jenkins](#configure-jenkins)\r\n7. [Create IAM Roles for EKS](#create-iam-roles-for-eks)\r\n8. [Create EKS Cluster](#create-eks-cluster)\r\n9. [Jenkins Pipeline Explanation](#jenkins-pipeline-explanation)\r\n10. [Run \u0026 Verify Deployment](#verify-deployment)\r\n11. [Troubleshooting](#troubleshooting)\r\n12. [Appendix: Files](#appendix-files)\r\n\r\n---\r\n\r\n\u003ca id=\"overview\"\u003e\u003c/a\u003e\r\n## 🧭 Overview\r\n- 🔁 **Jenkins** automates: Code → Build → Dockerize → Push → Deploy.\r\n- 🐳 **Docker Hub** hosts the built image (`smicx20/myweb-image`).\r\n- ☸️ **AWS EKS** runs the application in Kubernetes pods.\r\n- 📊 **Prometheus** and **Grafana** provide monitoring and visualization.\r\n\r\n---\r\n\r\n\u003ca id=\"prerequisites\"\u003e\u003c/a\u003e\r\n## ⚙️ Prerequisites\r\n- ✅ AWS Account with required permissions (EC2, EKS, IAM).\r\n- ✅ Docker Hub account: `mayrhatte09`.\r\n- ✅ GitHub repository: [myweb](https://github.com/sm-simplifies/myweb.git).\r\n- ✅ Local setup or EC2 instance with AWS CLI and kubectl installed.\r\n\r\n---\r\n\r\n\u003ca id=\"prepare-aws-and-iam\"\u003e\u003c/a\u003e\r\n## 🧱 1. Prepare AWS and IAM\r\n1. Go to **AWS Console → IAM**.\r\n2. Create an **IAM User** with *programmatic access*.\r\n3. Save **Access Key ID** and **Secret Key**.\r\n4. Attach permissions for EC2, EKS, and S3.\r\n5. These credentials will later be used for Jenkins configuration.\r\n\r\n---\r\n\r\n\u003ca id=\"launch-ec2-for-jenkins\"\u003e\u003c/a\u003e\r\n## ☁️ 2. Launch EC2 for Jenkins\r\n| Parameter | Value |\r\n|------------|-------|\r\n| **AMI** | Amazon Linux 2 |\r\n| **Instance Type** | t3.large |\r\n| **Storage** | 30 GiB |\r\n| **Ports** | 22 (SSH), 8080 (Jenkins), 80/443 (optional) |\r\n\r\n🔑 Create or select an SSH key pair for EC2 access.\r\n\r\n---\r\n\r\n\u003ca id=\"install-required-software\"\u003e\u003c/a\u003e\r\n## 🧰 3. Install Required Software\r\nSSH into EC2 and run:\r\n\r\n```bash\r\nsudo yum update -y\r\nsudo yum install -y java-11-amazon-corretto docker maven\r\n\r\n# Jenkins setup\r\nsudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo\r\nsudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key\r\nsudo yum install -y jenkins\r\nsudo systemctl enable --now jenkins\r\n\r\n# Docker permissions\r\nsudo systemctl enable --now docker\r\nsudo usermod -aG docker jenkins\r\n\r\n# kubectl installation\r\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl\"\r\nsudo chmod +x kubectl\r\nsudo mv kubectl /usr/bin/\r\n\r\nsudo usermod -s /bin/bash jenkins\r\ngrep jenkins /etc/passwd\r\n```\r\n\r\n🌐 Access Jenkins: `http://\u003cEC2_PUBLIC_IP\u003e:8080`\r\n\r\n---\r\n\r\n\u003ca id=\"configure-jenkins\"\u003e\u003c/a\u003e\r\n## 🧩 4. Configure Jenkins\r\n1. Unlock Jenkins using `/var/lib/jenkins/secrets/initialAdminPassword`.\r\n2. Install **recommended plugins** (Git, Pipeline, Docker Pipeline, Kubernetes).\r\n3. Add credentials:\r\n   - 🐳 **Docker Hub:** Username \u0026 password → ID: `dockerhub-pass`\r\n\r\n---\r\n\r\n\u003ca id=\"create-iam-roles-for-eks\"\u003e\u003c/a\u003e\r\n## 🔐 5. Create IAM Roles for EKS\r\n1. **Master Role:** Use case → EKS Cluster.\r\n2. **Worker Node Role:** Use case → EC2.\r\n   - Attach policies:\r\n     - `AmazonEKS_CNI_Policy`\r\n     - `AmazonEC2ContainerRegistryReadOnly`\r\n     - `AmazonEKSWorkerNodePolicy`\r\n\r\n---\r\n\r\n\u003ca id=\"create-eks-cluster\"\u003e\u003c/a\u003e\r\n## ☸️ 6. Create EKS Cluster\r\n```bash\r\neksctl create cluster \\\r\n  --name moster-node \\\r\n  --version 1.27 \\\r\n  --region ap-southeast-1 \\\r\n  --nodegroup-name worker-nodes \\\r\n  --node-type t3.medium \\\r\n  --nodes 2 \\\r\n  --nodes-min 2 \\\r\n  --nodes-max 3\r\n```\r\n\r\nThen configure:\r\n```bash\r\naws eks update-kubeconfig --region ap-southeast-1 --name master-node\r\nkubectl get nodes\r\n```\r\n\r\n---\r\n\r\n\u003ca id=\"jenkins-pipeline-explanation\"\u003e\u003c/a\u003e\r\n## 🧩 7. Jenkins Pipeline Explanation\r\n\r\nThe provided Jenkinsfile stages: \r\n- Git Checkout: clone the repo. \r\n- Maven Build: mvn clean package to produce the WAR. \r\n- Docker Build: build image myweb-image:v${BUILD_NUMBER} . \r\n- Docker Login \u0026 Push: login to Docker Hub (credential dockerhub-pass), tag and push. \r\n- Update Deployment File: update deployments.yaml to new tag using sed. \r\n- Kubernetes Deployment: apply deployments.yaml \r\nImportant Jenkins credential IDs used in the Jenkinsfile must match those created earlier.\r\n\r\n---\r\n\r\n\u003ca id=\"verify-deployment\"\u003e\u003c/a\u003e\r\n## ✅ 8. Run \u0026 Verify Deployment\r\n1. Run Jenkins pipeline.\r\n2. Check Docker Hub for image tag `v{BUILD_NUMBER}`.\r\n3. Validate deployment:\r\n   ```bash\r\n   kubectl get pods -o wide\r\n   kubectl get svc\r\n   ```\r\n4. 🌐 Access app: `http://\u003cWorkernode_EC2_PUBLIC_IP\u003e:NodePort_Number`\r\n\r\n---\r\n\r\n\u003ca id=\"troubleshooting\"\u003e\u003c/a\u003e\r\n## 🧠 9. Troubleshooting\r\n| Problem | Fix |\r\n|----------|------|\r\n| **ImagePullBackOff** | Ensure image tag matches Docker Hub tag. |\r\n| **kubectl not found** | Confirm `/usr/bin/kubectl` exists \u0026 executable. |\r\n| **Permission denied (Docker)** | Restart Jenkins after `usermod -aG docker jenkins`. |\r\n| **AWS CLI error** | Re-run `aws configure` with correct keys. |\r\n| **Pods stuck pending** | Verify node role and subnet permissions. |\r\n\r\n---\r\n\r\n\u003ca id=\"appendix-files\"\u003e\u003c/a\u003e\r\n## 📁 Appendix: Files\r\n\r\n### [deployments.yaml](https://github.com/sm-simplifies/myweb/blob/769f01e33e9ccb480add79c2e53623c73c4f3c67/deployments.yaml)\r\n\r\n### [dockerfile](https://github.com/sm-simplifies/myweb/blob/d599e1ec9bb6a1248017a6e0b379b98a8b690fcc/dockerfile)\r\n\r\n### [jenkinsfile](https://github.com/sm-simplifies/myweb/blob/abfff0a0b5145fdd37d6211759c0496b228d84cc/jenkinsfile)\r\n\r\n---\r\n\r\n## 👨‍💻 Author\r\n**Swapnil Mali** — AWS \u0026 DevOps Engineer  \r\n💡 *\"Knowledge should spread!\"* 💪\r\n\r\n---\r\n\r\n[TOP](#top)\r\n\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsm-simplifies%2Fmyweb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsm-simplifies%2Fmyweb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsm-simplifies%2Fmyweb/lists"}