Devops Lab Manual
Devops Lab Manual
A Lab Manual
on
DEVOPS LAB
R22
(III- B. Tech. – II– Semester)
Submitted to
By
Ms.Penugonda Anusha
(Asst Professor, Dept. of CSE (DS))
Mr. Mohsin
(Asst Professor, Dept. of CSE(DS))
(2024-25)
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
CONTENTS
1
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
1. Vision and Mission
2
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
3
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
2.Syllabus
Devops LAB
Course B.Tech.-VI-Sem. L T P C
Course Code 22CDPC66 - - 2 1
4
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
3.Student Entry Behavior or Pre-requisites
These prerequisites are taken by the students during the first two years. However during the initial
sessions the topics are reviewed.
5
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
4.Course Outcomes
6
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
5.Mapping of Course with PEOs-POs
(Only Ticking)
PO Graduate PO Statements
Name Attributes
PO1 Engineering Apply mathematics, science, engineering fundamentals to solve complex
knowledge engineering problems. [PEO’s: 1,2 and 3] [PSO’s: 1,2 ]
PO 2 Problem analysis Identify, formulate and analyze complex engineering problems to reach
substantiated conclusions. [PEO’s: 1,2 and 3] [PSO’s: 1,2 ]
PO 3 Design/ Design and develop a component/system/process to solve complex societal
development of engineering problems. [PEO’s: 1,2 and 3] [PSO’s: 1,2]
solutions
PO 4 Conduct Design and conduct experiments to analyze, interpret and synthesize data for
investigations of valid conclusions. [PEO’s: 1,2 and 3] [PSO’s: 1,2 ]
complex problems
PO 5 Modern tool usage Create, select and apply modern tools, skills, resources to solve complex
engineering problems. [PEO’s: 1,2 and 3] [PSO’s: 1,2 ]
PO 6 The engineer and Apply contextual engineering knowledge to solve societal issues. [PEO’s: 2
society and 3]
PO 7 Environment and Adapt modern engineering practices with environmental safety and
sustainability sustainable development. [PEO’s: 1,2 and 3]
PO 8 Ethics Apply professional code of ethics, responsibilities and norms in engineering
practices. [PEO’s: 1,2 and 3] [PSO’s: 2 ]
PO 11 Project Endorse cognitive management skills to prepare project report using modern
management and tools and finance. [PEO’s: 1 and 3] [PSO’s: 2]
finance
PO 12 Life-long learning Engage in independent and life-long learning in the broad context of
technological changes. [PEO’s: 1,2 and 3] [PSO’s: 1,2 ]
7
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Avg
No Course Outcomes Po1 Po2 Po3 Po4 Po5 Po6 Po7 Po8 Po9 Po10 Po11 Po12
1 CO - 1 3 3 3
2 CO – 2 3 3 3
3 CO – 3 3 3 3
4 CO – 4 3 3 3
5 CO – 5 3 3 3
Avg 3 3 3
8
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
7.Direct Course Assessment
(As mentioned in following table of 10 parameters, of which consider only the parameters required for
this courses)
Actual Course
No Description Targeted Performance Remarks
Performance Attainment
80% of Students(182
Internal Students) should Secure
1
Marks(25) 60% of Internal Marks
i.e., 15 Marks
80% of Students(182
External Students) should Secure
2
Marks(50) 70% of External Marks
i.e., 35 Marks
A minimum of 95% of
Clearing of Students(216 Students)
3
Subject should clear this course
in first attempt
90% of Students(205
Getting First Students) should Secure
4
Class I Class Marks i.e., 45
Marks in my course
80% of Students (182
Students) should secure
5 Distinction First Class With
Distinction i.e., 53 Marks
in my course
60% of Students (137
Students) should secure
Outstanding
6 80% and above Marks.
Performance
i.e., 60 Marks in my
course
9
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
8.Indirect Course Assessment
(As mentioned-strong (3), moderate (2), weak (1) & no comment (0))
Correlation of Mission Elements with Mission Statement of CSE(DS) Department related to the Course
(only Ticking given by faculty)
10
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Indirect Course Assessment through Student Satisfaction Survey
(Note for *: Parameters used for course teaching like
a: Classroom teaching b: Simulations c:labs d: Mini_Projects
e: Major Projects f: Conferences g: professional activities
h: Technical Clubs i: Guest Lectures j: Workshops k: Technical Fests l:Tutorials
m:NPTLs n:Digital Library o: Industrial Visits p: software Tools q:
Internship/training r:Technical Seminars
s: NSS t: NSS u: sports etc.
No Question Based on PEO/ PO/PSO/CO Parameters Strong Moderate (2) Weak No comment
(a /b /c…/)* (3) (1) (0)
1 Did the course impart fundamentals
through interactive learning and
contribute to core competence?
2 Did the course provide the required
knowledge to foster continuous
learning?
3 Whether the syllabus content
anticipates & satisfies the industry and
societal needs?
4 Whether the course focuses on value
based education to be a socially
committed professional?
5 Rate the role of the facilitator in
mentoring and promoting the self
learning abilities to excel academically
and professionally?
6 Rate the methodology adopted and
techniques used in teaching learning
processes?
7 Rate the course in applying sciences &
engineering fundamentals in providing
research based conclusions with the
help of modern tools?
8 Did the course have any scope to
design, develop and test a system or
component?
9 Rate the scope of this course in
addressing cultural, legal, health,
environment and safety issues?
10 Scope of applying management
fundamentals to demonstrate effective
technical project presentations &
report writing?
Total
Average
Total Average
11
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
9.Overall Course Assessment
12
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
10.Pi diagrams, Bar charts, Histograms
13
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
11.Lesson/Course Plan
Text
Week No. Name of the Program Week Mode of Assessment
Books
Start DevOps with a
workflow that includes four By observations, lab records,
1 1 R1
phases: to do, in progress, viva-voice
code review, and done
Setup Eclipse for DevOps. By observations, lab records,
2 2 R1
viva
Jenkins Setup on AWS. By observations, lab records,
3 3 R1
viva
Build WAR file in DevOps. By observations, lab records,
4 4 R1
viva
Ansible Setup and SSH By observations, lab records,
5 5 R1
keys. viva
Deploy the artifact on the Test By observations, lab records,
6 Server. 6 R1
viva
Perform automation using By observations, lab records,
7 7 R1
Jenkins. viva
Build and deploy a grid for By observations, lab records,
8 Chrome and Firefox based 8 R1
viva
testing.
Create deployment resource By observations, lab records,
9 using Kubernetes. 9 R1
viva
Create a docker image for
any application using By observations, lab records,
10 10 R1
Docker file and push it to viva
Docker hub.
Setup Grafana for Devops. By observations, lab records,
11 11 R1
viva
Setup Prometheus for By observations, lab records,
12 12 R1
Devops. viva
14
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
12.Programs
Experiment-1
Aim: Start DevOps with a workflow that includes four phases: to do, in progress, code review, and done.
Require Software& Tools: JIRA, KANBAN.
Procedure:
Phase 1: To Do
Objective: Identify and prioritize tasks or features to be developed.
Key Actions:
o Define tasks clearly in a backlog.
o Prioritize tasks based on impact, urgency, and dependencies.
o Assign owners or teams to each task.
Tools:
Jira, Trello, GitHub Issues, or Asana.
Phase 2: In Progress
Objective: Actively work on tasks selected from the "To Do" phase.
Key Actions:
o Begin coding or configuring based on task requirements.
o Update the task status to reflect ongoing work.
o Ensure team members collaborate effectively (e.g., stand-ups, pair programming).
Best Practices:
Use branches in version control systems for individual tasks (e.g., Git feature branches).
Write unit tests alongside development.
15
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Automation:
Integrate CI/CD pipelines to run tests automatically during reviews.
Phase 4: Done
Objective: Mark tasks as completed and deploy changes if necessary.
Key Actions:
o Merge the approved code into the main branch.
o Deploy to staging or production environments.
o Monitor deployment and validate functionality.
Post-Completion:
Add documentation for the changes.
Gather feedback from stakeholders or users.
Workflow Visualization
A Kanban board or similar visual representation can help track the status of tasks across these phases. For
example:
1. To Do: Contains all pending tasks.
2. In Progress: Tasks currently being worked on.
3. Code Review: Tasks awaiting review or approval.
4. Done: Completed and deployed tasks.
Tools:
Trello, Jira, Azure.
16
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Output:-
17
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Experiment-2
Require Software& Tools: Eclipse, Java jdk-17, Tomcat v.9, TestNG and Dependencies.
Procedure:
Step-1: Install Jdk-17 and set the java path in System environment
Step-2: Download eclipse zipfile and extract the contents the all eclipse file
Step-3:Create a Maven Project from eclipse as:
OR
Click on File in left corner -> Click on new -> click on Maven Project and follow the given image steps.
a.
b.
18
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
19
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
c. In a group id you can type anything like name and in aartefact id: you can type anything like your roll
number
d. Click Finish
e. Type Y and Press enter, You should see a Build Success message as below:
20
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-4:now open your pom.xml file and add your dependencies (Given file, Copy and Paste)
Step-5: Update your project once (Right click on Project -> click on Maven -> click on Update Project)
Step-6: Download Apache tomcat v9 from Official website.
21
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-7: After Download the Apache tomcat, Extract the .zip file and paste your apache-tomcat-9.0.98 folder in
your folder
Step-8: Now click on your project option in Menu -> Click on Properties -> Click on Targeted Runtime
Step-9: Click on new or follow the given image
22
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-11: Click on Browse and Select your Extracted file and then click on finish as given image
23
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
24
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-14:Click on Add ->It will load atestNG Dependencies ->SelectTestNglike given Imageand then click
Next.
It will take 10 minute to update TestNG in our Project
Step-15: After downloading the all dependencies it will show some file select all and click on next.
25
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
26
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-17:After finish it will show restart option (Restart the Project) otherwise just update once of your
project.
Step-18: Now Login yourGitHub Account.
Step-19: Create a New Repository and Copy your Repository and paste in notepad
Step-20: After that Click on your Profile in Right corner -> Click on Setting.
Step-21: It will show a new page, scroll down and select the developer setting ->click on personal access
token ->select Token(Classic) ->click on Generate new token and select Generate new token(Classic) -
27
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
>write your token name and select repo option and scroll down and click on Generate Token. (Follow the
given Image)
28
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-22: After Generating the token copy the token id and paste in aNotePad.
Step-23: Now come on your project and right click on yourproject ->Click on Team ->Click on Share Project.
Step- 24: It will open a Dialog Box forGitHubSetup, select the option Use or create repository in parent
folder of project - >Select your Project and Click on Create Repository and click on Finish.
29
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-25: After that again Right click on yourProject and select the Team -> click on Commit-> and stage
your all file -> and Write a comment (i.e. First Commit) and click on Commit and push-> after that it show an
error dialog ->click OK ->now again click on Push Head Button
30
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
31
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-26: After that again click on Push Head, it will show a dialog like given image, paste your Repository
URL in URL section and type yourGitHub User Id and Password in User, password section -> Click on
preview ->Again clickon Preview.
Step-27:After that it will again show a user Id and Password option ->just type yourGithub id in user section
and paste your Token id in Password section -> click on push ->one more time it will ask user id and
32
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
password just repeat your last step with user id and token id ->now check your repository on github, your
file is uploaded or not
Step-28:Now you have to create a simple java code in SRC File, so first open your project from file manager-
>open SRC - >Create two folder in SRC -> first name: java, second name: test ->now open test folder and
create two more folder in test folder ->now come on your eclipse IDE and Update your project once -> After
that create a java class file with a Statement “Hello World”in your SRC/TEST/java folder.
Step-29:Now Push again your all unstage files in yourGitHubRepositorywith different version or Comment
(Its just for Version Control).
Step-30: Now Check again your Repository your recent file is uploaded or not with different version.
33
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Output:-
34
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Experiment-3
35
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
36
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-4: After Clicking on Launch Instance It will ask Instance Name and Other things -> Write Instance Name
as Jenkins -> Select Application and IOS Image as Ubuntu ->Scroll Down and Come on Instance Type Option
and Select t2.Medium -> Now Come in Key Pair(Login) Section and Click on Create New Key Pair -> Write
your Key Pair Name as Exp3 -> Select RSA -> Select .pem-> Click on Create Key Pair.
37
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-5: After Click on Create Key Pair it will download aExp3.pem file ->After that in Right Side we have a
Option Number of Instances Select 1 -> Click on Launch Instances (It will take some time and will create an
instance).
Step-6: After that Refresh the page -> Select the Created Instance -> Click on Security.
38
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
39
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-7: After Clicking on Security -> It Will Show a Blue Link name as Security Group -> Click on that blue Link
it will Open a Page -> Click On Edit Inbounds rule -> Click on Add Rule -> Add one Rule HTTP and Source
type Anywhere IPV4 ->Addone More Rule Custom TCP, port range 8080 and Source Anywhere IPV4 -> Click
on Save Rule
40
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-7: After that click on Dashboard -> click on instance Running -> select Jenkins -> click on connect.
Step-8: After that click on connect it will open a Linux terminal -> just type clearcommand and follow the setp-9
documents.
41
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-9: Now You have to Setup Jenkins -> Search Jenkins Document in Any Browser ->Click on first Jenkins
link -> Click on Installing Jenkins -> click on Linux -> Click on Debian/Ubuntu -> After that it will show the Linux
Command
42
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-10: Now Come on your MobaXtrem Application -> Type Clear and Hit Enter key ->it will clear your
Command Screen -> Now copy the theLong Term Support release code till /dev/null -> Paste in your Linux
Terminal and hit the Enter Key -> it will Download the Jenkins Support File
sudowget -O /usr/share/keyrings/jenkins-keyring.asc \
Code: https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list> /dev/null
Step-11: Clear your Screen -> Now Update your Project Using Given Code.
Code:
sudoapt-get update
Step-12: clear your screen ->Now Check Java version Using Command: java --version
Step-13: if It Show Java Not Found then it show the option install Java -> so install java using given Command
-> it will ask Y/N just type Y and hit Enter -> It will take some time to download java.
Code:
sudoaptinstall fontconfig openjdk-17-jre
43
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-14: After Downloading the Java, Clear your Screen using clear command -> Once again Update your
Project Using Update Command (follow Step-14 command) -> now Install Jenkins Using Jenkins Command,
i.e given code (It will ask again Y/N just type Y and Hit Enter) -> After Installing the Jenkins Once again Update
your Project using Update Command Just Check Java and Jenkins Version Using (java –version and Jenkins –
version Command)
Code: Sudo apt-get install jenkins
Step-16: After Enable the Jenkins Server Start Jenkins Server Using Given Command
Command:
Sudo systemctl start jenkins
Step-17: After Starting the Jenkins Server Check Jenkins Server Status using Given Command. It will show
the Status Active running ans show the status of memory, CPU etc.
Command:
Sudo systemctl status jenkins
Step-18: Now Open your Any Browser and Search the Jenkins Server using Instance IP and Custom Port
Number (Ip= <your instance ip> port is 8080)follow the given snap
Step-19: It will start the Jenkins Server, show some path with red colorand Ask the Administrator Password
like Given Image.
44
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-20: Copy the RED color path and Paste in your Linux Terminal followed by sudo cat command and hit the
Enter it will show 64-bit Alpha-Nemuric code -> Copy that code and paste in the place of password in your
browser -> click on continue option.
Step-21: After clicking on continue option it will show two option for installing the pluging-> Just click on
installed suggested plugin -> it will take some time for install all plugins -> After installing all plugins, it will ask
Creating an account usinguser ID and password so create an account using user id and password (fill all
related field). -> Click on Save and Continue
45
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-22: After click on Save and continue -> it show some links and show the option Save & Finish -> Click on
Save & Finish -> After that it show Jenkins in Ready and show a option Start using Jenkins -> just click on it ->
It will open a Jenkins Dashboard.
46
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Output:-
OUTPUT
Your Output is the Jenkins Dashboard
47
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Experiment-4
Aim:Ansible Setup and SSH key
(Note: All Blue Words is a command, just copy and paste)
Require Software & Tools: AWS Account, Puttygen software, Wincp Software.
Procedure:
Step-1: Login AWS and Create three Instances on AWS account using ubuntu OS and save key pair
also.
Step-2: change the 2nd and 3rd instance name as a server1 and server2 (you can named anything) ->
Edit inbound rules of 1st instance (ansible). Edit inbound rules like given details.
Step-3: Now come on instance and select 1st instance (ansible) and click on connect. It will open a
linux terminal -> type Clear command.
48
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
49
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-14: Now open winCP software -> it will ask for host name just copy and paste your
ansibleinstance Ip-> In the place of user name type Ubuntu -> click on advance -> select authentication
-> in the place of private key select your downloaded .ppk file - > click on Ok -> click on Login. (it
will connect to your server and show a Ubuntu wincp window)
Note: follow 1 -> 2 -> 3 -> 4 -> 5 arrow.
50
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-15: after connecting to your server it will show two directory (one is your local disk, another is
ssh directory) -> right click in ssh directory -> click on new -> select directory -> create a folder name
as key -> now select your .pemfile from left side local disk directory and drag in your key folder.
Step-16: Now come on in your terminal -> type cd command and hit enter -> type lscommand hit
enter, you will see key.
Step-17: Now type cd key/ and hit enter, you will see ansible.pem
Step-18: Now type cpansible.pem ~/.ssh/ command and hit enter -> after that type cd hit enter -> after
that ls ~/.ssh/ and hit enter, you will see ansible.pem and authorized_key
Step-19: Now create one more directory using mkdiransible-script command and hit enter-> select
directory using cd ansible-script/ command and hit enter.
Step-20: Now write vi inventory.ini command and hit enter -> it will open your Vim Editor -> copy
the given command and paste in your Vim editor -> after that in the place of [server1-ip] copy and
paste server1 instance public ip and in the place of [server2-ip] copy and paste server2 instance public
ip -> after that save this vim editor using :wq! Command and hit enter
Command:
[webservers]
server1 ansible_host=[server1-ip] ansible_user=ubuntuansible_ssh_private_key_file=
/home/ubuntu/.ssh/ansible.pem
server2 ansible_host=[server2-ip] ansible_user=ubuntuansible_ssh_private_key_file=
/home/ubuntu/.ssh/ansible.pem
Step-21: Now write the command vi playbook.ymland create a yml file -> it will again open your Vim
editor -> copy and paste the given command in your vim editor after save and exit using command
:wq! and hit enter.
Command:
Step-22: Now you can check your .ini file and .yml file using cat inventory.ini command and cat
playbook.ymlcommand.
Step-23: Now type ansible-playbook –i playbook.ymlcommand and hit enter.
Step-24: Now type ansible-playbook –i inventory.ini playbook.ymlcommand and hit enter -> it will
ask for type yes and again yes and again yes or may be it will show server Unreachable.
Step-25: Now type cd and hit enter -> after that cd ~/.ssh/ hit enter, you will see
ansible.pemauthorized_key and known_hosts.
Step-26: Now again run the command ansible-playbook –i inventory.ini playbook.yml. it will run your
server or may be it will show again an error server unreachable.
Step-27: If server is reachable is then check your server using server ip otherwise -> write command
chmod 400 ~/.ssh/ansible.pemhit enter -> after that ls –l ~/.ssh/ and hit enter, it will show Ubuntu file.
Step-28: Now again run the command ansible-playbook –i inventory.ini playbook.yml. nowit will run
your server properly. After that you can check your server in any browser using server ip.
OUTPUT:-
52
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
53
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Experiment-5
(Note: All Blue Words is a command, just copy and paste)
Aim:Build War file in Devops
Require Software & Tools: Jenkins, Jdk-17 or jdk-21, Git bash.
Procedure:
Step-1: First open any browser and Search download Jenkins -> click on first link -> scroll down and
click on windows logo -> download will be started.
Step2: First check java jdk in your system, if java is available check the java version using cmd.
otherwise download and install jdk-17.
Step-3: Download Git Bash 64-bit Standalone Installer, and install git bash in your system. After
installation set the git.exe path in your runtime environment.
54
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-4: Now install Jenkins in your system -> click on next and again next -> select run service as
a local system -> click on next and click on Test port -> click on next and click on change and set
the java jdk path -> click on next and again next and click on install.
Step-5: After that install Git Bash in your system (no need to change anything just click on next
next and next till last).
55
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-6: Now open a browser -> search localhost:8080
Step-7: It will open your Jenkins server -> Copy red line location and search it to in your File
manager.
Step-7: It will show open with option just select notepad -> after that copy the password and
paste in Jenkins server -> click on continue -> click on suggested plugin -> it will take some time
for installation -> create admin user using given details and click on save and continue -> after
that click on save and finish -> Click on start using jenkins It will show Jenkins Dashboard.
56
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-8: After that click on manage Jenkins -> click on plugin -> click on available plugin ->
search maven -> select maven integration -> click on install -> scroll down and check maven
integration and and loading plugin is green and success or not -> After success click on go back
to the top page
57
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-9: Now again click on Manage Jenkins -> click on tools -> scroll down and check Git path ->
after that scroll down and in a Maven installation section -> click on add maven -> write maven
name and click on apply -> click on save.
58
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-10: now click on dashboard -> click on create a job -> type your buildwar name (i.e.
myWar) -> select Maven Project -> click on OK
59
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-10: Now take a new page -> login your GitHub -> check second experiment repository like
Devops_pipeline -> copy the git link of second experiment.
Step-11: scroll down and go to Source code management section -> select git -> paste git link ->
scroll down go to build option and type clean install package in goals option -> click on apply ->
click on save.
60
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step-12: After save the file -> it will show an option in left side build now -> click on build now -
> It will take two to five minute for creating build file.
Step-12: After building it will show success with green mark -> click on that section -> it will
open new section -> click on console output -> scroll down and check status, build success or not.
61
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
62
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Output:-
63
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Experiment-6
64
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Above picture three plugins are installed , If not showing please go to available plugins install it.
65
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
66
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
67
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step 5:-Creating New Job for deploy artifact in tomcat test server
1. Create New Item Enter name DeploytoTestServer select freestyle projectclick ok
68
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
2. Select git paste maven project url form GithubMust and should match branches
69
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
4. Go to Build SetupsSelect Invoke top-level Maven targetsMaven Version enter maven Goals
clean install
.
5. Go to Post-build ActionsSelect Deploy war/ear to a containerWAR/EAR files enter
**/*.warselect Containers Tomcat 9.x RemoteAdd credentials like username, password, Id and
description.-->Tomcat URL http://localhost:9090 Apply and save.
70
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
71
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
72
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Output:-
73
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
74
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Experiment-7
75
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Above picture three plugins are installed , If not showing please go to available plugins install
76
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
77
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
78
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step 5:-Creating New Job for deploy artifact in tomcat test server
6. Create New Item Enter name DeployPipeline select pipeline projectclick ok
79
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
}
stages{
stage('clone the repository'){
steps{
git url: 'https://github.com/devisar/Exp2.5.git'
}
}
stage('Build the code'){
steps{
bat 'mvn clean install'
}
}
stage('deploy to tomcat'){
steps{
deploy adapters: [tomcat9(credentialsId: 'Deploy', path: '', url: 'http://localhost:8080')],
contextPath: null, war: '**/*.war'
}
}
80
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
}
}
Step 6:-deploy to tomcat you want to create pipeline script go to pipeline syntaxSelect in sample step
deploy: Deploy war/ear to a container enter war/ear files:**/*.warSelect Containers tomcat 9select
credentials tomcat user name and password. Enter Tomcat Url like http://localhost:9090. Click
Generate Pipeline Script copy and paste it original pipeline deployment stage.
81
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
82
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Build
select console output now you got Successfully Finish.
83
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
84
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Output:-
85
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
86
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Experiment 8
Week 8
AIM:-Build and deploy a grid for Chrome and Firefox based testing.
Step1:- Download Selenium Grid
87
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
88
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Below picture address copy and paste it new tab. Automatically chrome driver
downloded
89
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
90
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Step 5:-Run hub use following command and node also separate cmd. In cmd
change directory where available all drivers
91
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
1. java -jar selenium-server-4.29.0.jar hub
2. java -jar selenium-server-4.29.0.jar node --detect-drivers true
Also run chrome using ip address path it will generate after running hub and verify
92
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
93
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
94
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
95
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
3.Create maven project goto FileNewMaven Project SelectNextselect
org.apache.maven.archetypes select webappEnter Group Id:week7
ArtifactId:selenium Package:warFinish. Enter Y you get Build Success in
console.
96
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
97
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
3. Open Pom.xml copy paste below code this all I added dependies and
plugins. Next Right click ProjectMavenUpdate projectok.
(Note:If you not update every changes it will not save.)
98
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>DevOps</groupId>
<artifactId>MyDevPipeline</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>MyDevPipeline Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!--
https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!--
https://mvnrepository.com/artifact/org.seleniumhq.selenium/seleniu
m-api -->
<dependency>
99
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.141.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version> <!-- Use the latest version
available(7.11.0) -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.3.0</version>
</dependency>
</dependencies>
<build>
<finalName>MyDevPipeline</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<plugin>
100
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-
plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-
plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>17.0.12</source>
<target>17.0.12</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-
plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<plugin>
101
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
102
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
104
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
105
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
106
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
107
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
108
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
109
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
110
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
6.Create Folder inside src test inside java.java folder select build path
current folder.Right click that foldernewothersclassnextgive
package name and class nameok
Java file created copy paste below code.change hub address must and
should.
Same page right clickrunTestNG Finally its run test passes.
SeleniumGridDemo.java
package com.testautomation.grid;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.Test;
import java.net.URL;
111
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
@Test
public void runTestOnChrome() throws Exception {
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
WebDriver driver = new RemoteWebDriver(new URL("
http://172.16.226.24:4444/wd/hub"), capabilities);
driver.get("https://www.google.com");
System.out.println("Page title on Chrome: " + driver.getTitle());
driver.quit();
}
@Test
public void runTestOnFirefox() throws Exception {
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
WebDriver driver = new RemoteWebDriver(new URL("
http://172.16.226.24:4444/wd/hub"), capabilities);
driver.get("https://www.google.com");
System.out.println("Page title on Firefox: " + driver.getTitle());
driver.quit();
}
}
112
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
113
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
114
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
115
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Output:-
116
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Experiment-9
Aim:-Create deployment resource using Kubernetes.
Create the google cloud console free account
It is deducting the 2 rupees from your account and it will give the 330$ free credit points.
117
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Gcloud container clusters list ( no clusters are there)
Once the cluster is created u can see the below message automatically
Now u go and check kubernetes engine--->cluster , you can see the my-cluster is running
To get the list of pods along with ip address and which node the pod is running
119
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Actually u can create the pod using definition file
Create pd-df1.yaml
Vim pd-df1.yaml
apiVersion: v1
kind: Pod
metadata:
name: jenkins-pod
spec:
containers:
- name: myjenkins
image: jenkins/jenkins
ports:
- containerPort: 8080
hostPort: 8080
120
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
121
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Experiment 10
AIM:-Create a docker image for any application using docker file and push it to Docker Hub.
Step 1:-Connecting AWS Instance Ubuntu using Mobaxterm
1. Login AWS(Amazon Web Services) Account
2. Lunch Instance name Docker
3. Connect to Ubuntu or mobaxterm
Above status command is docker running means no problem if not run use command below to run
4. sudo systemctl start docker
122
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
1. Docker deamon is not running.(start docker using “sudo systemctl start docker” )
2. Your user does not have access to run docker commands.
In the above command ubuntu is the name of the user, you can change the username appropriately.
NOTE: : You need to logout and login back for the changes to be reflected.
Start
session
1. Mkdir docker1
2. cd docker1
3. vim app.py
print(“hello world”)
4. cat app.py
123
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
5. vim Dockerfile (below pic commands write lab record) typing command vim before click “i” for insert
data after completion Docker file commands save before click esc use :wq!
se
124
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Output
Hello World
125
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
1. docker login
Step 9:- Push the Image to DockerHub and share it with the world
Output:-
126
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Definitions:-
Docker LifeCycle
We can use the above Image as reference to understand the lifecycle of Docker.
127
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
What is a container ?
A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly
and reliably from one computing environment to another. A Docker container image is a lightweight, standalone,
executable package of software that includes everything needed to run an application: code, runtime, system tools, system
libraries and settings.
What is Docker ?
Docker is a containerization platform that provides easy way to containerize your applications, which means, using Docker
you can build container images, run the images to create containers and also push these containers to container regestries
such as DockerHub
Docker daemon
The Docker daemon (dockerd) listens for Docker API requests and manages Docker objects such as images, containers,
networks, and volumes. A daemon can also communicate with other daemons to manage Docker services.
Docker client
The Docker client (docker) is the primary way that many Docker users interact with Docker. When you use commands such
as docker run, the client sends these commands to dockerd, which carries them out. The docker command uses the
Docker API. The Docker client can communicate with more than one daemon.
Docker Desktop
Docker Desktop is an easy-to-install application for your Mac, Windows or Linux environment that enables you to build
and share containerized applications and microservices. Docker Desktop includes the Docker daemon (dockerd), the
Docker client (docker), Docker Compose, Docker Content Trust, Kubernetes, and Credential Helper. For more information,
see Docker Desktop.
Docker registries
A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker is configured to
look for images on Docker Hub by default. You can even run your own private registry.
When you use the docker pull or docker run commands, the required images are pulled from your configured registry.
When you use the docker push command, your image is pushed to your configured registry. Docker objects
When you use Docker, you are creating and using images, containers, networks, volumes, plugins, and other objects. This
section is a brief overview of some of those objects.
Dockerfile
128
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Dockerfile is a file where you provide the steps to build your Docker Image.
Images
An image is a read-only template with instructions for creating a Docker container. Often, an image is based on another
image, with some additional customization. For example, you may build an image which is based on the ubuntu image,
but installs the Apache web server and your application, as well as the configuration details needed to make your
application run.
129
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
130
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
131
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
132
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
133
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Remote host we want public key and .pem file also so login to AWS Account
134
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
135
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
136
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Here you can Directly connect Ubuntu also but better use mobaxterm
137
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
138
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
139
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
141
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
142
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
143
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
144
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Experiment 11
Aim:-Setup Grafana for Devops.
ACCESS GRAFANA :
kubectl get secret prometheus-grafana -n monitoring -o jsonpath="{.data.admin-user}" | base64 --decode ; echo
If you run the above command u can see the username for grafana (admin)
If you run the abvoe command u can see the password for grafana (prom-operator)
PORT FORWARDING
Click on the web preview give the port no 3000 and click on change and preview u can see the grafana
145
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Output:-
146
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Experiment 12
PROMETHEUS SETUP:
helm repo add prometheus https://prometheus-community.github.io/helm-charts
147
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
148
CMR INSTITUTE OF TECHNOLOGY DEVOPS LAB
Output:-
149