CSE Semester 06 22CS910 DevOps - Unit II
CSE Semester 06 22CS910 DevOps - Unit II
This document is confidential and intended solely for the educational purpose of RMK
Group of Educational Institutions. If you have received this document through email in
error, please notify the system manager. This document contains proprietary information
and is intended only to the respective group / learning community as intended. If you
are not the addressee you should not disseminate, distribute or copy through e-mail.
Please notify the sender immediately by e-mail if you have received this document by
mistake and delete this document from your system. If you are not the intended
recipient you are notified that disclosing, copying, distributing or taking any action in
reliance on the contents of this information is strictly prohibited.
22CS910 - DevOps
Department : Computer Science & Engineering
Batch / Year : 2022 - 2026 / III
Created by : Mr. S Vijayakumar, Associate Professor / CSE
Date : 15.12.2024
1. Contents
S. No. Contents
1 Contents
2 Course Objectives
3 Prerequisites
4 Syllabus
5 Course Outcomes
6 CO-PO Mapping
7 Lecture Plan
9 Lecture Notes
10 Assignments
12 Part-B Questions
16 Assessment Schedule
5 Branching strategies
6 Merging strategies
8 Revision
9 Revision
2. Course Objectives
22CS910 - DevOps
22IT910
Rest Application Development Using Spring Boot and JPA
22CS402
Web Development Frameworks
22CS301
Advanced Java Programming
22CS202
Java Programming
OBJECTIVES:
The Course will enable learners to:
❖ Bridge the gap between development and operations for faster, more reliable
software releases.
❖ Automate software delivery with CI/CD pipelines.
❖ Package and deploy apps efficiently using Docker containers.
❖ Automate infrastructure with Infrastructure as Code (IaC).
❖ Monitor and troubleshoot applications in production.
UNIT I Introduction to DEVOPS 9
collaboration.
applications.
PO PO PO PO PO PO PO PO PO PO PO PO PS PS PS
COs 1 2 3 4 5 6 7 8 9 10 11 12 O1 O2 O3
CO1 3 3 3 2 2 2 1 1
CO2 3 3 3 2 2 2 1 1
CO3 3 3 3 2 2 2 1 1
CO4 3 3 3 2 2 2 1 1
CO5 3 3 3 2 2 2 1 1
7. Lecture Plan - Unit I
No.
S. of Proposed Actual Pertaining Taxonomy Mode of
Topic
No. Period Date Lecture CO Level Delivery
s Date
Build production-
1 CO2 Chalk &
grade applications 1 K2
Talk
MYSQL - mapping
2 Java classes to 1 CO2
K3
Chalk &
relational database Talk
Introduction to Git
3
version control 1 CO2
K3
Chalk &
system Talk
Collaboration
7 using Git 1 CO2
K2
Chalk &
workflows Talk
8 Revision 1 CO2
K3
Chalk &
Talk
9 Revision 1 CO2
K2
Chalk &
Talk
8. Activity Based Learning
Learning Method Activity
@Column(name = "name")
private String name;
@Column(name = "email")
private String email;
session.save(user);
session.getTransaction().commit();
session.close();
6. DevOps Integration
Automation: Automate database setup and migrations with tools like Flyway
or Liquibase.
CI/CD: Integrate database schema management into your pipeline.
Testing: Use in-memory databases like H2 for unit testing.
The Practice helps to use the CData JDBC Driver for Azure DevOps to
generate an ORM of your Azure DevOps repository with Hibernate.
Install Hibernate
Follow the steps below to install the Hibernate plug-in in Eclipse.
1. In Eclipse, navigate to Help -> Install New Software.
2. Enter "http://download.jboss.org/jbosstools/neon/stable/updates/" in the Work With
box.
3. Enter "Hibernate" into the filter box.
4. Select Hibernate Tools.
jdbc:azuredevops:AuthScheme=Basic;Organization=MyAzureDevOpsOrgani
zation;ProjectId=MyProjectId;PersonalAccessToken=MyPAT;InitiateOAu
th=GETANDREFRESH
cdata.azuredevops.AzureDevOpsDriver
jdbc:azuredevops:AuthScheme=Basic;Organization=MyAzureDevOpsOrgani
zation;ProjectId=MyProjectId;PersonalAccessToken=MyPAT;InitiateOAu
th=GETANDREFRESH org.hibernate.dialect.SQLServerDialect
Execute SQL
Using the entity you created from the last step, you can now search Azure DevOps data:
1. import java.util.*;
2. import org.hibernate.Session;
3. import org.hibernate.cfg.Configuration;
4. import org.hibernate.query.Query;
5. public class App {
6. public static void main(final String[] args) {
7. Session session = new
8. Configuration().configure().buildSessionFactory().openSession();
9. String SELECT = "FROM Builds B WHERE Reason = :Reason";
10. Query q = session.createQuery(SELECT, Builds.class);
11. q.setParameter("Reason","Manual");
12. List<Builds> resultList = (List<Builds>) q.list();
1. for(Builds s: resultList){
2. System.out.println(s.getId());
3. System.out.println(s.getBuildNumber());
4. }
5. }
6. }
2.3 Introduction to Git Version Control System
Git is an open source distributed version control system that
helps software teams create projects of all sizes with efficiency, speed, and
asynchronicity. Git is known for its speed, workflow compatibility, and open
source foundation.
Most Git actions only add data to the database, and Git makes it easy to
undo changes during the three main states.
Git has three file states: modified, staged, and committed.
A modified file has been changed but isn't committed to the database yet.
A staged file is set to go into the next commit.
When a file is committed, the data has been stored in the database.
With Git, software teams can experiment without worrying that
they'll create lasting damage to the source code, because teams can always
revert to a previous version if there are any problems.
Version control also known as source control or revision control
is software used to track revisions, solve integration conflicts in code, and
manage different artifacts involved in software projects (e.g. design, data,
images). Version control also enables frictionless communication, change,
and reproducibility between developers and other team members.
With version control, it is able to track and merge branches, audit
changes, and enable concurrent work to accelerate software delivery. Version
control is the foundation and the stepping stone of DevOps, software
architecture, and release patterns, without which an org cannot start. Using
version control results in remarkable team productivity and software quality
improvements.
Need to use Git Version Control
Software development teams prefer Git over other version control systems,
like CVS, Mercurial, and Perforce, because Git has the adaptability, speed,
and stability. Git version control is the simplest way to empower developers,
Also supports to quickly meet customer demand and business goals.
The benefits of Git
The Version Control System is very helpful and beneficial in software
development; developing software without using version control is unsafe. It
provides backups for uncertainty. Version control systems offer a speedy
interface to developers. It also allows software teams to preserve efficiency
and agility according to the team scales to include more developers.
Git is fast
Users have a local repository on their machine with a full history, so there's
no lag in communicating with a server, which is an experience that users of
centralized systems, such as CVS, Subversion, and Perforce, often encounter.
Git is reliable
Git inherently has multiple backups, because each user has a local repository.
If there's a crash, a copy could replace the main server. Another benefit of
local repositories is that users can continue to commit offline if they're
traveling or dealing with network issues.
Git is collaborative
Git makes collaborative development easy with its branching model. People
on your team can create a branch, experiment, and merge the code to the
main branch if it works well.
Some key benefits of having a version control system are as
follows.
Complete change history of the file
Simultaneously working
Branching and merging
Traceability
Types of Version Control System
1. Localized Version Control Systems
2. Centralized Version Control Systems
3. Distributed Version Control Systems
Localized Version Control Systems
The localized version control method is a common approach because of its
simplicity. But this approach leads to a higher chance of error. In this
approach, you may forget which directory you're in and accidentally write to
the wrong file or copy over files you don't want to.
To deal with this issue, programmers developed local VCSs that had a simple
database. Such databases kept all the changes to files under revision control.
A local version control system keeps local copies of the files.
The major drawback of Local VCS is that it has a single point of failure.
Gitflow Workflow
GitFlow enables parallel development, where developers can work
separately on feature branches, where a feature branch is created from
a master branch. After completion of changes, the feature branch is merged
with the master branch.
The types of branches that can be present in GitFlow are:
Master - Used for product release
Develop - Used for ongoing development
Feature Branching - branches off the develop branch to develop new
features.
Release - Assist in preparing a new production release and bug fixing,
typically branched from the develop branch, and necessitating merges back
into both develop and master branches.
Hotfix - Hotfix branches aid in addressing discovered bugs swiftly, allowing
developers to continue their work on the develop branch while the issue is
resolved. Unlike release branches, hotfix branches are created from master
branch specifically for critical bug resolution in the production release.
The Master and Develop branches are the main branches, and
persist throughout the journey of the software. The other branches are
essentially supporting branches and are short-lived.
Advantages
1. Facilitates parallel development, ensuring production code stability while
developers work on separate branches.
2. Organizes work effectively with separate branches for specific purposes.
3. Ideal for managing multiple versions of production code.
4. GitFlow streamlines the release management process, expediting the
rollout of new features and bug fixes.
5. GitFlow offers a well-defined procedure for addressing bugs and
deploying hotfixes, facilitating their rapid integration into production
environments.
Disadvantages
1. Complexity increases as more branches are added, potentially leading to
difficulties in management.
2. Merging changes from development branches to the main branch
requires multiple steps, increasing the chance of errors and merge
conflicts.
3. Debugging issues becomes challenging due to the extensive commit
history.
2.6 Merging Strategies
A merge in Git is the process of integrating changes from one
branch into another. This is a common practice in collaborative projects
where multiple developers work on different features or bug fixes in separate
branches. Merging helps combine their efforts into the main branch, usually
known as main or master.
Git provides several merge strategies, each suited for different
scenarios. The choice of strategy depends on the complexity of changes and
the desired outcome. Here are the most commonly used merge strategies:
1. Fast Forward Merge:
Fast-forward merge occurs when the target branch has not diverged from
the source branch. In this case, Git simply moves the target branch pointer
to the latest commit in the source branch. This strategy is simple and keeps
the commit history linear.
Command:
git checkout main
git merge feature-branch
2. Recursive Merge:
Recursive merge is Git’s default strategy for non-trivial merges. It handles
cases where branches have diverged by creating a new merge commit. This
commit records the combined changes from both branches, preserving the
history of both lines of development.
Command:
$ git merge--no-ff
3. Octopus Merge:
Octopus merge is used for merging more than two branches
simultaneously. It’s less common and typically used for automated merges
involving multiple feature branches.
Octopus Merge strategy resolves cases with more than two heads but refuses
to do a complex merge that needs manual resolution. It is primarily meant to
be used for bundling topic branch heads together. This is the default merge
strategy when pulling or merging more than one branch.
Command:
$ git merge -s octopus
4. Three-Way Merge
A three-way merge involves comparing three commits: the two branch tips
and their common ancestor. Git uses this information to create a new merge
commit that restore the differences.
Use Case: Useful when dealing with more complex merges involving
multiple branches and several changes.
5. Squash and Merge
Squash and merge squashes all the commits from a feature branch into a
single commit before merging into the target branch. This strategy simplifies
the commit history, making it easier to follow.
Use Case: Ideal for merging feature branches with numerous small
commits, resulting in a cleaner main branch history.
git checkout main
git merge --squash feature-branch
git commit -m "Merged feature-branch with squash“
6. Rebase and Merge
Rebase and merge rewrites the commit history of the feature branch,
placing it on top of the main branch before merging. This results in a linear
commit history without merge commits.
Use Case: Suitable for maintaining a clean and linear project history,
especially in projects with strict commit guidelines.
git checkout feature-branch
git rebase main
git checkout main
git merge feature-branch
2.7 Collaboration using Git workflows.
• Local Version Control System: A simple form of VCS that uses a database to
keep track of changes to files
• Centralized Version Control System: A system with a single repository where
all users must commit to reflect their changes
• Distributed Version Control System: A system where each developer has a
full copy of the repository on their computer, allowing them to work offline
14. What are some examples of Version Control System ? (CO2, K2)
Online Courses
1. https://www.coursera.org/learn/introduction-to-microsoft-
github-copilot
2. https://www.coursera.org/learn/introduction-git-github
3. ttps://www.coursera.org/learn/introduction-to-microsoft-github-
copilot
4. https://www.udemy.com/course/github-git/
1. https://www.w3schools.com/git/
2. https://www.javatpoint.com/git
3. https://www.geeksforgeeks.org/version-control-systems/
14. Real Time Applications
Here are some DevOps tools that use Version Control and other
technologies to help with real-time applications:
1. Git : A version control system that helps development teams track and
manage changes to their codebase.
2. GitHub Actions : Allows developers to automate repetitive tasks, such as
testing, building, and deploying software.
3. Docker : A lightweight tool that helps DevOps teams design, ship, and
operate container-based distributed applications
4. Ansible : A tool for orchestration, automation, configuration, and
managing IT infrastructures
5. Erraform : An IaC tool that helps you deploy and manage your
infrastructure using a declarative language
6. Chef : Provides a simple language for describing infrastructure, allowing
you to specify how each component should be configured.
7. Gradle : A build automation tool that automates the process of creating
applications
8. Nagios : An open-source monitoring system that helps organizations
monitor and manage their IT infrastructure.
9. Splunk : A real-time data monitoring tool that provides insights across all
the stages of the delivery lifecycle.
15. Content Beyond Syllabus
DevOps Application and Use Cases
Automation Testing :
Automation Testing is a crucial aspect of DevOps, enabling
teams to automatically run a suite of tests against the application with
every code change. Automated tests include unit tests, integration
tests, and end-to-end tests that help identify and fix bugs early,
reducing the chances of introducing defects into the production
environment. By automating the testing process, developers can
iterate faster, ensure better code quality, and maintain a high level of
confidence in the application's performance and functionality.
Infrastructure as Code (IaC):
Infrastructure as Code (IaC) is a DevOps practice that
involves defining and managing infrastructure elements, such as
servers, networks, and databases, through machine-readable
configuration files. These files are version-controlled and treated like
code, allowing teams to automate the provisioning and configuration
of infrastructure. IaC provides numerous benefits, including
consistency in environments, easier replication, faster recovery from
failures, and improved collaboration between development and
operations teams.
Microservices Deployment:
Microservices Deployment is a software architecture
approach where applications are built as a collection of small, loosely
coupled services. Each service represents a specific business capability
and can be developed, deployed, and scaled independently. DevOps
plays a critical role in managing the deployment of microservices,
ensuring seamless integration and continuous delivery of new
features.
15. Content Beyond Syllabus
This approach fosters scalability, flexibility, and faster
development cycles, making it ideal for complex and rapidly evolving
applications.
Containerization with Docker:
Containerization with Docker has revolutionized the way
applications are deployed and managed. Docker allows developers to
package applications and their dependencies into lightweight, portable
containers, ensuring consistency across different
environments. DevOps teams leverage Docker to streamline the
deployment process, simplify versioning, and reduce the risk of
environment-related issues. Containerization also enables efficient
resource utilization, making it easier to scale applications as needed.
Monitoring and Logging:
Monitoring and Logging are crucial components of
any DevOps practice. These tools provide real-time visibility into the
application's performance, resource utilization, and potential issues. By
proactively monitoring application metrics and logs, DevOps teams can
identify bottlenecks, detect anomalies, and respond to incidents
promptly. Continuous monitoring helps maintain high availability,
optimal performance, and a positive user experience. These practices
and applications can be easily mastered by enrolling in any practical-
based DevOps certification training course.
Collaborative Development:
DevOps promotes a culture of collaboration and cross-
functional teamwork. Collaboration tools, such as chat platforms and
issue trackers, facilitate effective communication between developers
15. Content Beyond Syllabus
operations, and other stakeholders. By breaking down silos and
encouraging knowledge sharing, DevOps empowers teams to align
their efforts, tackle challenges together, and deliver value to
customers more efficiently.
Security and Compliance:
Security is a top priority in software development, and
DevOps actively incorporates security measures throughout the
development process. Security professionals work closely with
development teams to identify and address vulnerabilities early in the
software development lifecycle. This ensures that security is not an
afterthought but an integral part of the application's design and
implementation. Additionally, DevOps helps organizations maintain
compliance with relevant regulations and industry standards.
Cloud Infrastructure Management:
DevOps thrives in cloud environments, where it leverages
cloud services to manage and scale infrastructure resources
dynamically. Cloud providers offer a wide range of services that
facilitate automation, scalability, and cost optimization. DevOps
engineers can easily spin up new environments, provision resources as
needed, and manage infrastructure as code, providing the flexibility
required to adapt to changing business requirements. A practical-
based DevOps course can make you master cloud infrastructure
management.
Application Performance Optimization:
Through meticulous monitoring and analysis, DevOps
identifies performance bottlenecks in applications and takes targeted
optimization measures. By fine-tuning the codebase, optimizing
15. Content Beyond Syllabus
database queries, and adjusting resource allocation, DevOps ensures
that applications deliver a smooth and responsive user experience.
The result is improved application performance, reduced latency, and
increased customer satisfaction.
Streamlined Incident Management:
In a fast-paced digital landscape, incidents are bound to
occur. DevOps enables rapid detection, response, and resolution of
incidents through automated incident management processes. Teams
receive real-time alerts, and automated remediation actions are
triggered, reducing downtime and mitigating the impact on users.
Incident management becomes more proactive and efficient, ensuring
that services are restored promptly.
Enhanced Customer Experience:
At the heart of every DevOps effort lies the goal of
delivering an exceptional customer experience. By incorporating
customer feedback, deploying bug fixes promptly, and maintaining
high application performance, DevOps ensures that end-users receive
a product that meets their expectations. An enhanced customer
experience leads to increased user satisfaction, loyalty, and positive
word-of-mouth, driving business growth.
16. Assessment Schedule
S. Name of the
Start Date End Date Portion
No. Assessment
TEXTBOOKS:
1. Deepak Gaikwad, Viral Thakkar, "DevOps Tools: from Practitioner's
Point of View", Wiley, 2019.
2. Jennifer Davis, Ryn Daniels, "Effective DevOps", O'Reilly Media, 2016.
REFERENCES:
1. Gene Kim, Jez Humble, Patrick Debois, "The DevOps Handbook: How
to Create World-Class Agility, Reliability, and Security in Technology
Organizations", IT Revolution Press, 2016.
2. Jez Humble, Gene Kim, "Continuous Delivery: Reliable Software
Releases Through Build, Test, and Deployment Automation", Addison-
Wesley, 2010.
3. Yevgeniy Brikman, "Terraform: Up & Running: Writing Infrastructure
as Code", O'Reilly Media, 2019.
4. Joseph Muli, "Beginning DevOps with Docker", Packt Publishing, 2018.
18. Mini Project Suggestions
Disclaimer:
This document is confidential and intended solely for the educational purpose of RMK Group of
Educational Institutions. If you have received this document through email in error, please notify the
system manager. This document contains proprietary information and is intended only to the
respective group / learning community as intended. If you are not the addressee you should not
disseminate, distribute or copy through e-mail. Please notify the sender immediately by e-mail if you
have received this document by mistake and delete this document from your system. If you are not
the intended recipient you are notified that disclosing, copying, distributing or taking any action in
reliance on the contents of this information is strictly prohibited.