0% found this document useful (0 votes)
15 views29 pages

DevOps Study

The document provides an overview of DevOps, Agile methodologies, and version control systems, highlighting their definitions, lifecycle phases, and key differences. It explains the importance of collaboration between development and operations in DevOps and outlines Agile principles focused on iterative development and customer feedback. Additionally, it discusses various tools used in DevOps, such as Docker and Git, and the differences between centralized and distributed version control systems.

Uploaded by

Sanket More
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)
15 views29 pages

DevOps Study

The document provides an overview of DevOps, Agile methodologies, and version control systems, highlighting their definitions, lifecycle phases, and key differences. It explains the importance of collaboration between development and operations in DevOps and outlines Agile principles focused on iterative development and customer feedback. Additionally, it discusses various tools used in DevOps, such as Docker and Git, and the differences between centralized and distributed version control systems.

Uploaded by

Sanket More
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
You are on page 1/ 29

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.

DevOps Lifecycle Phases and Measures


DevOps is basically an integration of development and operation processes. One cannot
implement DevOps without understanding its lifecycle. The following steps are included in
the DevOps lifecycle:

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

Parameter Agile DevOps


Agile refers to an iterative
DevOps is considered a
approach which focuses on
practice of bringing
What is it? collaboration, customer
development and operations
feedback, and small, rapid
teams together.
releases.
DevOps central concept is to
Agile helps to manage
Purpose manage end-to-end
complex projects.
engineering processes.
Agile process focusses on DevOps focuses on constant
Task
constant changes. testing and delivery.
The primary goal of DevOps
Agile method can be
is to focus on collaboration,
implemented within a range
Implementation so it doesn’t have any
of tactical frameworks like a
commonly accepted
sprint, safe and scrum.
framework.
Shift-Left Leverage both shifts left and
Leverage shift-left
Principles right.
Feedback is given by the Feedback comes from the
Feedback
customer. internal team.
End-to-end business
Target Areas Software Development
solution and fast delivery.

Automation is the primary


goal of DevOps. It works on
Agile doesn’t emphasize on
Automation the principle to maximize
automation. Though it helps.
efficiency when deploying
software.
It addresses the gap
It addresses the gap
between customer need and
Goal between development +
development & testing
testing and Ops.
teams.
It focuses more on
It focuses on functional and
Focus operational and business
non-function readiness.
readiness.
Parameter Agile DevOps
Developing, testing and
Developing software is
Importance implementation all are
inherent to Agile.
equally important.
Puppet, Chef, TeamCity
JIRA, Bugzilla, Kanboard are
Tools used OpenStack, AWS are
some popular Agile tools.
popular DevOps tools.
The agile method needs DevOps process needs to
teams to be more productive development, testing and
Challenges
which is difficult to match production environments to
every time. streamline work.
Agile offers shorter
DevOps supports Agile’s
Advantage development cycle and
release cycle.
improved defect detection.

-------------------------------------------------------------------------------------

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.
-------------------------------------------------------------------------------------

Linux Basic Command Utilities


• ls - The most frequently used command in Linux to list directories
• pwd - Print working directory command in Linux
• cd - Linux command to navigate through directories
• mkdir - Command used to create directories in Linux
• mv - Move or rename files in Linux
• cp - Similar usage as mv but for copying files in Linux
• rm - Delete files or directories
• touch - Create blank/empty files
• ln - Create symbolic links (shortcuts) to other files
• cat - Display file contents on the terminal
• clear - Clear the terminal display
• echo - Print any text that follows the command
• less - Linux command to display paged outputs in the terminal
• uname - Linux command to get basic information about the OS
• head - Return the specified number of lines from the top
• tail - Return the specified number of lines from the bottom
-------------------------------------------------------------------------------------

Linux Admin Commands

Command Function

man Display information about all commands

uptime Show how long system is running

users Show username who are currently logged in

service Call and execute script

pkill Kill a process

pmap Memory map of a process

wget Download file from network

ftp or sftp Connect remote ftp host


free Show memory status

top Display processor activity of system

last Display user's activity in the system

ps Display about processes running on the system

Shutdown commands Shutdown and reboot system

info Display information about given command

env Display environment variable for currently logged-in user

netstat Display network status

arp Check ethernet connectivity and IP address

df Display filesystem information

du Display usage

init Allow to change server bootup

nano A command line editor

nslookup Check domain name and IP information

shred Delete a file by over writing its content

cat Display, copy or combine text files

pwd> Print path of current working directory

locate Finding files by name on system

chown Change ownership of a file

>alias To short a command

echo Display text

cmp Compare two files byte by byte

mount Mount a filesystem

ifconfig Display configuration

traceroute> Trace existing network


sudo Run a command as a root user

route List routing table for your server

ping Check connection by sending packet test packet

find Find location of files/directories

users Show current logged in user

who Same as w but doesn't show current process

ls List all the files

tar Compress directories

grep Search for a string in a file

su Switch from one to another user

-------------------------------------------------------------------------------------

What Is Git?

• Git is an open-source distributed version control system. It is designed to handle


minor to major projects with high speed and efficiency. It is developed to co-
ordinate the work among the developers. The version control allows us to track and
work together with our team members at the same workspace.
• Git is foundation of many services like GitHub and GitLab, but we can use Git
without using any other Git services. Git can be used privately and publicly.
• Git was created by Linus Torvalds in 2005 to develop Linux Kernel. It is also used as
an important distributed version-control tool for the DevOps.
• Git is easy to learn, and has fast performance. It is superior to other SCM tools like
Subversion, CVS, Perforce, and ClearCase.
----------------------------------------------------------------------------------

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.
-------------------------------------------------------------------------------------

What is a “version control system”?

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

Distributed Version Control Systems: Distributed version control systems contain


multiple repositories. Each user has their own repository and working copy. Just
committing your changes will not give others access to your changes. This is because
commit will reflect those changes in your local repository and you need to push them in
order to make them visible on the central repository. Similarly, when you update, you do
not get others’ changes unless you have first pulled those changes into your repository.
To make your changes visible to others, 4 things are required:

• You commit
• You push
• They pull
• They update
-------------------------------------------------------------------------------------

Difference CVCS vs DVCS

Sr. Key Centralized Version Control Distributed Version Control


No.

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.

Branches Working on branches in difficult Working on branches in easier in DVS.


3 in CVS. Developer often faces Developer faces lesser conflicts.
merge conflicts.

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.

Backup If CVS Server is down, If DVS server is down, developer can


6
developers cannot work. work using their local copies.

-------------------------------------------------------------------------------------
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

• Create a new repository on GitHub


• To begin, sign in to your user account on GitHub.
• In the upper right corner, click the + sign icon, then choose New repository. This will
take you to a page where you can enter a repository name (this tutorial uses test-
repo as the repository name), description, and choose to initialize with a README
(a good idea!).
• It is a good idea to add a .gitignore file by selecting one of the languages from the
drop down menu, though for this tutorial it will not be necessary.
• Similarly, in practice you should choose a license to that people know whether and
how they can use your code.
• Once you have entered a repository name and made your selection, select Create
repository, and you will be taken to your new repository web page.
-------------------------------------------------------------------------------------

Creating the Branches, switching the branches, merging in GIT


Creating a Branch
Our website is live and online, but we would like to add a new feature, let's say a
shopping cart so our customers can start buying our product.

We will create a new branch called cart:

$ git checkout -b cart


Switched to a new branch 'cart'
This creates a new branch called cart and automatically switches to it, ready to start
working on. That command is shorthand for the following:

$ git branch cart


$ git checkout cart

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:

$ git checkout -b bugfix


Switched to a new branch 'bugfix'

We can work on our fix without disturbing the site, and commit it to our bugfix branch:

$ git commit -m "fixed the bug"


[bugfix c42b77e] fixed bug
1 file changed
And now push the branch to our remote repository:

$ git push -u origin buxfix


* [new branch] bugfix -> bugfix
Branch bugfix set up to track remote branch bugfix from origin

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:

$ git checkout master


Switched to branch 'master'
Your branch is up-to-date with 'origin/master'

Now we can merge our bugfix:

$ git merge bugfix


Updating 68fb3f6..c42b77e
Fast-forward
index.html | 1
1 file changed

And push to GitHub:

$ git push origin master


Total 0 (delta 0), reused 0 (delta 0)
to [email protected]:adamw/first-project/repository.git
68fb3f6..c42b77e master -> master
Housekeeping
Everything looks good, and the bug is now fixed and deployed. Let's remove our bugfix
branch:

$ git branch -d bugfix


Deleted branch bugfix (was c42b77e)

We will want to remove the branch from our remote repository as well.

$ git push origin --delete bugfix


To [email protected]:adamw/first-project/repository.git
- [deleted] bugfix

-------------------------------------------------------------------------------------

What is Maven? And Maven POM Builds


Maven is a powerful project management tool that is based on POM (project object
model). It is used for projects build, dependency and documentation.

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.

8 Phases of the Default Maven Lifecycle

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 Global and Local Repository


A maven repository is a directory of packaged JAR file with pom.xml file. Maven searches
for dependencies in the repositories. There are 3 types of maven repository:
Local Repository
Central Repository
Remote Repository
Maven searches for the dependencies in the following order:
Local repository then Central repository then Remote repository.

Maven Local Repository


• Maven local repository is located in your local system. It is created by the maven
when you run any maven command.
• By default, maven local repository is %USER_HOME%/.m2 directory. For example:
C:\Users\SSS IT\.m2.
• Update location of Local Repository
• We can change the location of maven local repository by changing the settings.xml
file. It is located in MAVEN_HOME/conf/settings.xml, for example: E:\apache-
maven-3.1.1\conf\settings.xml.

Maven Central Repository


• Maven central repository is located on the web. It has been created by the apache
maven community itself.
• The path of central repository is: http://repo1.maven.org/maven2/.
• The central repository contains a lot of common libraries that can be viewed by this
url http://search.maven.org/#browse.

Maven Remote Repository


Maven remote repository is located on the web. Most of libraries can be missing from the
central repository such as JBoss library etc, so we need to define remote repository in
pom.xml file.

-------------------------------------------------------------------------------------

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.

A list of maven core plugins are given below:

Plugin Description

clean clean up after build.

compiler compiles java source code.

deploy deploys the artifact to the remote repository.

failsafe runs the JUnit integration tests in an isolated classloader.

install installs the built artifact into the local repository.

resources copies the resources to the output directory for including in the JAR.
site generates a site for the current project.

surefire runs the JUnit unit tests in an isolated classloader.

verifier verifies the existence of certain conditions. It is useful for integration


tests.

-------------------------------------------------------------------------------------

What is Docker and explain Architecture?


Docker daemon runs on the host operating system. It is responsible for running
containers to manage docker services. Docker daemon communicates with other
daemons. It offers various Docker objects such as images, containers, networking, and
storage. s
Docker architecture
Docker follows Client-Server architecture, which includes the three main components
that are Docker Client, Docker Host, and Docker Registry.

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

• Docker Hub is a repository service and it is a cloud-based service where people


push their Docker Container Images and also pull the Docker Container Images
from the Docker Hub anytime or anywhere via the internet. It provides features
such as you can push your images as private or public. Mainly DevOps team uses
the Docker Hub. It is an open-source tool and freely available for all operating
systems. It is like storage where we store the images and pull the images when it is
required. When a person wants to push/pull images from the Docker Hub they
must have a basic knowledge of Docker. Let us discuss the requirements of the
Docker tool.
• Docker is a tool nowadays enterprises adopting rapidly day by day. When a
Developer team wants to share the project with all dependencies for testing then
the developer can push their code on Docker Hub with all dependencies. Firstly
create the Images and push the Image on Docker Hub. After that, the testing team
will pull the same image from the Docker Hub eliminating the need for any type of
file, software, or plugins for running the Image because the Developer team shares
the image with all dependencies.

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

Advantages of Docker Hub


• Docker Container Images are light in weight.
• We can push the images within a minute and with help of a command.
• It is a secure method and also provides a feature like pushing the private image or
public image.
• Docker hub plays a very important role in industries as it becomes more popular
day by day and it acts as a bridge between the developer team and the testing
team.
• If a person wants to share their code, software any type of file for public use, you
can just make the images public on the docker hub.

-------------------------------------------------------------------------------------
Docker Vs Virtualization

Docker Virtualization

It boots in a few seconds. It takes a few minutes for VMs to boot.

Pre-built docker containers are readily


Ready-made VMs are challenging to find.
available.

Docker has a complex usage mechanism


Tools are easy to use and more straightforward to
consisting of both third-party and docker-
work with. third-party.
managed tools.

Limited to Linux. Can run a variety of guest OS.

Dockers make use of the execution


VMs make use of the hypervisor.
engine.

It is lightweight. It is heavyweight.

Host OS can be different from container


Host OS can be different from guest OS.
OS.

Can run many docker containers on a Cannot run more than a couple of VMS on an
laptop. average laptop.

Docker can get a virtual network adapter.


Each VMS gets its virtual network adapter.
It can have separate IPs ad Ports.

Sharing of files is possible. Sharing library and files are not possible.

Lacks security measures. Security depends on the hypervisor.

A container is portable. VMS is dependent on a hypervisor.

It allows running an application in an It provides easiness in managing applications,


isolated environment known as a recovery mechanisms, and isolation from the host
container operating system

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.

How to setup chef workstation?

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.

ChefDK Path Variable


$ echo $PATH
/c/opscode/chef/bin:/c/opscode/chefdk/bin:

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.

There is no life cycle in Ant. There is life cycle in Maven.

It is a tool box. It is a framework.

It is mainly a build tool. It is mainly a project management tool.

The ant scripts are not reusable. The maven plugins are reusable.

It is less preferred than Maven. It is more preferred than Ant.

Explain Staging area and Working Area?


Staging Area
In technical terms, the staging area is the middle ground between what you have done to
your files (also known as the working directory) and what you had last committed (the
HEAD commit). As the name implies, the staging area gives you space to prepare (stage)
the changes that will be reflected on the next commit.
Git has a staging area that stores file changes that have not been committed yet.
It is a step that allows you to continue making changes and record changes in small
commits.
Working Directory
he shells always identifies a particular directory within which you are assumed to be
working. This directory is known as the working directory (also known as the current
working directory). To work with a file within your working directory, you need specify
only the file name with a command. If you want to work with a file in another directory,
you can change your working directory, using the cd shell command and naming the new
directory.

Maven Dependencies

One of the core features of Maven is Dependency Management. Managing dependencies


is a difficult task once we've to deal with multi-module projects (consisting of hundreds of
modules/sub-projects). Maven provides a high degree of control to manage such
scenarios.

You might also like