Java Blogging APP
Run in local system
Tools Required
1.Java Development Kit (JDK)
2.Apache Maven
3.Git (Optional)
4.IDE (Optional)
Instructions to Run the Project
Step 1: Clone the Project
git clone
Step 2: Navigate to the Project Directory
cd
Step 3: Verify Java and Maven Installation
java -version
mvn -version
Step 4: Build the Project
mvn clean install
Step 5: Run the Application
mvn spring-boot:run
Step 6: Access the Application
Project Setup in Cloud
Github --> Jenkins --> Compile & Testing --> Trivy Fs Scan --> Quality Gate Check --> SonarQube --> Docker Image create --> Trivy Image Scan --> Docker Container Create
Infra Setup
- VM or EC2 -- AWSCLI, Git
- CICD Server -- Jenkins AND Jenkins Slave -- java, Trivy, Docker
- Code Analisys and Artifact Storage -- SonarQube, Nexus
AWS Instance Creation
We need 2 ubuntu servers with 25GB Storage
- Jenkins(t2.large)
- SonarQube and Nexus (t2.large )
Setup Jenkins
- Install Java
apt-get update
sudo apt install openjdk-17-jdk
- Install Jekins
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins
sudo systemctl start jenkins
- Install Docker
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker jenkins
Restart jenkins
- Install Trivy
sudo apt-get install wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install trivy
- Login Jenkins UI and install pluggins
IP-ADDRESS:8080
sonarqube-scanner
Config file provider
maven integeration
pipeline maven integration maven
nexus artifact uploader
docker
owasp
docke pipeline
eclipse temurin installer
pipeline.stage view
Kub client API
Kub Credentials
Kubernetes
Kub CLI
Kub Credentials provider
Generic webhook trigger
Setp SonarQube and Nexus
- Install Docker
apt install docker.io
sudo usermod -aG docker $USER
newgrp docker
- Create Sonarqube server using Docker image
docker run -d --name sonar -p 9000:9000 --restart=always sonarqube:latest
- Create Nexus Server using Docker image
docker run -d --name nexus -p 8081:8081 -p 5000:5000 --restart=always sonatype/nexus3
- Add Nexus URL in pom.xml
Login to Nexus --> browse --> copy maven releases and maven snapshots ---> paste in URL added in pom.xml
- Edit pom.xml
- Create gloabl maven configuration in jenkins managed files
Goto managed files --> add new config --> select Global Maven settings.xml --> give ID as Global-maven --> add below config under server --> username and password of nexus
-->
<server>
<id>maven-releases</id>
<username>admin</username>
<password>kirancgwd</password>
</server>
<server>
<id>maven-snapshots</id>
<username>admin</username>
<password>kirancgwd</password>
</server>
-->
Add Docker sonarqube Credentials in Jenkins
- Create token in Sonarqube and add in jenkins
- Take Docker registry username and password & add it in Jenkins
- Add Sonar server in Jenkins System configuration by selecting Sonarqube credentials.
Create pipeline using Jenkins Files

