DevOps Study
DevOps Study
What is DevOps?
DevOps word in itself is a combination of two words one is “Development,” and the other
is “Operations.” It is neither an application nor a tool; instead, it is just a culture that
collaboratively promotes development and operation. As a result of DevOps
implementation, the speed to deliver applications and services has increased.
i). Development
This is the first stage of the DevOps lifecycle in which applications' development occurs
constantly. The entire development process is broken down into small steps or
development cycles. As a result of this, the speed of software development and delivery is
increased.
ii). Testing
Selenium-like testing tools are used to speed up the overall testing process by quickly
identifying errors and fixing bugs.
iii). Integration
New functionalities are integrated with the prevailing code, and new code tes
iv). Deployment
Continuous deployment is part of the DevOps lifecycle. When it is performed in the right
way, then it can affect the overall functioning of a high-traffic website.
v). Monitoring
Inappropriate system behaviour is managed by monitoring. Through proper monitoring,
the bugs are found and fixed in a hassle-free way.
-------------------------------------------------------------------------------------
SDLC Model: -
Ans: -
Agile SDLC model is a combination of iterative and incremental process models with focus
on process adaptability and customer satisfaction by rapid delivery of working software
product. Agile Methods break the product into small incremental builds. These builds are
provided in iterations. Each iteration typically lasts from about one to three weeks. Every
iteration involves cross functional teams working simultaneously on various areas like −
Planning
Requirements Analysis
Design
Coding
Unit Testing and
Acceptance Testing.
At the end of the iteration, a working product is displayed to the customer and important
stakeholders.
-----------------------------------------------------------------------------------------------
What is Agile?
Agile model believes that every project needs to be handled differently and the existing
methods need to be tailored to best suit the project requirements. In Agile, the tasks are
divided to time boxes (small time frames) to deliver specific features for a release.
Iterative approach is taken and working software build is delivered after each iteration.
Each build is incremental in terms of features; the final build holds all the features required
by the customer.
Here is a graphical illustration of the Agile Model −
Following are the Agile Manifesto principles −
• Individuals and interactions − In Agile development, self-organization and
motivation are important, as are interactions like co-location and pair
programming.
• Working software − Demo working software is considered the best means of
communication with the customers to understand their requirements, instead
of just depending on documentation.
• Customer collaboration − As the requirements cannot be gathered
completely in the beginning of the project due to various factors, continuous
customer interaction is very important to get proper product requirements.
• Responding to change − Agile Development is focused on quick responses to
change and continuous development.
ITIL: -
ITIL, or Information Technology Infrastructure Library, is a well-known set of IT best
practices designed to assist businesses in aligning their IT services with customer
and business needs. Services include IT-related assets, accessibility, and resources
that deliver value and benefits to customers.
------------------------------------------------------------------------------------
Difference between Agile and DevOps
-------------------------------------------------------------------------------------
DevOps Tools
1.Docker
Docker is a high-end DevOps tool that allows building, ship, and run distributed
applications on multiple systems. It also helps to assemble the apps quickly from the
components, and it is typically suitable for container management.
Features
• It configures the system more comfortable and faster.
• It increases productivity.
• It provides containers that are used to run the application in an isolated
environment.
• It routes the incoming request for published ports on available nodes to an active
container. This feature enables the connection even if there is no task running on
the node.
• It allows saving secrets into the swarm itself.
2. CHEF
A chef is a useful tool for achieving scale, speed, and consistency. The chef is a cloud-
based system and open-source technology. This technology uses Ruby encoding to
develop essential building blocks such as recipes and cookbooks. The chef is used in
infrastructure automation and helps in reducing manual and repetitive tasks for
infrastructure management.
Chef has got its convention for different building blocks, which are required to manage
and automate infrastructure.
Features
• It maintains high availability.
• It can manage multiple cloud environments.
• It uses popular Ruby language to create a domain-specific language.
• The chef does not make any assumptions about the current status of the node. It
uses its mechanism to get the current state of the machine.
3. Git
Git is an open-source distributed version control system that is freely available for
everyone. It is designed to handle minor to major projects with speed and efficiency. It is
developed to co-ordinate the work among programmers. The version control allows you
to track and work together with your team members at the same workspace. It is used as
a critical distributed version-control for the DevOps tool.
Features
• It is a free open-source tool.
• It allows distributed development.
• It supports the pull request.
• It enables a faster release cycle.
• Git is very scalable.
• It is very secure and completes the tasks very fast.
4. Selenium
Selenium is a portable software testing framework for web applications. It provides an
easy interface for developing automated tests.
Features
• It is a free open-source tool.
• It supports multiplatform for testing, such as Android and ios.
• It is easy to build a keyword-driven framework for a WebDriver.
• It creates robust browser-based regression automation suites and tests.
-------------------------------------------------------------------------------------
Command Function
du Display usage
-------------------------------------------------------------------------------------
What Is Git?
What is GitHub?
• GitHub is a Git repository hosting service. GitHub also facilitates with many of its
features, such as access control and collaboration. It provides a Web-based
graphical interface.
• GitHub is an American company. It hosts source code of your project in the form
of different programming languages and keeps track of the various changes
made by programmers.
• It offers both distributed version control and source code management (SCM)
functionality of Git. It also facilitates with some collaboration features such as
bug tracking, feature requests, task management for every project.
-------------------------------------------------------------------------------------
Version control systems are a category of software tools that helps in recording changes
made to files by keeping a track of modifications done in the code.
Types of Version Control Systems:
• Local Version Control Systems
• Centralized Version Control Systems
• Distributed Version Control Systems
Local Version Control Systems: It is one of the simplest forms and has a database that
kept all the changes to files under revision control. RCS is one of the most common VCS
tools. It keeps patch sets (differences between files) in a special format on disk. By adding
up all the patches it can then re-create what any file looked like at any point in time.
Centralized Version Control Systems: Centralized version control systems contain just one
repository globally and every user need to commit for reflecting one’s changes in the
repository. It is possible for others to see your changes by updating.
Two things are required to make your changes visible to others which are:
• You commit
• They update
• You commit
• You push
• They pull
• They update
-------------------------------------------------------------------------------------
Working In CVS, a client need to get local In DVS, each client can have a local
copy of source from server, do branch as well and have a complete
1 the changes and commit those history on it. Client need to push the
changes to centeral source on changes to branch which will then be
server. pushed to server repository.
Learning CVS systems are easy to learn DVS systems are difficult for beginners.
2 Curve and set up. Multiple commands needs to be
remembered.
Offline CVS system do not provide DVD systems are workable offline as a
4 Access offline access. client copies the entire repository on
their local machine.
Speed CVS is slower as every DVS is faster as mostly user deals with
5 command need to local copy without hitting server
communicate with server. everytime.
-------------------------------------------------------------------------------------
Creating New Repository
You can store a variety of projects in GitHub repositories, including open-source projects.
With open-source projects, you can share code to make better, more reliable software.
You can use repositories to collaborate with others and track your work. For more
information, see "About repositories." To learn more about open-source projects, visit
OpenSource.org.
• In the upper-right corner of any page, use the drop-down menu, and select new
repository.
• Type a short, memorable name for your repository. For example, "hello-world".
• Optionally, add a description of your repository. For example, "My first repository
on GitHub."
• Choose a repository visibility. For more information, see "About repositories."
• Select Initialize this repository with a README.
• Click Create repository.
OR
So now we have two branches, our main branch, referred to as master, and our newly
created cart branch.
Another Branch
We are now working in our cart branch, but let's say we have found a bug on our main
site. At this point, we should create a new branch:
We can work on our fix without disturbing the site, and commit it to our bugfix branch:
Merging a Branch
We have tested the fix and we are happy, so let's merge this change into master. But first,
we need to switch back to our master branch:
We will want to remove the branch from our remote repository as well.
-------------------------------------------------------------------------------------
POM is an acronym for Project Object Model. The pom.xml file contains information of
project and configuration information for the maven to build the project such as
dependencies, build directory, source directory, test source directory, plugin, goals etc.
Maven reads the pom.xml file, then executes the goal.
Before maven 2, it was named as project.xml file. But, since maven 2 (also in maven 3), it
is renamed as pom.xml.
-------------------------------------------------------------------------------------
Maven Lifecycle:
Maven is a powerful project management tool that is based on POM (project object
model), used for project build, dependency, and documentation. It is a tool that can be
used for building and managing any Java-based project. Maven makes the day-to-day
work of Java developers easier and helps with the building and running of any Java-based
project.
For more details on how Maven works, how to install Maven and its applications, please
visit: Introduction to Apache Maven
Maven Lifecycle: Below is a representation of the default Maven lifecycle and its 8 steps:
Validate, Compile, Test, Package, Integration test, Verify, Install, and Deploy.
The default Maven lifecycle consists of 8 major steps or phases for compiling, testing,
building and installing a given Java project as specified below:
1. Validate: This step validates if the project structure is correct. For example – It
checks if all the dependencies have been downloaded and are available in the local
repository.
2. Compile: It compiles the source code, converts the .java files to .class, and stores
the classes in the target/classes folder.
3. Test: It runs unit tests for the project.
4. Package: This step packages the compiled code in a distributable format like JAR or
WAR.
5. Integration test: It runs the integration tests for the project.
6. Verify: This step runs checks to verify that the project is valid and meets the quality
standards.
7. Install: This step installs the packaged code to the local Maven repository.
8. Deploy: It copies the packaged code to the remote repository for sharing it with
other developers.
-------------------------------------------------------------------------------------
Maven Commands
• mvn clean: Cleans the project and removes all files generated by the
previous build.
• mvn compile: Compiles source code of the project.
• mvn test-compile: Compiles the test source code.
• mvn test: Runs tests for the project.
• mvn package: Creates JAR or WAR file for the project to convert it into a
distributable format.
• mvn install: Deploys the packaged JAR/ WAR file to the local repository.
• mvn site: generate the project documentation.
• mvn validate: validate the project’s POM and configuration.
• mvn idea:idea: generate project files for IntelliJ IDEA or Eclipse.
• mvn release:perform: Performs a release build.
• mvn deploy: Copies the packaged JAR/ WAR file to the remote
repository after compiling, running tests and building the project.
• mvn archetype:generate: This command is used to generate a new
project from an archetype, which is a template for a project. This
command is typically used to create new projects based on a specific
pattern or structure.
• mvn dependency:tree: This command is used to display the
dependencies of the project in a tree format. This command is typically
used to understand the dependencies of the project and troubleshoot
any issues.
-------------------------------------------------------------------------------------
Maven Plugins
The maven plugins are central part of maven framework, it is used to perform specific
goal.
According to Apache Maven, there are 2 types of maven plugins.
1. Build Plugins
2. Reporting Plugins
Build Plugins
These plugins are executed at the time of build. These plugins should be declared inside
the <build> element.
Reporting Plugins
These plugins are executed at the time of site generation. These plugins should be
declared inside the <reporting> element.
Plugin Description
resources copies the resources to the output directory for including in the JAR.
site generates a site for the current project.
-------------------------------------------------------------------------------------
1. Docker Client
Docker client uses commands and REST APIs to communicate with the Docker Daemon
(Server). When a client runs any docker command on the docker client terminal, the
client terminal sends these docker commands to the Docker daemon. Docker daemon
receives these commands from the docker client in the form of command and REST API's
request.
Docker Client uses Command Line Interface (CLI) to run the following commands
• docker build
• docker pull
• docker run
2. Docker Host
Docker Host is used to provide an environment to execute and run applications. It
contains the docker daemon, images, containers, networks, and storage.
3. Docker Registry
Docker Registry manages and stores the Docker images.
There are two types of registries in the Docker -
• Pubic Registry - Public Registry is also called as Docker hub.
• Private Registry - It is used to share images within the enterprise.
Docker Images
Docker images are the read-only binary templates used to create Docker Containers. It
uses a private container registry to share container images within the enterprise and also
uses public container registry to share container images within the whole world.
Metadata is also used by docket images to describe the container's abilities.
Docker Containers
Containers are the structural units of Docker, which is used to hold the entire package
that is needed to run the application. The advantage of containers is that it requires very
less resources.
In other words, we can say that the image is a template, and the container is a copy of
that template.
Docker Networking
Using Docker Networking, an isolated package can be communicated. Docker contains the
following network drivers -
o Bridge - Bridge is a default network driver for the container. It is used when multiple
docker communicates with the same docker host.
o Host - It is used when we don't need for network isolation between the container
and the host.
o None - It disables all the networking.
o Overlay - Overlay offers Swarm services to communicate with each other. It enables
containers to run on the different docker host.
o Macvlan - Macvlan is used when we want to assign MAC addresses to the containers.
Docker Storage
Docker Storage is used to store data on the container. Docker offers the following options
for the Storage -
o Data Volume - Data Volume provides the ability to create persistence storage. It also
allows us to name volumes, list volumes, and containers associates with the
volumes.
o Directory Mounts - It is one of the best options for docker storage. It mounts a host's
directory into a container.
o Storage Plugins - It provides an ability to connect to external storage platforms.
-------------------------------------------------------------------------------------
Docker Hub
Features
• Storage, management, and sharing of images with others are made simple via
Docker Hub.
• Docker Hub runs the necessary security checks on our images and generates a full
report on any security flaws.
• Docker Hub can automate the processes like Continuous deployment and
Continuous testing by triggering the Webhooks when the new image is pushed into
Docker Hub.
• With the help of Docker Hub, we can manage the permission for the users, teams,
and organizations.
• We can integrate Docker Hub into our tools like GitHub, Jenkins which makes
workflows easy
-------------------------------------------------------------------------------------
Docker Vs Virtualization
Docker Virtualization
It is lightweight. It is heavyweight.
Can run many docker containers on a Cannot run more than a couple of VMS on an
laptop. average laptop.
Sharing of files is possible. Sharing library and files are not possible.
What is Chef?
Chef is an open-source technology developed by Opscode. Adam Jacob, co-founder of
Opscode is known as the founder of Chef. This technology uses Ruby encoding to develop
basic building blocks like recipe and cookbooks. Chef is used in infrastructure automation
and helps in reducing manual and repetitive tasks for infrastructure management.
Chef have got its own convention for different building blocks, which are required to
manage and automate infrastructure.
Data Bag in Chef:
Chef data bags can be defined as an arbitrary collection of data which one can use with
cookbooks. Using data bags is very helpful when one does not wish to hardcode
attributes in recipes nor to store attributes in cookbooks.
In the following setup, we are trying to communicate to http endpoint URL. For this, we
need to create a data bag, which will hold the endpoint URL detail and use it in our recipe.
Step 1 − Create a directory for our data bag.
mma@laptop:~/chef-repo $ mkdir data_bags/hooks
Step 2 − Create a data bag item for request bin. One needs to make sure one is using a
defined requestBin URL.
vipi@laptop:~/chef-repo $ subl data_bags/hooks/request_bin.json {
"id": "request_bin",
"url": "http://requestb.in/1abd0kf1"
}
Step 3 − Create a data bag on the Chef server
vipin@laptop:~/chef-repo $ knife data bag create hooks
Created data_bag[hooks]
Step 4 − Upload the data bag to the Chef server.
vipin@laptop:~/chef-repo $ knife data bag from file hooks requestbin.json
Updated data_bag_item[hooks::RequestBin]
Step 5 − Update the default recipe of the cookbook to receive the required cookbook from
a data bag.
vipin@laptop:~/chef-repo $ subl cookbooks/my_cookbook/recipes/default.rb
hook = data_bag_item('hooks', 'request_bin')
http_request 'callback' do
url hook['url']
end
Step 6 − Upload the modified cookbook to the Chef server.
vipin@laptop:~/chef-repo $ knife cookbook upload my_cookbook
Uploading my_cookbook [0.1.0]
Step 7 − Run the Chef client on the node to check if the http request bin gets executed.
user@server:~$ sudo chef-client
...TRUNCATED OUTPUT...
[2013-02-22T20:37:35+00:00] INFO: http_request[callback]
GET to http://requestb.in/1abd0kf1 successful
...TRUNCATED OUTPUT...
Chef Node
A network node is any networking device---a switch, a router---that is being managed by a
Chef Infra Client, such as networking devices by Juniper Networks, Arista, Cisco, and F5.
Use Chef to automate common network configurations, such as physical and logical
Ethernet link properties and VLANs, on these devices.
A node is any machine—physical, virtual, cloud, network device, etc.—that is under
management by Chef.
The types of nodes that can be managed by Chef include, but are not limited to, the
following:
Server
A physical node is typically a server or a virtual machine, but it can be any active device
attached to a network that is capable of sending, receiving, and forwarding information
over a communications channel. In other words, a physical node is any active device
attached to a network that can run a chef-client and also allow that chef-client to
communicate with a Chef server.
Cloud
A cloud-based node is hosted in an external cloud-based service, such as Amazon Web
Services (AWS), OpenStack, Rackspace, Google Compute Engine, or Microsoft Azure.
Plugins are available for knife that provide support for external cloud-based services.
knife can use these plugins to create instances on cloud-based services. Once created, the
chef-client can be used to deploy, configure, and maintain those instances.
Virtual Machine
A virtual node is a machine that runs only as a software implementation, but otherwise
behaves much like a physical machine.
Network Device
A network node is any networking device—a switch, a router—that is being managed by a
chef-client, such as networking devices by Juniper Networks, Arista, Cisco, and F5. Use
Chef to automate common network configurations, such as physical and logical Ethernet
link properties and VLANs, on these devices.
Container
Containers are an approach to virtualization that allows a single operating system to host
many working configurations, where each working configuration—a container—is
assigned a single responsibility that is isolated from all other responsibilities. Containers
are popular as a way to manage distributed and scalable applications and services.
On Windows Machine
Step 1 − Download the setup .msi file of chefDK on the machine.
Step 2 − Follow the installation steps and install it on the target location.
The setup will look as shown in the following screenshot.
On Linux Machine
In order to set up on the Linux machine, we need to first get curl on the machine.
Step 1 − Once curl is installed on the machine, we need to install Chef on the workstation
using Opscode’s omnibus Chef installer.
$ curl –L https://www.opscode.com/chef/install.sh | sudo bash
Step 2 − Install Ruby on the machine.
Step 3 − Add Ruby to path variable.
$ echo ‘export PATH = ”/opt/chef/embedded/bin:$PATH”’ ≫ ~/.bash_profile &&
source ~/.bash_profile
The Omnibus Chef will install Ruby and all the required Ruby gems
into /opt/chef/embedded by adding /opt/chef/embedded/bin directory to the
.bash_profile file.
If Ruby is already installed, then install the Chef Ruby gem on the machine by running the
following command.
$ gem install chef
Difference Between ANT vs Maven
Ant Maven
Ant doesn't has formal conventions, so Maven has a convention to place source code,
we need to provide information of the compiled code etc. So we don't need to provide
project structure in build.xml file. information about the project structure in
pom.xml file.
Ant is procedural, you need to provide Maven is declarative, everything you define in
information about what to do and when the pom.xml file.
to do through code. You need to provide
order.
The ant scripts are not reusable. The maven plugins are reusable.
Maven Dependencies