Skip to content

Here in this repo i will show the entire CICD pipeline to deploy a code . Here github , jenkins , sonarqube , docker , trivy , dockerhub , argocd , kubernetes , grafana and prometheus will be used .

Notifications You must be signed in to change notification settings

PranitRout07/CICD-Pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STEPS FOLLOWED FOR THE ENTIRE CICD PIPELINE SETUP

1) Created two github repositories.

One repository to store the code and another repository to store the manifest files . The manifest repo is a private repository .

2) Started a Jenkins server at port 8080 and installed some plugins .

Install Plugins

3) Started a sonarqube server at port 9000 .

start sonarqube server

4) Created a token on Sonarqube server ( at adminstration > security > users ).

create token on sonarqube

5) Configure sonarqube server on Jenkins .

Here mentioned the sonarqube server URL and also created a secret text using the token ( created in step 4 ) and added that secret text into the sonarqube server . configure sonarqube server on jenkins

6) Setup Sonarqube scanner on Jenkins .

Here in tools section of manage Jenkins i have configured the sonarqube scanner . Just given the desired version of sonarqube scanner and a name to the scanner . sonarscanner setup on jenkins

7) Setup Quality gate on sonarqube .

On Sonarqube server , at adminstration ? configuration > webhook , added the <jenkins_url>/sonarqube_webhook and a name . quality gate configuration

8) Configure gmail and jenkins integration .

Here i have first created an app password on gmail . created app password on gmail

Then using the app password , created a username and password credential on Jenkins . create id for mail-cred

Then on system of manage jenkins configured the gmail . Here i have mentioned the smtp server and its port as 465 . email configuration on jenkins

9) Integrated dockerhub and Jenkins .

Here created a username and password credential on the Jenkins server . Here i have mentioned my dockerhub account username and the password . Here the username and password can be accessed by using the ID . create dockerhub credentials

10) Integrated Github and Jenkins .

Here first created a personal token on github . created a token on github

Then created a secret text credential by using the github personal token on Jenkins . github credential on jenkins

11) Created a K8s cluster using Kind .

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraPortMappings:
  - containerPort: 32215
    hostPort: 80
  - containerPort: 32216
    hostPort: 8081
- role: worker
created a cluster

12) ArgoCD setup using the private manifest repository .

Here first created argocd namespace . namespace and argocd configured

Then generated the argocd server password . argocd server password

Then port forward the argocd server access to port 8078 . port-forward to 8078

After connecting the argocd server , i have first updated the argocd password . updated argo password

Then connected the manifest repo file using the github manifest repo url , github username and github personal token . connected to manifest repo

Created an application from the connected github repo . created weather app and also give namespace

After this argocd started deploying the manifest files . argo cd started deploying the images

13) Written the Jenkins pipeline code .

created pipeline

14) Started prometheus at port 9090, grafana at port 3000 and blackbox exporter at port 9115 .

Here i have configured the prometheus.yml inside the prometheus container . Here added the some code which will help to scrape the metrics from the blacbox exported and Jenkins . configure prometheus yaml

Then restarted my prometheus container . After this checked the targets in prometheus server . check the targets on prometheus

Then integrated prometheus and grafana . grafana connected to prometheus

15) Now started the my Jenkins pipeline .

It will build the version 1 of my website .

Jenkins Pipeline result:
pipeline successful
Sonarqube result :
sonarqube
Argo CD deploys the version 1 of website :
argo cd automatically deployed
Received the trivy reports and pipeline status on my gmail .
All the successfull stages is received at email trivy scan reports received

16) Updated the code .

Now the website of version 2 . updated to version 2

Jenkins Pipeline result after website code is updated to version 2 :
version 2 pipeline is successful
Argo CD automatically deploys the version of website .

Uploading argo cd version 2 access.png… argo cd deploying version 2

Received status of pipeline on gmail:
successful stages updated trivy reports

17) Accessed the version 2 of website .

version 2 of website

---ALL STEPS COMPLETED----

Manifest files

Here kubernetes secrets is used to store the API_TOKEN . Application runs at port 80 and it is connected to the backend at port 8081 .

Received which stages are failed on gmail while running a demo pipeline .

pipeline failed and their stages

Monitoring results :

Blackbox exporter :

blackbox exporter dashboard 1
uptime

Jenkins :

Jenkins dashboard monitoring 1

About

Here in this repo i will show the entire CICD pipeline to deploy a code . Here github , jenkins , sonarqube , docker , trivy , dockerhub , argocd , kubernetes , grafana and prometheus will be used .

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published