Edureka DevOps Ebook
Edureka DevOps Ebook
Edureka DevOps Ebook
TABLE OF CONTENTS
1. INTRODUCTION TO DEVOPS 3
Why DevOps?
How DevOps helps?
TABLE OF CONTENTS
Chapter 1
INTRODUCTION
TO DEVOPS
DevOps is a software development strategy that bridges the gap between the
developers and the IT staff. With DevOps, organizations can release small
features very quickly and incorporate the feedback which they receive
immediately. DevOps process involves a lot of development, testing, and
deployment of technologies for developing automated CI/ CD pipelines.
DEVOPS FEATURES
Waterfall Model
Challenges
a. Risky and uncertain
b. Lack of visibility of the current progress
c. Not suitable when the requirements keep changing
d. Difficult to make changes in the testing phase
e. The end product is available only at the end of the cycle
f. Not suitable for large and complex projects
Agile Methodology
Pressure of work on old , pending There is no waiting time to deploy the code. Hence the
and new code developer focuses on building the current code.
Chapter 2
These tools have been categorized into various stages of DevOps. Hence it is important for you to
understand the DevOps Lifecycle stages first.
DevOps Lifecycle can be broadly broken down into the below-listed stages:
a. Continuous Development
b. Continuous Integration
c. Continuous Testing
d. Continuous Monitoring
e. Virtualization and Containerization
Let's now learn more about each of these stages one by one.
S CONTINUOUS DEVELOPMENT
T Tools: Git, SVN, Mercurial, CV
A
G This is the phase that involves ‘planning‘ and ‘coding‘ of the software. You decide the project
E vision during the planning phase and the developers begin developing the code for the
application.
1
CONTINUOUS INTEGRATION S
T
Tools: Jenkins, TeamCity, Travis A
This stage is the core of the entire DevOps life cycle. It is a practice in which the developers G
require to commit changes to the source code more frequently. This may be either on a daily or E
weekly basis.
2
S CONTINUOUS TESTING
T Tools: Jenkins, Selenium TestNG, JUnit
A
G
E This is the stage where you test the developed software continuously for bugs using automation
testing tools.
3
CONTINUOUS DEPLOYMENT S
Configuration Management Tools – Chef, Puppet, Ansible T
Containerization Tools – Docker, Vagrant A
G
This is the stage where you deploy the code on the production servers. It is also important to E
ensure that you correctly deploy the code on all the servers. The mentioned set of tools here help
in achieving Continuous Deployment (CD). 4
S CONTINUOUS MONITORING
T Tools: Splunk, ELK Stack, Nagios, New Relic
A
G This is a very critical stage of the DevOps lifecycle where you continuously monitor the
E performance of your application. Here you record vital information about the use of the software.
You then process this information to check the proper functionality of the application. You
5 resolve system errors such as low memory, server not reachable, etc in this phase.
Chapter 3
VERSION CONTROL
WITH GIT & GITHUB
Git is a Distributed Version Control tool that supports distributed non-linear workflows by providing
data assurance for developing quality software.
Every programmer maintains a local repository on
its own, which is actually the copy or clone of the
central repository on their hard drive. They can
commit and update their local repository without
any interference. They can update their local
repositories with new data from the central server
by an operation called “pull” and affect changes to
the main repository by an operation called “push”
from their local repository.
Git plays a vital role when it comes to managing the code that the collaborators contribute to the shared
repository. Whereas this code is then extracted for performing continuous integration to create a 'build'
and test it on the test server and eventually deploy it on the production.
Git is a version control tool that will allow you to perform all kinds of operations to fetch data from the
central server or push data to it whereas GitHub is a code hosting platform for version control
collaboration. GitHub is a company that allows you to host a central repository on a remote server.
git init git init [repository name] Used to start a new repository
git clone git clone [url] Used to obtain a repository from an existing URL
git add git add [file] Used to add a file to the staging area
git status git status Used to list all the files that have to be committed
Chapter 4
CONTINUOUS
INTEGRATION WITH
JENKINS
Jenkins is an open-source automation tool
written in Java with plugins built for
Continuous Integration purposes. It is used to
build and test your software projects
continuously making it easier for developers
to integrate changes to the project, and
making it easier for users to obtain a fresh
'build'.
The following are some facts about Jenkins
that makes it better than other Continuous
Integration tools:
Adoption: Jenkins is widespread, with more than 147,000 active installations and over 1 million users
around the world.
Plugins: Jenkins is interconnected with over 1,000 plugins that allow it to integrate with most of the
development, testing and deployment tools.
To carry out continuous delivery, Jenkins introduced a new feature called the Jenkins pipeline.
A pipeline is a collection of jobs that brings the software from version control into the hands of the end-
users by using automation tools.
PIPELINE
1 This is a user-defined block that contains all the processes such as build, test, deploy, etc.
NODE
2 A node is a machine that executes an entire workflow.
AGENT
3 An agent is a directive that can run multiple builds with only one instance of Jenkins.
ANY
4 Runs the pipeline/ stage on any available agent.
NONE
5 This parameter is applied at the root of the pipeline and it indicates that there is no global agent for the
entire pipeline and each stage must specify its own agent.
LABEL
6 Executes the pipeline/stage on the labelled agent.
DOCKER
7 This parameter uses Docker containers as an execution environment for the pipeline or a specific stage.
STAGES
8 This block contains all the work that needs to be carried out. The work is specified in the form of stages.
There can be more than one stage within this directive. Each stage performs a specific task
STEPS
9 A series of steps can be defined within a stage block. These steps are carried out in sequence to execute
a stage.
Chapter 5
CONTAINERIZATION
WITH DOCKER
Containerization is a type of Virtualization that brings
virtualization to the operating system level. Docker is a
platform that packages an application and all its
dependencies together in the form of containers. This
containerization aspect ensures that the application
works in any environment.
As you can see in the diagram, each and every
application runs on separate containers and has its own
set of dependencies & libraries. This makes sure that
each application is independent of other applications,
giving developers surety that they can build
applications that will not interfere with one another.
Dockerfile, Docker Images & Docker Containers are three important terms that you need to
understand while using Docker.
2. docker pull
Usage: docker pull <image name>
This command is used to pull images from the docker repository(hub.docker.com)
3. docker run
Usage: docker run -it -d <image name>
This command is used to create a container from an image.
4. docker exec
Usage: docker exec -it <container id> bash
This command is used to access the running container.
5. docker stop
Usage: docker stop <container id>
This command stops a running container.
6. docker kill
Usage: docker kill <container id>
This command kills the container by stopping its execution immediately.
7. docker commit
Usage: docker commit <conatainer id> <username/imagename>
This command creates a new image of an edited container on the local system.
8. docker push
Usage: docker push <username/image name>
This command is used to push an image to the docker hub repository.
9. docker build
Usage: docker build <path to docker file>
This command is used to build an image from a specified docker file.
Chapter 6
CONTINUOUS DEPLOYMENT
WITH PUPPET
Puppet is a Configuration Management tool that is used for deploying, configuring and managing
servers. Puppet uses a Master-Slave architecture in which the Master and Slave communicate
through a secure encrypted channel with the help of SSL.
1 2 3 4
Manifests Classes Resources Puppet Modules
Chapter 7
CONTINUOUS TESTING
WITH SELENIUM
Selenium is an open-source tool that is used for automating the tests carried out on web browsers.
Test scripts can be written in various programming languages and carried out in any Operating
Systems. It can be integrated with tools such as TestNG & JUnit for managing test cases and
generating reports.
Selenium is mainly comprised of a suite of tools, which include:
SELENIUM IDE
1 It allows us to record and playback the scripts
SELENIUM RC
2 Selenium RC server is an HTTP proxy server
SELENIUM WEBDRIVER
3 It is a browser automation framework that
accepts commands and sends them to a browser
SELENIUM GRID
4 It is used to run tests on different machines
against different browsers in parallel
1. Press Ctrl+N or Right-click on the Test Case folder, select “TestNG Class” under TestNG category and click Next
S 2. Set the Class name as ‘TestNG‘. Under Annotations, check “@BeforeMethod”, “@AfterMethod” and click Finish
T 3. Now it will display the newly created TestNg class under the Test Case package(folder)
4. Now write the first TestNG test case. You can divide the test case into three parts:
E @BeforeMethod : Launch Firefox and direct it to the Base URL
P @Test : Enter Username & Password to Login, Print console message and Log out
Chapter 8
CONTINUOUS
MONITORING WITH
NAGIOS
Nagios is used for Continuous monitoring of systems, applications, services, and business processes,
etc., in a DevOps culture. In the event of a failure, Nagios can alert technical staff of the problem,
allowing them to begin remediation processes before outages affect business processes, end-users,
or customers.
Nagios runs on a server, usually as a daemon or a service. It periodically runs plugins residing on the
same server, they contact hosts or servers on your network or on the internet. One can view the
status information using the web interface. You can also receive email or SMS notifications if
something happens. The Nagios daemon behaves like a scheduler that runs certain scripts at certain
moments. It stores the results of those scripts and will run other scripts if these results change.
Chapter 9
FREQUENTLY
ASKED
INTERVIEW
QUESTIONS
DevOps is a buzzword in the industry right now. Every
organization is using DevOps practices but what are these
companies looking for in DevOps Professionals! This
chapter covers the questions that will help you in your
DevOps Interviews and open up various DevOps career
opportunities as a DevOps aspirant.
1. What are the fundamental differences between DevOps 14. Explain how to create a backup and copy files in Jenkins?
& Agile? 15. Explain how you can set up Jenkins job?
2. What is the need for DevOps? 16. How will you secure Jenkins?
3. Which are the top DevOps tools? 17. What is Automation Testing? Explain some of its benefits.
4. Explain with a use case where DevOps can be used in 18. How to automate Testing in the DevOps lifecycle?
industry/ real-life. 19. Which Testing tool are you comfortable with and what are
5. What are the anti-patterns of DevOps? the benefits of that tool?
6. What is Version Control? Explain some of its benefits. 20. What are the Testing types supported by Selenium?
7. Describe branching strategies you have used. 21. Which among Puppet, Chef, SaltStack and Ansible is the best
8. What is Git? Explain some basic Git commands. Configuration Management (CM) tool? Why?
9. What is Git rebase and how can it be used to resolve 22. What are the goals of Configuration management processes?
conflicts in a feature branch before the merge? 23. What is an Ansible module?
10. How do you find a list of files that have changed in a 24. What is Nagios? How does it work?
particular commit? 25. What is NRPE (Nagios Remote Plugin Executor) in Nagios?
11. How do you set up a script to run every time a repository 26. How exactly are containers (Docker in our case) different
receives new commits through push? from hypervisor virtualization? What are the benefits?
12. Why do you need a Continuous Integration of 27. What is a Docker container?
development & testing? 28. What is Dockerfile used for?
13. How Jenkins can be moved or copied from one server to 29. Do I lose my data when the Docker container exits?
another? 30. How to create a Docker container?
DevOps Evangelist ensures that the Release Manager's key area of focus is to
DevOps strategy is implemented in the co-ordinate and manage the product
end-to-end development of the product, from development through deployment.
while bringing about a positive Since this role is involved in an important
difference in the environment. The manner, it should be donned by a
DevOps Evangelist also finds ways to technical person (manager) who
improve the existing architecture of the understands how this technology works
product keeping in mind the various and how various structures fall in place.
automation tools available and the skills
that ‘Dev’ and ‘Ops’ guy consist of.
Managing other DevOps roles and
obtaining full efficiency from the team is
his primary target.
Quality Assurance
www.edureka.co/devops-certification-training
www.edureka.co/kubernetes-certification
www.edureka.co/masters-program/devops-engineer-training
www.edureka.co/docker-training
LEARNER'S REVIEWS
Excellent course. Makes one The Devops course I would recommend this
familiar with most of the curriculum includes all course to my other friends as
Devops tools in the market. necessary tools needed for I found this DevOps training
current market. Previous very useful. The trainer was
Well presented and detailed
recordings and blogs very good in explaining all the
course. Strongly recommend
included in the course concepts and clarifying the
anyone looking to build a content were very helpful in doubts for us. I was thrilled to
career in devops field. gaining additional do the lab exercises which
knowledge. I had a great gave me lot of confidence
learning experience with the that I would be able to apply
trainer. this in my job.
2500+ Technical
Blogs
3000+
Video Tutorials on
YouTube
30+
Active
Free Monthly
Community Webinars
WWW.EDUREKA.CO/DEVOPS
About Us
There are countless online education marketplaces on the internet. And there’s us. We
are not the biggest. We are not the cheapest. But we are the fastest growing. We have
the highest course completion rate in the industry. We aim to become the largest
online learning ecosystem for continuing education, in partnership with corporates
and academia. To achieve that we remain ridiculously committed to our students. Be it
constant reminders, relentless masters or 24 x 7 online technical support - we will
absolutely make sure that you run out of excuses to not complete the course.