0% found this document useful (0 votes)
5 views15 pages

D R22

The document is a DevOps lab manual for the Computer Science and Engineering department at Avanthi Institute of Engineering & Technology, detailing course objectives, outcomes, and a structured syllabus for practical experiments. It includes the vision and mission statements of the institution and department, educational objectives, and outcomes, along with a comprehensive list of experiments related to DevOps practices such as Git, Jenkins, Docker, and Kubernetes. Additionally, it provides guidelines on lab conduct, safety protocols, and specific coding tasks for students to complete.

Uploaded by

chinniglr
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views15 pages

D R22

The document is a DevOps lab manual for the Computer Science and Engineering department at Avanthi Institute of Engineering & Technology, detailing course objectives, outcomes, and a structured syllabus for practical experiments. It includes the vision and mission statements of the institution and department, educational objectives, and outcomes, along with a comprehensive list of experiments related to DevOps practices such as Git, Jenkins, Docker, and Kubernetes. Additionally, it provides guidelines on lab conduct, safety protocols, and specific coding tasks for students to complete.

Uploaded by

chinniglr
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

AVANTHI INSTITUTE OF ENGINEERING & TECHNOLOGY

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING(AL&ML)


HYDERABAD
DEVOPS LAB MANUAL

Subject Code: CS415


Regulation: R18/JNTUH
Academic Year: 2022-23

Prepared By
MUKKAPATI VENU
Assistant Professor
COMPUTER SCIENCE AND ENGINEERING (AL&ML)
AVANTHI INSTITUTE OF ENGINEERING & TECHNOLOGY
Gunthapally (V), Abdullapurmet (M), [Link] -501512
[Link]

=========================================
INDEX OF COURSE FILE
1. Institute vision and mission
2. Department vision and mission/PEO
3. Pos/PSOS
4. Course Syllabus with Structure
5. Course Outcomes(CO)
6. Mapping CO with PO/PSO
7. List of experiment and their CO,PO mapping
8. Time Table
9. Model Practical End Exminational questions
10. Schedule of end practical examinations
11. List of examiners
12. Lab occupancy chart
13. Dos and Don'ts
14. Physical lab floor plan with area in Sq.m
15. Lab Manual
16. Lab Attainments

=========================================
VISION AND MISSION OF THE INSTITUTION
VISION
To develop highly skilled professionals with ethics & human values

MISSION
1. To provide high-quality education along with professional training and exposure to the
workplace.
2. To encourage a professional mindset that goes beyond academic achievement.
3. To promote holistic education among Department students by means of integrated
pedagogy and scholarly mentoring for excellence in both personal and professional
domains.
4. To consistently enhance the teaching and learning procedures in order to prepare
students for successful careers in business or overseas or in further education.
5. To carefully prepare students to be Globally employable professionals who will meet
societal demands and contribute to the nation's technological advancement through their
research and innovative talents.

VISION AND MISSION OF CSE DEPARTMENT


VISION
To become a center of excellence the computer science and information technology
discipline with a strong research and teaching environment.

MISSION
1. To provide qualitative education and generate new knowledge by engaging in cutting
edge research and by offering state of the art undergraduate, post graduate, leading careers
as computer professional in the widely diversified of industry, government and academia.
2. To promote a teaching and learning process that yields advancements in state of art in
computer science and engineering in integration of research result and innovative into
other scientific discipline leading to new products.
3. To harness human capital for sustainable competitive edge and social relevance by
including the philosophy of continuous learning and innovation in computer science and
engineering.
4. To provide inculcate team work, imbibe leadership qualities, professional ethics and
social responsibilities.

=========================================
PROGRAM EDUCATIONAL OBJECTIVES (PEOS):
A graduate of the Computer Science and Engineering Program should:
PEO1. To provide graduate with the academic preparation necessary to be productive and
successful engineers
PEO2. To prepare graduate with the knowledge and skill necessary for interacting
effectively with society.
PEO3. To prepare graduates with in an educational environment shaped to be a good
citizen, for the thoughtful integration of work and life and to view the engineering
profession as a lifelong commitment to serving others.

PROGRAM OUTCOMES (POS):


PO1: Engineering Knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specialization to the solution of complex engineering
problems.
PO2: Problem Analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
PO3: Design/development of solutions: Design solutions for complex engineering problems
and design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.
PO4: Conduct investigations of complex problems: Use research-based knowledge and
research methods including design of experiments, analysis and interpretation of data, and
synthesis of the information to provide valid conclusions.
PO5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modelling to complex
engineering activities with an understanding of the limitations.
PO6: The engineer and society: Apply reasoning informed by the contextual knowledge to
assess societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
PO7: Environment and sustainability: Understand the impact of the professional
engineering solutions in societal and environmental contexts, and demonstrate the
knowledge of, and need for sustainable development.
PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities
and norms of the engineering practice.
PO9: Individual and team work: Function effectively as an individual, and as a member or
leader in diverse teams, and in multidisciplinary settings.
PO10: Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and
write effective reports and design documentation, make effective presentations, and give
and receive clear instructions.
PO11: Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one's own work, as a member
and leader in a team, to manage projects and in multidisciplinary environments.
PO12: Life-long learning: Recognize the need for, and have the preparation and ability to
engage in independent and life-long learning in the broadest context of technological
change.

PROGRAM SPECIFICATION OUTCOMES (PSOS):


PSO1: Design, implement, test and evaluate a computer system, or algorithm to meet
desired needs and to solve a computational problem.
PSO2: Ability to analyze, design and implement hardware and software components.

=========================================
DEVOPS LAB - COURSE SYLLABUS
[Link]. III Year II Sem.
LTPC
0 0 3 1.5

Course Objectives:
- Describe the agile relationship between development and IT operations.
- Understand the skill sets and high-functioning teams involved in DevOps and related
methods to reach a continuous delivery capability.
- Implement automated system update and DevOps lifecycle.

Course Outcomes:
- Identify components of DevOps environment.
- Apply different project management, integration, testing and code deployment tool.
- Investigate different DevOps Software development, models.
- Demonstrate continuous integration and development using Jenkins.

List of Experiments:
1. Write code for a simple user registration form for an event.
2. Explore Git and GitHub commands.
3. Practice Source code management on GitHub. Experiment with the source code written in
exercise 1.
4. Jenkins installation and setup, explore the environment.
5. Demonstrate continuous integration and development using Jenkins.
6. Explore Docker commands for content management.
7. Develop a simple containerized application using Docker.
8. Integrate Kubernetes and Docker.
9. Automate the process of running containerized application developed in exercise 7 using
Kubernetes.
10. Install and Explore Selenium for automated testing.
11. Write a simple program in JavaScript and perform testing using Selenium.
12. Develop test cases for the above containerized application using selenium.

=========================================
DO'S AND DON'TS:
Do's
1. Always be on time. At the start of the lab period, there will be a short introduction to the
experiment you will perform on the particular day.
2. Do keep your lab clean.
3. Before starting any laboratory work, follow all written and verbal instructions carefully.
4. Do inform the instructor and/or TA if there is any problem while performing an
experiment.
5. Be aware of all the safety devices.
6. Keep clutter to a minimum. There is a rack to store your backpacks.
7. Bring your lab notebook to every lab meeting.
8. Perform only those experiments authorized by your teacher. Carefully follow all
instructions, both written and oral.
9. Unauthorized experiments are not allowed in the Laboratory.

Don'ts
1. Do not eat, drink, chew gum, smoke or apply cosmetics in the lab.
2. Do not use the phone or computer with gloves on your hands.
3. Do not wear open-toed shoes (sandals) in the lab.
4. Do not use a flash drive on lab computers.
5. Conduct yourself in a responsible manner at all times in the laboratory.
6. Don't talk aloud or crack jokes in lab.
7. Do not upload, delete or alter any software on the lab PC.
8. Students are not allowed to touch any equipment, chemicals or other materials in the
laboratory area until you are instructed by Teacher or Technician.

=========================================
EXPERIMENT NO: 1
Write code for a simple user registration form for an event.

Aim: Write code for a simple user registration form for an event.
DESCRIPTION:
Here's an example of a simple user registration form using Flask and Docker in DevOps.
Create a Docker file with the following content to create a Docker image for your Flask
application:

FROM python:3.8
WORKDIR /app
COPY . .
RUN pip install --no-cache-dir -r [Link]
EXPOSE 5000
CMD ["python", "[Link]"]

Create a [Link] file with the following content to list the dependencies of your
Flask application:
Flask==1.1.2

Create an [Link] file with the following code for a simple user registration form in Flask:
from flask import Flask, request, render_template
app = Flask(__name__)

@[Link]('/register', methods=['GET', 'POST'])


def register():
if [Link] == 'POST':
name = [Link]['name']
email = [Link]['email']
password = [Link]['password']
# Store the user data in a database or file
return render_template('[Link]')
return render_template('[Link]')

if __name__ == '__main__':
[Link](host='[Link]')
Create an templates folder and add the following two files: [Link] and [Link].
[Link]:
<form method="post">
<input type="text" name="name" placeholder="Name">
<input type="email" name="email" placeholder="Email">
<input type="password" name="password" placeholder="Password">
<input type="submit" value="Submit">
</form>

[Link]:
<h2>Registration Successful</h2>

Build the Docker image for your Flask application using the following command:
docker build -t simple-flask-app .

Run a Docker container from the image using the following command:
docker run -p 5000:5000 simple-flask-app

Open a web browser and access the registration form at [Link]

VIVA QUESTIONS:
- Define Flask in DevOps.

=========================================
EXPERIMENT NO: 2
Explore Git and GitHub commands

Aim: Explore Git and GitHub commands


DESCRIPTION:
Git and GitHub are two of the most popular tools used for version control and collaboration
in software development. Here are some common Git and GitHub commands:
- Initializing a Git repository: $ git init
- Checking the status of your repository: $ git status
- Adding files to the stage: $ git add <file-name>
- Committing changes: $ git commit -m "commit message"
- Checking the commit history: $ git log
- Undoing changes: $ git checkout <file-name>
- Creating a new branch: $ git branch <branch-name>
- Switching to a different branch: $ git checkout <branch-name>
- Merging two branches: $ git merge <branch-name>
- Pushing changes to a remote repository: $ git push origin <branch-name>
- Cloning a repository from GitHub: $ git clone <repository-url>
- Creating a pull request on GitHub: Go to the repository on GitHub, select the branch you
want to merge and click the "New pull request" button.
VIVA QUESTIONS:
- Define Git. What is GitHub?
- Difference between Git & GitHub.

=========================================
EXPERIMENT NO: 3
Practice Source code management on GitHub. Experiment with the source code written in
exercise 1

Aim: Practice Source code management on GitHub. Experiment with the source code
written in exercise 1
Description:
To practice source code management on GitHub, you can follow these steps:
- Create a GitHub account if you don't already have one.
- Create a new repository on GitHub.
- Clone the repository to your local machine: $ git clone <repository-url>
- Move to the repository directory: $ cd <repository-name>
- Create a new file in the repository and add the source code written in exercise 1.
- Stage the changes: $ git add <file-name>
- Commit the changes: $ git commit -m "Added source code for a simple user registration
form"
- Push the changes to the remote repository: $ git push origin master
- Verify that the changes are reflected in the repository on GitHub.

VIVA QUESTIONS:
- What is GitHub management?

=========================================
EXPERIMENT NO: 4
Jenkins installation and setup, explore the environment

Aim: Jenkins installation and setup, explore the environment


DESCRIPTION:
Jenkins is a popular open-source tool for Continuous Integration and Continuous
Deployment (CI/CD) in software development. Here are the steps to install and set up
Jenkins.
1. Download and install Jenkins: Download the Jenkins package for your operating system
from the Jenkins website. Follow the installation instructions for your operating system to
install Jenkins.
2. Start the Jenkins service: On Windows, use the Windows Services Manager. On Linux, use
the command: $ sudo service jenkins start
3. Access the Jenkins web interface: Open a web browser and navigate to
[Link]
4. Initialize the Jenkins environment: Follow the instructions on the Jenkins setup wizard to
initialize the Jenkins environment.
5. Explore the Jenkins environment: Once the Jenkins environment is set up, you can
explore the various features and functionalities available in the web interface.

VIVA QUESTIONS:
- Define Jenkins.

=========================================
EXPERIMENT NO: 5
Demonstrate continuous integration and development using Jenkins.

Aim: Demonstrate continuous integration and development using Jenkins.


DESCRIPTION:
Continuous Integration (CI) and Continuous Development (CD) are important practices in
software development that can be achieved using Jenkins.
1. Create a simple Java application: Create a simple application that prints "Hello World".
2. Commit the code to a Git repository.
3. Create a Jenkins job: Log in to the Jenkins web interface and create a new job. Configure it
to build from the Git repository.
4. Build the application: Trigger a build of the application using the Jenkins job.
5. Monitor the build: Check logs, test results, and status.
6. Deploy the application: Configure the job to deploy the application to a production
environment (e.g., using Docker).
7. Repeat the process for subsequent changes. Jenkins should automatically build and
deploy the changes.

VIVA QUESTIONS:
- Define CD & CI.

=========================================
EXPERIMENT NO: 6
Explore Docker commands for content management.

AIM: Explore Docker commands for content management.


DESCRIPTION:
Docker is a containerization technology that is widely used for managing application
containers. Here are some commonly used Docker commands:
- Docker run: Run a command in a new container. E.g., $ docker run --name mycontainer -it
ubuntu:16.04 /bin/bash
- Docker start: Start one or more stopped containers. E.g., $ docker start mycontainer
- Docker stop: Stop one or more running containers. E.g., $ docker stop mycontainer
- Docker rm: Remove one or more containers. E.g., $ docker rm mycontainer
- Docker ps: List containers. E.g., $ docker ps
- Docker images: List images. E.g., $ docker images
- Docker pull: Pull an image or a repository from a registry. E.g., $ docker pull ubuntu:16.04
- Docker push: Push an image or a repository to a registry. E.g., $ docker push myimage
VIVA QUESTIONS:
- Give briefly about Docker commands.

=========================================
EXPERIMENT NO: 7
Develop a simple containerized application using Docker

AIM: Develop a simple containerized application using Docker


DESCRIPTION:
Here's an example of how you can develop a simple containerized application using Docker:
1. Write a Dockerfile for a Python script:
# Use the official Python image as the base image
FROM python:3.9
# Copy the Python script into the container
COPY [Link] /app/
# Set the working directory
WORKDIR /app/
# Run the Python script when the container starts
CMD ["python", "[Link]"]

2. Build the Docker image:


$ docker build -t myimage .

3. Run the Docker container:


$ docker run --name mycontainer myimage

4. Verify the output:


$ docker logs mycontainer

VIVA QUESTIONS:
- Name applications using Docker.

=========================================
EXPERIMENT NO: 8
Integrate Kubernetes and Docker

AIM: Integrate Kubernetes and Docker


DESCRIPTION:
To integrate Kubernetes and Docker, use Docker to build and package your application as a
container image, and then use Kubernetes to manage and orchestrate the containers.
1. Build a Docker image of your application.
2. Push the Docker image to a registry (e.g., Docker Hub or Google Container Registry).
3. Deploy the Docker image to a Kubernetes cluster by creating a deployment and a service.
4. Monitor and manage the containers using Kubernetes (scaling replicas, updating images).
5. Continuously integrate and deploy changes using a CI/CD pipeline.
Viva questions:
- Define integrate Kubernetes. What is Docker?

=========================================
EXPERIMENT NO: 9
Automate the process of running containerized application developed in exercise 7 using
Kubernetes

AIM: Automate the process of running containerized application developed in exercise 7


using Kubernetes
DESCRIPTION:
1. Create a Kubernetes cluster.
2. Push the Docker image to a registry.
3. Create a deployment YAML file:
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
spec:
replicas: 3
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: myimage
ports:
- containerPort: 80

4. Create a service YAML file:


apiVersion: v1
kind: Service
metadata:
name: myapp-service
spec:
selector:
app: myapp
ports:
- name: http
port: 80
targetPort: 80
type: ClusterIP

5. Apply the deployment and service:


$kubectl apply -f [Link]$ kubectl apply -f [Link]

6. Verify the deployment:


$ kubectl get pods
$ kubectl get services

VIVA QUESTIONS:
- Define Kubernetes.

=========================================
EXPERIMENT NO: 10
Install and Explore Selenium for automated testing

AIM: Install and Explore Selenium for automated testing


DESCRIPTION:
1. Install Java Development Kit (JDK).
2. Install the Selenium WebDriver and browser driver (e.g., ChromeDriver).
3. Install an Integrated Development Environment (IDE) like Eclipse or IntelliJ.
4. Write a simple test in Java:
import [Link];
import [Link];

public class Main {


public static void main(String[] args) {
[Link]("[Link]", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();
[Link]("[Link]
[Link]([Link]());
[Link]();
}
}
5. Run the test:
$javac [Link]$ java Main

=========================================
EXPERIMENT NO: 11
Write a simple program in JavaScript and perform testing using Selenium

AIM: Write a simple program in JavaScript and perform testing using Selenium
PROGRAM:
Simple HTML/JS program:
<!DOCTYPE html>
<html>
<head><title>Simple JavaScript Program</title></head>
<body>
<p id="output">0</p>
<button id="increment-button">Increment</button>
<script>
const output = [Link]("output");
const incrementButton = [Link]("increment-button");
let count = 0;
[Link]("click", function() {
count += 1;
[Link] = count;
});
</script>
</body>
</html>

Test case for this program using Selenium (Java):


import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class Main {


private WebDriver driver;

@Before
public void setup() {
[Link]("[Link]", "path/to/chromedriver");
driver = new ChromeDriver();
}

@Test
public void testIncrementButton() {
[Link]("[Link]
[Link]([Link]("increment-button")).click();
String result = [Link]([Link]("output")).getText();
assert [Link]("1");
}

@After
public void tearDown() {
[Link]();
}
}

VIVA QUESTIONS:
- How can java be useful using selenium.

=========================================
EXPERIMENT NO: 12
Develop test cases for the above containerized application using selenium

AIM: Develop test cases for the above containerized application using selenium
PROGRAM:
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class Main {


private WebDriver driver;

@Before
public void setup() {
[Link]("[Link]", "path/to/chromedriver");
driver = new ChromeDriver();
}

@Test
public void testHomePageLoads() {
[Link]("[Link]
String title = [Link]();
assert [Link]("My Containerized Application");
}

@Test
public void testSubmitForm() {
[Link]("[Link]
[Link]([Link]("name")).sendKeys("John Doe");
[Link]([Link]("email")).sendKeys("[Link]@[Link]");
[Link]([Link]("submit")).click();
String result = [Link]([Link]("result")).getText();
assert [Link]("Form submitted successfully!");
}
@After
public void tearDown() {
[Link]();
}
}

VIVA QUESTIONS:
1. Define selenium.
2. Name the test cases used in selenium.

=========================================
VIVA-VOCE QUESTION & ANSWERS

Q1. What is DevOps?


DevOps is a software development method that combines software development (Dev) and
IT operations (Ops) to encourage collaboration, automation, and ongoing growth.

Q2. What are the fundamental differences between DevOps & Agile?
- Agility: Agile is in Development; DevOps is in Development & Operations.
- Processes: Agile involves Scrum/Kanban; DevOps involves CI, CD, CT.
- Key Focus: Agile focuses on timeliness; DevOps focuses on timeliness & quality equally.

Q3. What is a DevOps Engineer?


A professional who combines expertise in software development, IT operations, and system
administration to facilitate CI/CD, automation, IaC, and smooth workflows.

Q4. What is the need for DevOps?


To increase deployment frequency, lower failure rate of new releases, shorten lead time
between fixes, and have faster mean time to recovery.

Q5. How is DevOps different from Agile / SDLC?


Agile focuses on how to develop software, while DevOps focuses on both development and
deployment in the safest and most reliable way possible.

Q6. Which are the top DevOps tools?


Git (Version Control), Jenkins (CI), Selenium (Testing), Puppet/Chef/Ansible (Config
Management), Nagios (Monitoring), Docker (Containerization).

Q7. How do all these tools work together?


Developers code -> Git -> Jenkins builds via Maven -> Deployed to test environment via
Puppet -> Tested via Selenium -> Deployed to production -> Monitored by Nagios.

Q8. What is the DevOps pipeline?


A CI/CD pipeline that automates steps to integrate, test, and deliver software from
development to production.
Q9. What are the advantages of DevOps?
Technical: Continuous delivery, faster problem resolution. Business: Faster feature delivery,
stable environments, cost savings.

Q10. Mention some core benefits of DevOps?


Faster software development, adaptable to changes, decreased confusion, bridged gap
between Dev and Ops, enhanced customer satisfaction.

Q11. What is the most important thing DevOps helps us achieve?


Getting changes into production as quickly as possible while minimizing risks in software
quality and compliance.

Q12. Explain a use case where DevOps is used in real-life.


Etsy transitioned from a waterfall model with slow deployments to an automated
deployment pipeline, resulting in >50 deployments a day with fewer disruptions.

Q13. What are the anti-patterns of DevOps?


Myths like: DevOps is just a process, Agile equals DevOps, We need a separate DevOps
group, DevOps solves all problems, etc.

Q14. Explain the different phases in DevOps methodology?


Plan -> Code -> Build -> Test -> Integrate -> Deploy -> Operate -> Monitor.

Q15. What are the KPIs used for gauging the success of a DevOps team?
Change Failure rates, Meantime to recovery (MTTR), Lead time, Deployment frequency,
Cycle time, Customer Ticket, Availability, Defect escape rate.

You might also like