DevSecOps Project: Secure CI/CD Pipeline on Local Ubuntu Using Jenkins, SonarQube & Trivy (100% Free)
A hands-on DevOps project that brings together Jenkins, SonarQube, and Trivy โ all running locally with Docker Compose โ to create a cost-free and secure CI/CD pipeline.
CI/CD is at the heart of modern DevOps. But what if you could build an end-to-end secure pipeline using only open-source tools โ and run everything locally on a single Ubuntu server?
Thatโs exactly what I did โ
In this tutorial, Iโll walk you through setting up a complete DevSecOps pipeline where:
-
๐ง Jenkins handles the automation
-
๐งช SonarQube ensures code quality
-
๐ก๏ธ Trivy scans for vulnerabilities
-
๐ณ Docker Compose manages all containers
-
๐ฅ๏ธ Even the deployment host is the same server, making this setup incredibly efficient and minimal
No external VMs, no cloud cost, no complexity โ just pure DevOps learning ๐ปโจ
-
OS: Ubuntu 20.04+
-
RAM: 8 GB+
-
Tools: Docker, Docker Compose
-
Internet access for pulling images
Before setting up our CI/CD magic, letโs get the project ready by cloning the repository and initializing the required directories and SSH keys.
Start by cloning the DevSecOps project repo that contains our pre-configured docker-compose.yaml and helper scripts:
git clone https://github.com/Abhishek-Kumar-Rai5/Secured-CI-CD-Pipelines.git
cd cicd-jenkinsPress enter or click to view image in full size
This script does two important things:
-
๐ Creates required directories (
jenkins_home,jenkins_agent,jenkins_agent_keys) -
๐ Generates SSH key pairs for Jenkins master โ agent authentication
chmod +x setup.sh
sh setup.shPress enter or click to view image in full size
โ After this, your system is ready to launch the services!
This Docker Compose file orchestrates a fully functional DevSecOps pipeline stack โ all running locally, isolated in a shared network โ and ready to automate builds, scans, and deployments ๐ฅ
version: "3.8"
services:
# ๐ง Jenkins Master
jenkins-master:
image: jenkins/jenkins:lts-jdk17
container_name: jenkins
restart: unless-stopped
user: 1000:1000
ports:
- "8080:8080"
- "50000:50000"
volumes:
- jenkins_home:/var/jenkins_home:rw
- /var/run/docker.sock:/var/run/docker.sock
- /usr/bin/docker:/usr/bin/docker
environment:
- JAVA_OPTS=-Dhudson.security.csrf.GlobalCrumbIssuerStrategy=true -Djenkins.security.SystemReadPermission=true
networks:
- jenkins_network
security_opt:
- no-new-privileges:true
read_only: true
tmpfs:
- /tmp:size=2G
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8080/login || exit 1"]
interval: 1m30s
timeout: 10s
retries: 3
# ๐ง Jenkins SSH Agent
jenkins-agent:
image: jenkins/ssh-agent
container_name: jenkins-agent
restart: unless-stopped
expose:
- "22"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /usr/bin/docker:/usr/bin/docker
- jenkins_agent:/home/jenkins/agent:rw
- type: bind
source: ./jenkins_agent_keys
target: /home/jenkins/.ssh
read_only: true
environment:
- SSH_PUBLIC_KEY_DIR=/home/jenkins/.ssh
networks:
- jenkins_network
security_opt:
- no-new-privileges:true
tmpfs:
- /tmp:size=2G
# ๐ง SonarQube
sonarqube:
container_name: sonarqube
image: sonarqube:lts-community
restart: unless-stopped
depends_on:
- sonar_db
ports:
- "9001:9000"
environment:
SONAR_JDBC_URL: jdbc:postgresql://sonar_db:5432/sonar
SONAR_JDBC_USERNAME: sonar
SONAR_JDBC_PASSWORD: sonar
volumes:
- sonarqube_conf:/opt/sonarqube/conf
- sonarqube_data:/opt/sonarqube/data
- sonarqube_extensions:/opt/sonarqube/extensions
- sonarqube_logs:/opt/sonarqube/logs
- sonarqube_temp:/opt/sonarqube/temp
networks:
- jenkins_network
# ๐ Postgres for SonarQube
sonar_db:
image: postgres:15
restart: unless-stopped
environment:
POSTGRES_USER: sonar
POSTGRES_PASSWORD: sonar
POSTGRES_DB: sonar
volumes:
- sonar_db:/var/lib/postgresql
- sonar_db_data:/var/lib/postgresql/data
networks:
- jenkins_network
# ๐ Shared Network
networks:
jenkins_network:
driver: bridge
# ๐พ Volumes
volumes:
jenkins_home:
jenkins_agent:
sonarqube_conf:
sonarqube_data:
sonarqube_extensions:
sonarqube_logs:
sonarqube_temp:
sonar_db:
sonar_db_data:-
๐ฆ Image: Uses
jenkins/jenkins:lts-jdk17 -
๐ Ports:
-
8080: Jenkins web UI -
50000: For connecting inbound agents -
๐พ Volumes:
-
jenkins_home: Persists Jenkins jobs, config, and plugins -
/var/run/docker.sock: Lets Jenkins build and run Docker containers -
/usr/bin/docker: Gives Jenkins CLI access to Docker commands -
๐งช Health Check:
-
Automatically checks service availability via a
curllogin probe -
๐ Hardened Settings:
-
read_only: true: Makes the container filesystem immutable -
tmpfs: Stores/tmpin RAM for better performance and safety -
no-new-privileges: Prevents privilege escalation inside the container
-
๐ฆ Image: Uses
jenkins/ssh-agent(for connecting back to master) -
๐ SSH Access:
-
Mounts SSH keys from
jenkins_agent_keysto enable secure agent communication -
๐พ Volumes:
-
jenkins_agent: Stores agent workspace data -
/usr/bin/docker+ Docker socket: Enables builds inside the agent container -
๐ก๏ธ Security First:
-
read_only: true+tmpfs: Isolates temp files in RAM -
no-new-privileges: Blocks processes from elevating access
-
๐ฆ Image:
sonarqube:lts-community -
๐ Port Mapping:
-
Exposed as
localhost:9001 โ container:9000 -
๐ Connects to PostgreSQL (
sonar_db) -
Configured via
SONAR_JDBC_URLand credentials -
๐พ Volumes:
-
Persist configuration, extensions, data, logs, and temp files
-
๐ Depends On:
-
Ensures PostgreSQL container starts before SonarQube
-
๐ฆ Image:
postgres:15 -
๐ฏ Purpose: Backend database for SonarQube code analysis data
-
๐ Environment Variables:
-
Sets DB name, user, and password for SonarQube integration
-
๐พ Volumes:
-
sonar_dbandsonar_db_data: Persist DB schema and data
All containers share a custom bridge network, enabling secure internal DNS resolution and private communication between services (like jenkins โ agent โ sonarqube โ postgres).
Now that everything is set, fire up the full stack:
docker-compose up -d
Press enter or click to view image in full size
Once youโve started the stack using docker compose up -d, youโll want to make sure everything is running properly.
๐งช Run this command to check the status of all containers:
docker ps
Press enter or click to view image in full size
โฒ๏ธ Wait 1โ2 minutes, then run docker ps again.
Press enter or click to view image in full size
You should see:
-
๐ข
jenkinscontainer: showinghealthy -
๐ข
jenkins-agentcontainer: up -
๐ง
sonarqube: should also be healthy and accessible atlocalhost:9001
โ Once all containers are up and healthy, youโre ready to configure Jenkins and start building pipelines!
Your Jenkins Master is now running โ letโs unlock the power of automation! ๐
๐ฅ๏ธ Open your browser and go to:
http://localhost:8080
Press enter or click to view image in full size
Youโll be greeted by the Jenkins Setup Wizard ๐งโโ๏ธ
- ๐ Enter the initial admin password
To retrieve the initial admin password for login run the below command
docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassword
Press enter or click to view image in full size
Follow the guided setup: install recommended plugins, create your admin user
Press enter or click to view image in full size
Press enter or click to view image in full size
Once it finished will ask for configure admin user.Click save & continue
Press enter or click to view image in full size
Press enter or click to view image in full size
Once you completed we can see the jenkins dashboard as below
Press enter or click to view image in full size
Now letโs securely configure the SSH authentication so the Jenkins Master can talk to the Jenkins Agent ๐
-
Navigate to your Jenkins dashboard.
-
Click on Manage Jenkins.
-
Select Credentials.
-
Under (global), click Add Credentials.
-
Fill in the form:
-
Kind: SSH Username with private key
-
Scope: Global
-
Username: jenkins
-
Private Key: Enter directly
-
Key: Paste the contents of the
id_rsafile located inside thejenkins_agent_keysfolder. This key is automatically generated during the setup process when you run thesetup.shscript.
Press enter or click to view image in full size
-
ID: can give some name to identify the credential,here i am giving build-agent
-
Description: SSH key for Jenkins agent
-
Click OK to save.
-
In Jenkins, go to Manage Jenkins > Manage Nodes and Clouds.
-
Click New Node.
-
Enter a name (e.g.,
agent), select Permanent Agent, and click create
Press enter or click to view image in full size
- Configure the node:
-
Remote root directory:
/home/jenkins/agent -
Labels:
agent -
Launch method: Launch agents via SSH
-
Host:
jenkins-agent(matches the Docker service name) -
Credentials: Select the credential that you have created earlier
-
Host Key Verification Strategy: Manually trusted key verification Strategy
-
Click Save
Press enter or click to view image in full size
Verify Connection:
- Jenkins will attempt to connect to the agent. If successful, the agentโs status will show as Connected.
Press enter or click to view image in full size
Since we already generated the SSH key pair during the Jenkins setup (via setup.sh), we can reuse the same private key for connecting to the remote host.(in our case it is the same local ubuntu server where we running containers )
โ
Just copy the public key to your host machineโs authorized_keys.
On your host machine, run the following commands:
cat /home/user/devops-projects/cicd-jenkins/jenkins_agent_keys/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
Press enter or click to view image in full size
๐ง This allows Jenkins (via the agent) to SSH into the host machine securely using the existing key โ
These credentials allow Jenkins to SSH into your remote host and trigger Docker Compose commands during deployment.
โก๏ธ Go to Manage Jenkins โ Credentials โ (Global) โ Add Credentials
Then fill out the following fields:
-
Kind: SSH Username with private key
-
Scope: Global
-
Username:
user(or your actual host system username) -
Private Key: Enter directly โ paste the content of
id_rsafromjenkins_agent_keysfolder (generated bysetup.sh) -
ID (optional):
deploy-server-ssh -
Description: Remote host SSH for Docker Compose deployment
โ๏ธ Go to: Manage Jenkins โ Plugins โ Available Pluginsโ Search and Install without restart for each listed plugin below.
๐ง Installs and manages JDK versions for your build environments
๐ Integrates Jenkins with SonarQube to analyze code quality and detect bugs
๐ Allows Jenkins to install and use specific Node.js versions in pipelines
Enables full Docker support in Jenkins โ from simple builds to full pipelines
-
โ Docker Plugin
-
โ Docker Commons
-
โ Docker Pipeline
-
โ Docker API
-
โ Docker Build Step
๐ Use SSH credentials securely to connect and execute on remote machines
Press enter or click to view image in full size
๐ SonarQube is now up and running on port 9001
๐ Open your browser and visit:
๐ http://localhost:9001/
๐ Login using default credentials:
-
Username:
admin -
Password:
admin
Youโll be prompted to change the default password on your first login.
Make sure to choose a strong one! ๐
Press enter or click to view image in full size
-
Log in to SonarQube with the admin user
-
In the top right corner, click your username(Here it is Administrator)โ choose โMy Accountโ.
Press enter or click to view image in full size
-
Go to the โSecurityโ tab.
-
Under Generate Tokens:
-
Name: enter something like
jenkins-global-token -
Type: leave it as User Token
-
Expires In: choose
No expiration(recommended for CI usage)
- Click Generate, and copy the token (you wonโt be able to see it again later).
โ This token allows Jenkins to push analysis results to any project that the user has access to.
Press enter or click to view image in full size
After previous step, youโll see the generated token. Save it somewhere to not loose. Weโll need that for later.
-
๐ Reusable across all projects โ no need to generate separate tokens per project
-
๐งน Easy to manage โ one place to rotate/update
-
โ Secure โ stored in Jenkins as a credential (not hardcoded)
-
โ๏ธ Scalable โ works even as your pipeline or project count grows
-
Navigate to Projects โ Create Project.
-
Select Manually.
Press enter or click to view image in full size
3.Fill:
-
Project Key: blog-app
-
Display Name: blog-app
-
Main branch name: In my case it is main.But in some projects it could be master or dev as well
Press enter or click to view image in full size
4.On the next screen, when youโre asked:
***How do you want to analyze your project?***โ Choose:
Locally
- It will now prompt:
Use existing token๐ Paste your global token here
๐ข DO NOT click Generate Token โ instead, choose โUse existing tokenโ and paste the global one you created in Step 1.
This completes the project setup and links your global token to it.
Press enter or click to view image in full size
Note: You can see the Run analysis on your project options after giving the token.Just ignore the further steps .Will add the necessary commands in Jenkinsfile
-
In Jenkins, go to
Manage Jenkins>Credentials. -
Select the appropriate domain (e.g.,
(global)). -
Click Add Credentials.
-
Choose Secret text as the kind.
-
Paste the SonarQube token into the
Secretfield that we created from the step Create a Global Token in SonarQube -
Provide an ID (e.g., sonar-token) and a description.
-
Click Create to save.
Press enter or click to view image in full size
-
Navigate to
Manage Jenkins>Configure System. -
Scroll down to the SonarQube servers section.
-
Click Add SonarQube.
-
Provide a name for the server (e.g. sonar-server).
-
Enter the SonarQube server URL (
http://sonarqube:9000).
โ Use the Docker container name
sonarqubeโ this works because both Jenkins and SonarQube are running on the same Docker Compose network (jenkins_network), and Docker handles the DNS resolution automatically
6.Server authentication token:
Select the credential ID you created earlier โ e.g., sonar-token
7.Check Enable injection of SonarQube server configuration as build environment variables.
โ โEnable injection of SonarQube server configuration as build environment variablesโ
When checked, Jenkins automatically injects environment variables like:
SONAR_HOST_URL
SONAR_AUTH_TOKEN
SONAR_SCANNER_HOMEThese can then be used inside shell scripts or pipeline steps without hardcoding*.Click* Save to apply the changes.
Press enter or click to view image in full size
To make Jenkins ready for CI/CD magic โจ, we need to equip it with essential tools. These tools empower Jenkins to build, test, scan, and deploy applications across the pipeline.
๐ Navigate to:
Jenkins Dashboard โ Manage Jenkins โ Global Tool Configuration
Now, configure the following:
โ Required for performing static code analysis on your project directly from Jenkins
๐ง Steps to configure:
Navigate to the SonarQube Scanner section โ Click โ Add SonarQube Scanner
๐ท๏ธ Name: sonar-scanner
โ
Check: Install automatically
๐ฝ Installer source: Install from Maven Central
๐ Version: 7.0.2.4839 (or latest available)
๐ Jenkins will now auto-download and manage the SonarQube Scanner version needed for your pipeline.
๐ง This ensures that your pipeline always has a ready-to-go scanner for SonarQube analysis without needing to install anything manually on your host.
Press enter or click to view image in full size
โ Required to compile Java-based projects and run tools like SonarQube Scanner in Jenkins
๐ง Steps to configure:
-
Navigate to the JDK section โ Click โ Add JDK
-
๐ท๏ธ Name:
jdk21 -
โ Check: Install automatically
-
๐ฝ Installer source: Install from adoptium.net
-
๐ Select version:
21.0.4(or latest available under JDK 21)
๐ง This setup ensures Jenkins downloads and uses Java 21 from the official Adoptium build
Press enter or click to view image in full size
โ Required for building frontend applications (React, Vue, Angular) or running JavaScript-based tools in Jenkins
๐ง Steps to configure:
-
Scroll to the NodeJS section โ Click โ Add NodeJS
-
๐ท๏ธ Name:
node21 -
โ Check: Install automatically
-
๐ฝ Installer source: Install from nodejs.org
-
๐ Select version:
21.0.0
๐ง This configuration allows Jenkins to download and manage Node.js v21.0.0 directly from the official Node.js website
Press enter or click to view image in full size
โ Essential for building, running, and scanning Docker containers directly from Jenkins pipelines
๐ง Steps to configure:
-
Scroll to the Docker section โ Click โ Add Docker
-
๐ท๏ธ Name:
docker -
โ Check: Install automatically
-
๐ฝ Installer source: Download from docker.com
-
๐ Select version: (latest available or your preferred Docker version)
๐ง With this setup, Jenkins automatically installs Docker from the official source โ no manual setup or system-level install required.
- Ensure Docker is already installed on your system (
/usr/bin/docker)
๐ Youโve already mounted the Docker socket in your Jenkins Compose file, so this config links Jenkins with the host Docker engine.
Press enter or click to view image in full size
Apply and Save:
- Once all tools are configured, click Apply and Save.
Go to: Docker Hub โ Account Settings โ Security โ Access Tokens
-
Click โ โNew Access Tokenโ
-
Give it a meaningful name (e.g.,
jenkins-ci) -
Click Generate
-
๐ Copy the token (you wonโt see it again!)
Press enter or click to view image in full size
Go to your Jenkins Dashboard:
โก๏ธ Manage Jenkins โ Credentials โ Global Credentials (unrestricted) โ Add Credentials
-
๐ Select: Kind:
Secret text -
โ๏ธ Secret: (Paste the Docker token here)
-
๐ท๏ธ ID:
docker-hub-token(or any unique identifier) -
๐ฌ Description:
Docker Hub Personal Access Token for Jenkins
โ Create it!
Press enter or click to view image in full size
To enable Jenkins (inside the container) to communicate with Docker on the host:
sudo chmod 666 /var/run/docker.sock
Press enter or click to view image in full size
โ ๏ธ Why this is needed?*
This sets read/write permissions on the Docker socket so Jenkins containers can:*
-
๐ณ Build Docker images
-
๐ Scan them with Trivy
-
๐ Push to Docker Hub
๐ก Note*: This is safe for* local testing environments*, but* not recommended for production*.*
๐งญ Wanderlust is a lightweight 3-tier web application designed to demonstrate full CI/CD automation using open-source DevOps tools. It features:
-
Frontend: A modern web UI built with ReactJS (Node.js 21), offering a clean and responsive interface for user interactions.
-
Backend: A RESTful API developed using Node.js and Express.js, handling business logic and communication with the database.
-
Database: MongoDB used as the NoSQL data store for posts or travel-related content.
Now that your DevOps environment is all set ๐ฏ, itโs time to automate your entire workflow โ from code checkout to deployment โ using a Jenkins pipeline.
๐ก What will this pipeline do?
โ
Clone your code from GitHub
โ
Run static code analysis via SonarQube
โ
Perform vulnerability scans with Trivy
โ
Build & push Docker images
โ
Deploy the app โ hands-free!
๐ฅ๏ธ Navigate to Jenkins Dashboard:
-
โ Click on โNew Itemโ
-
๐ท๏ธ Name your project โ e.g.,
wanderlust-deploy -
๐งฑ Choose โPipelineโ as the project type
-
โ Click OK to continue
Press enter or click to view image in full size
Define Pipeline Syntax:
- In the Pipeline section, select Pipeline script and add the following pipeline code:
pipeline {
agent { label 'agent' }
tools {
jdk 'jdk21'
nodejs 'node21'
}
environment {
IMAGE_TAG = "${BUILD_NUMBER}"
BACKEND_IMAGE = "NotHarshhaa/wanderlust-backend"
FRONTEND_IMAGE = "NotHarshhaa/wanderlust-frontend"
}
stages {
stage('SCM Checkout') {
steps {
git branch: 'main', url: 'https://github.com/Abhishek-Kumar-Rai5/Secured-CI-CD-Pipelines.git'
}
}
stage('Install Dependencies') {
steps {
dir('wanderlust-3tier-project/backend') {
sh "npm install || true"
}
dir('wanderlust-3tier-project/frontend') {
sh "npm install"
}
}
}
stage('Run SonarQube') {
environment {
scannerHome = tool 'sonar-scanner'
}
steps {
withSonarQubeEnv('sonar-server') {
sh """
${scannerHome}/bin/sonar-scanner \
-Dsonar.projectKey=blog-app \
-Dsonar.projectName=blog-app \
-Dsonar.sources=wanderlust-3tier-project
"""
}
}
}
stage('Docker Build') {
steps {
dir('wanderlust-3tier-project') {
sh '''
docker build -t ${BACKEND_IMAGE}:${IMAGE_TAG} ./backend
docker build -t ${FRONTEND_IMAGE}:${IMAGE_TAG} ./frontend
'''
}
}
}
stage('Scan with Trivy') {
steps {
script {
def images = [
[name: "${BACKEND_IMAGE}:${IMAGE_TAG}", output: "trivy-backend.txt"],
[name: "${FRONTEND_IMAGE}:${IMAGE_TAG}", output: "trivy-frontend.txt"]
]
for (img in images) {
echo "๐ Scanning ${img.name}..."
sh """
mkdir -p wanderlust-3tier-project
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v \$HOME/.trivy-cache:/root/.cache/ \
-v \$WORKSPACE/wanderlust-3tier-project:/scan-output \
aquasec/trivy image \
--scanners vuln \
--severity HIGH,CRITICAL \
--exit-code 0 \
--format table \
${img.name} > wanderlust-3tier-project/${img.output}
"""
}
}
}
}
stage('Push to Docker Hub') {
steps {
withCredentials([string(credentialsId: 'docker-hub-token', variable: 'DOCKER_TOKEN')]) {
sh '''
echo "${DOCKER_TOKEN}" | docker login -u rjshk013 --password-stdin
docker push ${BACKEND_IMAGE}:${IMAGE_TAG}
docker push ${FRONTEND_IMAGE}:${IMAGE_TAG}
'''
}
}
}
stage('Remote Deploy on Host with Docker Compose') {
steps {
sshagent(credentials: ['deploy-server-ssh']) {
sh '''
echo "๐ Deploying on host with docker compose..."
ssh -o StrictHostKeyChecking=no user@172.18.0.1 '
cd /home/user/devops-projects/wanderlust-3tier-project &&
docker compose build &&
docker compose up -d
'
'''
}
}
}
}
post {
always {
archiveArtifacts artifacts: 'wanderlust-3tier-project/trivy-*.txt', fingerprint: true
}
}
}This Jenkinsfile automates the complete build โ scan โ deploy lifecycle of your Wanderlust project.
Hereโs a step-by-step overview of what it does:
Press enter or click to view image in full size
-
Secure Build: Code quality is validated by SonarQube before proceeding to deployment โ
-
Security First: Images are scanned by Trivy before pushing to Docker Hub ๐ก๏ธ
-
Fully Automated: No manual steps โ from Git pull to live deployment ๐
-
Secrets Handling: Docker Hub credentials and SonarQube token are injected via Jenkins Credentials Manager ๐
Press enter or click to view image in full size
Before using the pipeline, replace the following placeholders with your own values:
-
rjshk013 โ your actual Docker Hub username
-
https://github.com/https://github.com/Abhishek-Kumar-Rai5/Secured-CI-CD-Pipelines.gitโ use the provided repo or your own cloned GitHub repo -
user@172.18.0.1-Replace with your host username & ip
Thatโs it โ just plug in your details and youโre good to go! ๐
Once your Jenkins pipeline is fully configured, itโs time to fire it up! ๐ฅ
๐ ๏ธ Steps to Run the Pipeline:
๐ Go to the Jenkins Dashboard and click on your job (e.g., wanderlust-deploy).
๐ Navigate to โBuild Historyโ, and click on the latest build number (e.g., #1).
๐ In the build details page:
-
โ Click Pipeline Steps or Pipeline Overview to visualize each stage.
-
๐ฅ๏ธ Click Console Output to follow the logs in real-time โ great for debugging and validation.
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
After the pipeline runs successfully, itโs time to verify each key milestone to ensure your CI/CD process worked perfectly.
โ Go to your Docker Hub repository.
๐ Navigate to:
-
wanderlust-backend -
wanderlust-frontend
๐ Check if the latest image tags (build numbers) are successfully listed and match the ones from the Jenkins pipeline.
Press enter or click to view image in full size
๐ Open your browser and go to:
http://localhost:9001 (or your configured SonarQube URL)
๐ Navigate to:
Projectsโblog-app
โ You should see a recent analysis with quality gate status, bugs, code smells, duplications, etc.
Press enter or click to view image in full size
Press enter or click to view image in full size
๐ Go back to Jenkins UI โ your job โ latest build โ Artifacts
๐ Youโll find files like:
-
trivy-backend.txt -
trivy-frontend.txt
๐ Open them and look for:
-
Severity levels:
CRITICAL,HIGH -
Confirm no critical issues OR review and mitigate them accordingly.
๐ Once your CI/CD pipeline has completed successfully, your application is now live and accessible on your host machine. Hereโs how to verify:
๐ Open your browser and go to:
http://localhost:5173/
You should see your React-based frontend app running ๐
Press enter or click to view image in full size
๐ Open another tab and hit:
http://localhost:5000/
To ensure both your frontend and backend services are up and running after deployment, run the following command on your host terminal:
docker ps
Press enter or click to view image in full size
๐๏ธ You can find the complete source code, Jenkinsfile, Docker Compose setup, and scripts used in this article right here:
๐ GitHub โ Secured CI/CD Pipelines
Youโve just built a real-world CI/CD pipeline that:
-
๐ง Automates code building and testing with Jenkins
-
๐ง Ensures code quality through SonarQube
-
๐ก๏ธ Scans for vulnerabilities using Trivy
-
๐ณ Runs entirely in Docker Compose
-
๐ฅ๏ธ Deploys applications seamlessly on the same local server
And the best part? You did it all with zero cloud cost โ 100% open-source, local, and production-grade ready! ๐ฏ
-
๐งช Add unit and integration tests for better quality gates
-
โ๏ธ Try extending this setup to a cloud provider like AWS or Azure
-
๐ Integrate monitoring tools like Prometheus and Grafana
-
๐ฆ Explore Kubernetes and Helm for container orchestration
This setup isnโt just a tutorial โ itโs a launchpad into real-world DevOps workflows. Now youโre equipped to experiment, expand, and evolve your own secure software delivery system ๐๐ป

















































