This project demonstrates how to set up an end-to-end CI/CD pipeline for a sample Java-based Shopping Cart web application.
My contribution is focused on building the DevOps workflow – installing and configuring tools, setting up Jenkins pipelines, Dockerizing the application, integrating SonarQube for quality analysis, and deploying the containerized app.
Code → GitHub → Jenkins CI Pipeline → SonarQube → Maven Build → Docker Image Build & Push → Jenkins CD Pipeline → Deployment
- AWS EC2 (t2.medium)
- Jenkins – CI/CD automation
- Maven – Build tool
- Git – Source code management
- SonarQube – Code quality & static analysis
- Docker – Containerization & deployment
- Docker Hub – Container registry
- Launch a t2.medium EC2 instance (Amazon Linux 2).
- Connect via SSH.
sudo wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
sudo yum upgrade -y
sudo dnf install java-17-amazon-corretto -y
sudo yum install jenkins -y
sudo systemctl daemon-reload
sudo systemctl enable jenkins
sudo systemctl start jenkinsAccess Jenkins at: http://<EC2-Public-IP>:8080
sudo yum install docker -y
sudo systemctl enable docker
sudo systemctl start docker(Docker installed and service enabled.)
sudo yum install git -y(Git installed.)
docker run -d -p 9000:9000 sonarqube:lts-community- Open in browser:
http://<EC2-Public-IP>:9000 - Default credentials:
- username:
admin - password:
admin(you’ll be prompted to update)
- username:
- Generate a SonarQube token from:
Administration → Security → Users → Update Tokens → Generate Token Use this token in Jenkins CI pipeline configuration.
Install the following plugins:
- OpenJDK / Eclipse Temurin Installer
- SonarQube Scanner for Jenkins
- Docker Pipeline
- Docker Build Step
- CloudBees Docker Build and Publish
Configure these global tools in Jenkins:
- JDK
- Maven
- SonarQube Scanner
- Docker
By default, Jenkins cannot access the Docker daemon. Add Jenkins user to the Docker group:
sudo usermod -aG docker jenkins
sudo systemctl restart jenkinsVerify:
groups jenkins→ should list docker.
If container already exists:
docker rm -f shopping-cartOnce deployed, the shopping cart application is available at:
URL: http://<EC2-Public-IP>:8070/home
-
Admin Login
- Username:
admin - Password:
admin
- Username:
-
User Login
- Username:
user - Password:
password
- Username:
- Setting up Jenkins and integrating with GitHub
- Using SonarQube for code quality analysis
- Dockerizing applications and pushing to Docker Hub
- Managing Jenkins-to-Docker permissions
- Deploying and accessing a Java web application in containers