R18 CSM 3-2 Devops
R18 CSM 3-2 Devops
R18 CSM 3-2 Devops
DEVOPS
LABORATORY MANUAL
B.TECH
(III YEAR-II SEM)
PROGRAM OUTCOMES:
PO1: Engineering knowledge: An ability to Apply the knowledge of mathematics, science,
engineering fundamentals and an engineering specialization to the solution of complex engineering
problems.
PO2: Problem analysis: An ability to Identify, formulate, review research literature, and analyze
complex engineering problems reaching substantiated conclusions using first principles of mathematics,
natural science and engineering sciences.
PO3: Design/development of solutions: An ability to 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: An ability to 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: An ability to 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: An ability to 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 sustainability: An ability to Understand the impact of the professional engineering
solutions in the societal and environmental contexts, and demonstrate the knowledge of, and the need
for sustainable development.
PO8: Ethics: An ability to Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.
PO9: Individual and teamwork: An ability to Function effectively as an individual and as a member
or leader in diverse teams, and in multidisciplinary settings.
PO10: Communication: An ability to 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: An ability to 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: Lifelong learning: An ability to Recognize the need for, and have the preparation and ability to
engage in independent and lifelong learning in the broader context of technological change.
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:
At the end of the course, the student will be able to,
• 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.
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:
FROM python:3.8
WORKDIR /app
COPY . .
EXPOSE 5000
return render_template('success.html')
return render_template('register.html')
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.
These steps demonstrate how to use GitHub for source code management.
You can use the same steps to manage any source code projects on GitHub.
Additionally, you can also explore GitHub features such as pull requests,
code review, and branch management to enhance your source code
management workflow.
EXPERIMENT NO: 4. Jenkins installation and setup, explore the
environment
Aim: Jenkins installation and setup, explore the environment
DESCRIPTION
DESCRIPTION
Docker is a containerization technology that is widely used for managing
application containers. Here are some commonly used Docker commands for
content management:
These are some of the basic Docker commands for managing containers and
images. There are many other Docker commands and options that you can
use for more advanced use cases, such as managing networks, volumes, and
configuration. However, these commands should give you a good starting
point for using Docker for content management.
EXPERIMENT NO.: 7. Develop a simple containerized application
using Docker
DESCRIPTION
Choose an application:
DESCRIPTION:
Kubernetes and Docker are both popular technologies for managing
containers, but they are used for different purposes. Kubernetes is an
orchestration platform that provides a higher-level abstractions for managing
containers, while Docker is a containerization technology that provides a
lower-level runtime for containers.
To integrate Kubernetes and Docker, you need to use Docker to build and
package your application as a container image, and then use Kubernetes to
manage and orchestrate the containers.
Use Kubernetes to monitor and manage the containers. This includes scaling
the number of replicas, updating the image, and rolling out updates to the
containers.
• Continuously integrate and deploy changes:
DESCRIPTION
To automate the process of running the containerized application developed
in exercise 7 using Kubernetes, you can follow these steps:
• Create a Kubernetes cluster:
Create a Kubernetes cluster using a cloud provider, such as Google Cloud or
Amazon Web Services, or using a local installation of Minikube.
• Push the Docker image to a registry:
Push the Docker image of your application to a container registry, such as
Docker Hub or Google Container Registry.
• Create a deployment:
Create a deployment in Kubernetes that specifies the number of replicas and
the Docker image to use. Here's an example of 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
• Create a service:
Create a service in Kubernetes that exposes the deployment to the network.
Here's an example of 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
• Apply the deployment and service to the cluster:
Apply the deployment and service to the cluster using the kubectl command-
line tool. For example:
$ kubectl apply -f deployment.yaml
$ kubectl apply -f service.yaml
• Verify the deployment:
Verify the deployment by checking the status of the pods and the service. For
example:
$ kubectl get pods
$ kubectl get services
This is a basic example of how to automate the process of running a
containerized application using Kubernetes. In a real-world scenario, you
would likely have more complex requirements, such as managing persistent
data, scaling, and rolling updates, but this example should give you a good
starting point for using Kubernetes to manage your containers.
EXPERIMENT NO.: 10. Install and Explore Selenium for automated testing
DESCRIPTION:
To install and explore Selenium for automated testing, you can follow these
steps:
• You can download the latest version of the Selenium WebDriver from
the Selenium website. You'll also need to download the appropriate
driver for your web browser of choice (e.g. Chrome Driver for
Google Chrome).
Install an Integrated Development Environment (IDE):
• To write and run Selenium tests, you'll need an IDE. Some popular
choices include Eclipse, IntelliJ IDEA, and Visual Studio Code.
• Write a simple test:
• Once you have your IDE set up, you can write a simple test using the
Selenium WebDriver. Here's an example in Java:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
$ javac Main.java
$ java Main
This is a basic example of how to get started with Selenium for automated
testing. In a real-world scenario, you would likely write more complex tests
and organize your code into test suites and test cases, but this example
should give you a good starting point for exploring Selenium.
EXPERIMENT NO.: 11. Write a simple program in JavaScript and
perform testing using Selenium
PROGRAM:
• Simple JavaScript program that you can test using Selenium
<!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 = document.getElementById("output");
const incrementButton =
document.getElementById("increment-button");
let count = 0;
incrementButton.addEventListener("click", function() {
count += 1;
output.innerHTML = count;
});
</script>
</body>
</html>
@Before
public void setUp() {
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
driver = new ChromeDriver();
}
@Test
public void testIncrementButton() {
driver.get("file:///path/to/program.html");
driver.findElement(By.id("increment-button")).click();
String result = driver.findElement(By.id("output")).getText();
assert result.equals("1");
}
@After
public void tearDown() {
driver.quit();
}
}
You can run the test case using the following command:
$ javac Main.java
$ java Main
The output of the test case should be:
.
Time: 0.189
OK (1 test)
This output indicates that the test case passed, and the increment button was
successfully clicked, causing the output to be incremented by 1.
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:
Here is an example of how you could write test cases for the containerized
application using Selenium
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@Before
public void setUp() {
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
driver = new ChromeDriver();
}
@Test
public void testHomePageLoads() {
driver.get("http://localhost:8080");
String title = driver.getTitle();
assert title.equals("My Containerized Application");
}
@Test
public void testSubmitForm() {
driver.get("http://localhost:8080");
driver.findElement(By.name("name")).sendKeys("John Doe");
driver.findElement(By.name("email")).sendKeys("[email protected]
m");
driver.findElement(By.name("submit")).click();
String result = driver.findElement(By.id("result")).getText();
assert result.equals("Form submitted successfully!");
}
@After
public void tearDown() {
driver.quit();
}
}
You can run the test cases using the following command:
$ javac Main.java
$ java Main
The output of the test cases should be:
..
Time: 1.135
OK (2 tests)
This output indicates that both test cases passed, and the containerized
application is functioning as expected.