0% found this document useful (0 votes)
6 views181 pages

Understanding SDLC and DevOps Frameworks

The document outlines the Software Development Life Cycle (SDLC) and various methodologies including Waterfall and Agile, emphasizing the importance of high-quality software that meets customer expectations. It introduces DevOps as a combination of development and operations to enhance collaboration and automation in the software lifecycle, while also discussing the advantages and disadvantages of DevOps. Additionally, it covers Git usage for version control and the significance of continuous integration and deployment in modern software development practices.

Uploaded by

Aditya Verma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views181 pages

Understanding SDLC and DevOps Frameworks

The document outlines the Software Development Life Cycle (SDLC) and various methodologies including Waterfall and Agile, emphasizing the importance of high-quality software that meets customer expectations. It introduces DevOps as a combination of development and operations to enhance collaboration and automation in the software lifecycle, while also discussing the advantages and disadvantages of DevOps. Additionally, it covers Git usage for version control and the significance of continuous integration and deployment in modern software development practices.

Uploaded by

Aditya Verma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Introductio Detail out the course

n and
Course
Hand-out Perform activity – Create 2
briefing project team, demo on process
of following SDLC process
SDLC also called as Software Development Process

Software Process followed by an IT organization to build a


software

Developme
nt Life Framework which details the various tasks
performed at every step

Cycle
Objective is to high quality software as an end
product

Product must satisfy the customers expectation


SDLC Phases

Requirement
Initiation Planning Design
Analysis

Maintenance Implementation Testing Development


First Process Model introduced in SDLC

Follows a linear sequential flow

Waterfall
Model Divided into various phases
The output of one phase acts as the input for
the next phase

Water flow cannot be turned back once flown


over the cliff edge
Disadvantage of Waterfall Model

•Working software is produced almost at the end

•Lot of uncertainty causes high amount of risk

•Not a good model for complex and long ongoing projects

•Not a recommended model for moderate to high risk of changing


requirements kind of projects

•Difficult or cannot accommodate changing requirements


Agile Methodology
• An iterative project management and software development approach

• Helps development team to release features to their customers at fast pace

AGILE
Plan Design Develop Test Release Feedback

• Agile team produces software in small amount and incrementally instead of a big large release

• Constant and better collaboration with stakeholders and continuous improvement at every stage

• Offers flexibility, adaptability to change, and high level of customer input


DevOps comes to rescue

Developer Operations

SOFTWARE COMBINATION OF TWO ONE TEAM TO HANDLE ENCOURAGES IMPROVES


DEVELOPMENT AND IT WORDS - THE COMPLETE AUTOMATING THE ORGANIZATION’S
OPERATIONS PROCESS DEVELOPMENT AND APPLICATION LIFECYCLE, DEPLOYMENT, CAPABILITY TO DELIVER
OPERATION FROM DEVELOPMENT CONFIGURATION, SOFTWARE
TO TESTING, MONITORING, AND APPLICATIONS AND
DEPLOYMENT, MANAGEMENT OF SERVICES
AND OPERATIONS APPLICATIONS
Advantages of DevOps

Better approach for Responds faster to the Increases business


Helps to become more
quick application market changes to profit by reducing
agile and able to deliver
development and improve business software delivery time
applications faster
deployment growth and transportation costs

DevOps clears the DevOps means


DevOps simplifies
descriptive process, Improves customer collective responsibility,
collaboration and places
which gives clarity on experience and better team
all tools in the cloud for
product development satisfaction engagement and
customers to access
and delivery productivity
DevOps professional or expert's
developers are less available

Disadvanta Developing with DevOps is bit expensive

ges of
DevOps Hard to manage adoption of new DevOps
technologies in short time

Lack of DevOps knowledge can lead to


problem in the continuous integration of
automation
Discussion of Project and
Assignment

•Prepare maven-based java project may be hello world


•Add it into Git
•Maven build
•Junit creation and executing it via maven
•SonarQube integration via maven
•Jenkins job
DevOps Pipeline

•DevOps pipeline is a set of tools and automated processes which enables


engineering team to have close interactions while building a software

•Main purpose of DevOps pipeline is to enable automation and that should be


continuous. For example, continuous integration, continuous
delivery/deployment (CI/CD), continuous feedback, and continuous operations

•DevOps pipeline consists of various phases, and it tries to get rid of manual
operations as much possible in these phases

•It can vary project to project

•It may include one or more manual gates that require human intervention before
it proceed to next phase
Continuous Development
Continuous Integration
Continuous Testing
Lifecycle
of Continuous Monitoring
DevOps Continuous Feedback
Continuous Deployment
Continuous Operations
The project goal and plans are created
during planning.

Continuou Based on planning, the code is developed

s by developers.

Developm Developers use IDE (Integrated


Development Environment) or source code
ent editor to write code.

Developers use source code management


tool.
The objective of this phase is to perform testing
on the software.

Testing phase should also be automated and

Continuou continuous in nature.

s Testing Tools such as TestNG, JUnit, Selenium, JMeter


etc. can be used by testing team to thoroughly
test application functionality.

Minimize a lot of time and effort for executing


the test cases instead of performing it
manually.
It means code is committed by developers
frequently, every commit is compiled, unit tested,
integration tested, code reviewed, and packaged.

Continuou
s It helps in early detection of problems if any exists
in the code.

Integration
One of the popular tool, Jenkins, can be used to
perform automation in this phase. Any change in
the Git repository, Jenkins fetches the updated
code and prepares a build of that code and
package it. This build is then forwarded to the test
server or the production server.
In this phase the artifact, the compiled tested
bundled code, is deployed on the production server.

Continuou
s In this phase, specifically for production deployment,

Deployme
a manual gate is preferred.

nt
In other non-production environments, the
deployment can be automated and continuous.
In this phase the application is continuously
monitored for its performance.

Continuou
s Logs, metrices, events etc. are recorded and
analyzed for application performance and issues.

Monitoring
Operations team setup the tools and provide access
to developers to various metrices, logs which
developers to closely check the health of the
application.
It consists of two types of feedback – end user
feedback and application monitoring feedback.

Continuou
s End user provides their feedback based on their
experiences while browsing the application.

Feedback
Automated monitoring tools also provide vital
information and alerts on the application
performance and issues when used by end user.
DevOps Pipeline

Continuous Integration Manual


Switch
Acceptance Deploy to Deploy to
Source Code Build Test
Test Staging Production
Continuous Delivery

Acceptance Deploy to No Deploy to


Source Code Build Test
Test Staging Switch Production
Continuous Deployment

The management of deployment pipelines can be approached prior to releasing artifacts into production. Continuous
Delivery and Continuous Deployment are the strategies focusing on the roles of manual intervention and approval
automation.
Continuous Delivery and Continuous Deployment
Continuous Delivery

Automates the software release process, but requires a manual decision to deploy to production. This
gives developers time to review changes and coordinate with other business activities. Continuous delivery is a
good choice for organizations that need to balance speed and reliability.

Continuous Deployment
Automates the entire release process, including the deployment to production. This means that every
change that passes all stages of the production pipeline is automatically released to customers. Continuous
deployment is a good choice for organizations that want to quickly innovate and minimize release
friction. However, it has a higher risk because of the lack of manual intervention
DevOps Lifecycle
DevOps
Ecosystem
Market trends of DevOps
Serverless Microservices
Containerization
computing architecture

DevSecOps Low-code apps GitOps

Infrastructure as a
Automation
code
1. Containerization

Marke Container technologies has made an impact in the rise of DevOps. Containers are lightweight, self-
contained environments that make it easier to host and manage web applications. By 2023,
Gartner expects 70% of companies to run two or more containerized applications. As more and

t more apps will be developed, DevOps will be needed to deal with the system complexities.

trends 2. Serverless computing

of The concept of serverless computing has emerged as a new and exciting approach to deploying
software and other services. Serverless computing removes server maintenance, system updates
workload from the developers. Serverless computing generates code for DevOps pipelines without

DevOp the need for a host to build, test, and deploy.

s 3. Microservices Architecture

Microservices architecture focuses on building smaller and manageable applications than a large
monolithic applications. It encourages shorter software release intervals. Along with robust DevOps
processes, it becomes easier to build applications faster.
4. DevSecOps

Building internet facing application, security becomes a major concern for organizations.
DevSecOps integrates best practices in software development, delivery, and operations with an

Marke emphasis on security and observability, so the risks and vulnerabilities in the given applications are
reduced. DevSecOps helps to close the security knowledge gap between IT and business. It
supports the early detection of cyber risks and the reduction of costs associated with their

t remediation.

5. Low-code apps

trends Low-code platforms allow you to build apps without coding knowledge. This allows non-technical

of people to contribute to software development through a visual interface that manages the entire
app development process. It allows users to build their own workflows and logic by dragging and
dropping elements. This trend in DevOps speeds up the entire development and deployment

DevOp
process by creating simple and user-friendly apps.

s
6. GitOps

GitOps is one of the ways to implement and manage Kubernetes clusters. By releasing incremental
updates, continuous delivery enables development teams to build, test, and deploy software more
quickly. It is essential that a Kubernetes continuous integration and runtime pipeline be capable of
reading and writing files to Git, updating container repositories, and loading containers. Version
control for configuration changes, as well as real-time monitoring and alerting are all possible with
GitOps, allowing the business to better manage infrastructure.
Marke 7. Infrastructure as a Code

t Infrastructure as a Code automates resource management and provisioning by using code, instead
of using configuration tools. DevOps teams may provide and control all parts of the environment,

trends including VMs, operating systems, containers, application configuration, storage, networking, and
connections between multiple components, using infrastructure as code.

of 8. Automation

DevOp DevOps encourages towards automation and help businesses become more efficient, responsive,
and transparent to their customers. In order to meet the increasing demands and quick software

s turn around, a high level of multitasking skilled development team is expected and the only way to
achieve this is to adopt and accelerate automation. Automation of time-consuming long processes
enables development team to focus on other critical requirements.
DevOps Roles, Responsibilities, Skills

DevOps engineer’s work is


a full-time job.

DevOps engineers should


have problem-solving and
quick-learning soft skill. Able to
perform Manage
Improve Ensuring
system project
Increase quality and Analyze, critical
They are responsible for troubleshooti effectively
project reduce design and resolution of
the production and ng and through
visibility development evaluate system issues
maintenance of a software problem- open,
through cost with automation by using the
application’s platform. solving standards-
traceability. collaboration scripts. best security
across based
. solutions.
platform and platforms.
application.
Git

•Open-source distributed version control system.

•It is developed to co-ordinate the work among the developers.

•It allows to track and work together with project team members at the same
workspace.

•It provides backups for uncertainty.

•Complete change history of a file.

•Developers can compare earlier versions of the code with an older version to
fix the mistakes.
Git Repository

•Repository is the storage location where all files, packages/folders are kept.

•Two types of repositories – Local and Remote

•Remote repository is on the server and local repository is on


developers local PC.

•Local repository is the copy of remote repository.

•Developers works on their local repository and push their work to remote repository.
Remote Repository

Server

Remote Repository

Developer 2 Developer 3
Developer 1
Local Repository Local Repository
Local Repository
Git Installation
Follow the installation wizard and click on next next button.
Download [Link]
windows/git/releases/download/v2.3
[Link].2/[Link]

Double click on Git installer Click on Install button


Create Git Repository using Git
Click on Create New Repository
Git Branches
There are different types of branches in a project. According to
the standard branching strategy and release management,
there can be following types of branches:
•Master
•Develop
•Hotfixes
•Release branches
•Feature branches
Every branch has its meaning and standard. Let's understand
each branch and its usage.

The Main Branches


Two of the branching model's branches are considered as main
branches of the project. These branches are as follows:
•master
•develop
Git config
Command
•Git config command
•This command configures the user.
The Git config command is the first
and necessary command used on the
Git command line. This command sets
the author name and email address
to be used with your commits.
•Syntax
•$ git config --
global [Link] “Rajender Singh"
•$ git config --
global [Link] “[Link]
y@[Link]"
• To view the configured details :
$ git config --list
•Git Init command

Git init
•This command is used to create a local repository.
•Syntax

Command •$ git init demo


•The init command will initialize an empty repository. See the below screenshot.

Create Git
Repository •Click on Create Repository option

using GitHub
•Git clone command

Git clone •This command is used to make a copy of a repository from an existing URL. If I want a local copy of my repository
from GitHub, this command allows creating a local copy of that repository on your local directory from the
repository URL.

Command •Syntax
•$ git clone URL
Create a
sample Java
Project
•Create a sample Java project
using any IDE.
Git add
Command
•Git add command
•This command is used to add
one or more files to staging
(Index) area.
•Syntax
•To add one file
•$ git add Filename

•To add more than one file


•$ git add .
Git status
Command
•Git Status
•This command is used to determine
the status of each file in the project.
It provides which changes have been
staged, which haven’t, or being
tracked by Git. It also lists the files
that are changed and still need to
add or commit.

•Syntax
•To check the status of the files
•$ git status
Git Files Status
Tracked files are those files which Git knows. These are referred as tracked files. The files were present in the last snapshot,
as well as any newly staged files; they can be unmodified, modified, or staged.
Remaining files are Untracked files. Any file in the working directory that were not in the last snapshot and are not in the
staging area. When we first clone a repository, all of our files will be tracked and unmodified because Git just checked them
out and you haven’t edited anything.
As we edit files, Git sees them as modified, because we have changed them since the last commit. As we work, we
selectively stage these modified files and then commit all those staged changes

Untracked Unmodified Modified Staged

git add
Edit an existing file
rm filename
git add
(delete a file)
git commit
Git Token Setting
During git push command a token will be used as auth token instead of credentials :

Login to Github
 Click on Profile  Settings - Developer Settings - Personal access tokens - Tokens Classic - Generate new token

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

 Verify on windows computer : open Run  Credential manager --. Check Generic Credentials section for git entry
Git Commit Command
Git Commit
•The "commit" command is used to save changes to the local repository. It is used to record the changes in the
repository. It is the next command after the git add. Every commit contains the index data and the commit message.
•When we add a file in Git, it will take place in the staging area. A commit command is used to fetch updates from
the staging area to the repository.
•Staging allows us to continue in making changes to the repository, and when we want to share these changes to the
version control system, committing allows us to record these changes.
•Commits are the snapshots of the project.

Git commit –m option


• The commit command will commit the changes and generate a commit-id. The -m option of commit command
write the commit message on the command line.

•Syntax
$ git commit -m "Commit message."
Git Push Command
Git Push
•The git push command is used to upload local repository content to a remote repository. Pushing means transfer
commits from the local repository to a remote repository.
•After a local repository has been modified a push is executed to share the modifications with remote team
members.
•Syntax
$ git push

•If location of a repository is not specified, then it will push to default location at origin master.
Git Common Commands
Git Branch Command
This command lists all the branches available in the repository.
Syntax
$ git branch

Git Merge Command


This command is used to merge the specified branch’s history
into the current branch.
Syntax
$ git merge BranchName

Git log Command


This command is used to check the commit history.
Syntax
$ git log
Git Cheat Sheet
[Link]
[Link]
[Link]
And many more are available on internet
Git Branching
Model
•Git Flow / Git Branching Model
•Git flow is the set of guidelines that
developers can follow when using
Git. We cannot say these guidelines
as rules. These are not the rules; it is
a standard for an ideal project. So
that a developer would easily
understand the things.
•It is referred to as Branching
Model by the developers and works
as a central repository for a project.
Developers work and push their work
to different branches of the main
repository.
Git Branches
There are different types of branches in a project. According to
the standard branching strategy and release management,
there can be following types of branches:
•Master
•Develop
•Hotfixes
•Release branches
•Feature branches
Every branch has its meaning and standard. Let's understand
each branch and its usage.

The Main Branches


Two of the branching model's branches are considered as main
branches of the project. These branches are as follows:
•master
•develop
Git Branches
Master Branch
The master branch is the main branch of the project that contains all the history of final changes. The master branch contains the source
code of HEAD that always reflects a final version of the project.
Your local repository has its master branch that always up to date with the master of a remote repository.

Develop Branch
It is parallel to the master branch. This branch contains the latest delivered development changes for the next release. It has the final
source code for the release. It is also called as a "integration branch."
When the develop branch reaches a stable point and is ready to release, it should be merged with master and tagged with a release
version.
Supportive Branches
The development model needs a variety of supporting branches for the parallel development, tracking of features, assist in quick fixing
and release, and other problems. These branches have a limited lifetime and are removed after the uses.
The different types of supportive branches, we may use are as follows:
•Feature branches
•Release branches
•Hotfix branches
Each of these branches is made for a specific purpose and have some merge targets. These branches are significant for a technical
perspective.
Git Branches
Feature Branches
Feature branches can be considered as topic branches. It is used to develop a
new feature for the next version of the project. The existence of this branch is
limited; it is deleted after its feature has been merged with develop branch.
Git Branches
Release Branches
The release branch is created for the support of a new version release. Senior developers will create a release
branch. The release branch will contain the predetermined amount of the feature branch. The release branch should
be deployed to a staging server for testing.
Developers are allowed for minor bug fixing and preparing meta-data for a release on this branch. After all these
tasks, it can be merged with the develop branch.

When all the targeted features are created, then it can be merged with the develop branch. Some usual standard of
the release branch are as follows:
•Generally, senior developers will create a release branch.
•The release branch will contain the predetermined amount of the feature branch.
•The release branch should be deployed to a staging server for testing.
•Any bugs that need to be improved must be addressed at the release branch.
•The release branch must have to be merged back into developing as well as the master branch.
•After merging, the release branch with the develop branch must be tagged with a version number.
Git Branches
Hotfix Branches
Hotfix branches are like Release branches; both are created for
a new production release.
The hotfix branches arise due to immediate action on the
project. In case of a critical bug in a production version, a hotfix
branch may branch off in your project. After fixing the bug, this
branch can be merged with the master branch with a tag.
Jenkins is an open-source continuous integration tool.

It helps to automate the software development process making it


continuous and reduces manual effort.

Jenkins Jenkins achieves CI (Continuous Integration) with the help of

Overview
plugins.

Jenkins automates day-to-day tasks such as checking out the


sources from source control, building, code analysis, and different
levels of testing and deployment.

Jenkins runs these tasks each time a developer has changed the
source code, can detect any defects much faster meaning that you
maintain applications' quality and reduce time to market.
Jenkins has very large community that
contributes to it regularly.

There is no subscription cost as it is free and


open source.
Jenkins
Benefit It is highly configurable and has a support for
many plugins.

It supports multiple platforms. It is platform


independent. It is available for different
operating systems like Windows or Linux or OSX.
Jenkins Continuous Integration Workflow

Developer

Compile Build Test


Developer Code Repository Deploy

Developer
Jenkins Installation
• Download Jenkins from [Link]

• Get Jenkins war file

• Open command prompt and execute java –jar [Link]


Jenkins Starting
Jenkins Launching
• Open chrome and type URL [Link]

• Enter the password provided in command prompt incase prompted


Jenkins Launching

• Choose first option Install Suggested plugins


Jenkins Launching

• Close pop up
Jenkins Management
• Click on the "Manage Jenkins" option from the left hand of the Jenkins Dashboard page
to manage Jenkins.

• Jenkins Management has many options as mentioned below:


• Configure System
• Configure Global Security
• Global Tool Configuration
• Manage Plugins
• System Information
• System Log
• Load Statistics
• Jenkins CLI
• Reload Configuration from Disk
• Script Console
• Manage Nodes
• About Jenkins
• Manage Old Data and
• Prepare for Shutdown
Jenkins Master and Slave Architecture
• In large software development program, a single Jenkins server would not be sufficient to achieve multiple job’s
execution. Jenkins master slave architecture describe the optimization strategy.
• The Jenkins master acts to schedule the jobs and assign slaves and send builds to slaves to execute the jobs.
• It will also monitor the slave state (offline or online) and getting back the build result responses from slaves and
the display build results on the console output. The workload of building jobs is delegated to multiple slaves.
The master node orchestrates the build process
and manages the overall Jenkins environment, Jenkins
while one or more slave nodes (also known as (Master)
agents) execute the build tasks.
Master Node:
• Manages the Jenkins environment.
• Handles job scheduling and dispatching. Jenkins Jenkins Jenkins
• Maintains the configuration and user (Slave 1) (Slave 2) (Slave 3)
interface.
Slave Nodes (Agents):
• Execute the jobs assigned by the master.
• Can run on different platforms or
environments.
• Allow for parallel execution of builds,
enhancing efficiency.
Prepare Slave Nodes
• Before adding a slave node to the Jenkins master we need to prepare the node. We
need to install Java on the slave node. Jenkins will install a client program on the slave
node. To run the client program we need to install the same Java version we used to
install on Jenkins master.
Configure Jenkins Master & Slave Nodes
• Log in to the Jenkins console via the browser
• click on "Manage Jenkins"
• click on “Nodes & Clouds".
• click on "New Node".
• Select Permanent Agent and click the OK button.
• Click create button
Configure Jenkins Master & Slave Nodes
• In the remote root directory field enter a path in the
slave node.

• Enter the slave nodes IP address in the field in Host field


on selecting launch method as launch agent agents via
SSH.

• Click the Save button


Update Jenkins Generated Admin Password
• Login with default admin and password into Jenkins.
• Click on right top side Admin profile image.
• Click on Configure link.
• Update password and confirm password.
• Click on Apply and Save.
First Jenkins Job
• Login to Jenkins.
• Click on New Item.
• Enter job name and select Freestyle Project.
• Click OK button.
• Click on Configure job.
• Goto Build Steps section and select Execute
Windows batch command.
• Click on Save button.
• Click on Build Now link of this new job to trigger
the build.
Copy Existing Jenkins Job
• Login to Jenkins.
• Click on New Item. Enter job name. Scroll down the page and
click in Copy from option.
• Type an existing job name which is required to be used for
reference. Click on OK.
• Goto Configure option of the newly created job Job 2. Notice it
has all the configurations present in Job 1.
• Now configure the job to modify its description and other
needed details.
Dependent Jenkins Job
• Set up a trigger so that when some other
projects finish building, a new build is scheduled
for this project.

• Select Job 2 and click on configure option.


• Goto Build Triggers option and select Build after
other projects are built.
• Type job name “Job 1” in Project to watch.
• Click Save.

• Now build Job 1.


• Notice first Job 1 completed successfully it
triggers Job 2 automatically.
Build History View
• It displays a list of your past builds, time since build and the status of each build.
• Go to Jenkins dashboard page.
• Select Build history option in the left side.
Trigger Jobs Periodically
• Select a Job and click on configure.

• Jenkins use cron expression which has below format:


• Minutes in one hour 0-59
• Hours in a day 0-23
• Day in a month 1-31
• Month in a year 1-12
• Day of the week 0-7 where 0 and 7 are Sunday
Install Delivery Pipeline
• Start Jenkins by executing command on command prompt.
Java –jar [Link]

• Open browser and provide URL [Link]


• Login screen will appear.
• Enter username and password and click sign in button.

• Click on Manage Jenkins. Click Plugins.


• Click on Available tab. Search Delivery pipeline. Select Plugin and install.
New Job
• Go to dashboard. Click New Item. /Enter item • Provide configuration.
name and select freestyle project. Click ok button.

• Go to dashboard
More Jobs
• Similarly prepare 2 more jobs.

• Go to BuildJob1. Click on Build Now.


Configure
• Edit Job configuration. Select Build after other projects are
Dependent built. Specify the BuildJob1.
Jobs
Create Delivery Pipeline View
• Go to dashboard. On Dashboard near All link, • Enter name. Select Delivery Pipeline View option
there is “+”. Click on + New View button. and click create button.
Create Delivery Pipeline View
• Click Add button under Pipelines  Components option.
Delivery Pipeline View
• Go to dashboard. Click on DeliveryPipeline1 tab.
Execute Chained Dependent Jobs
• Execute BuildJob1 by clicking • Verify dependent chained jobs build history.
Build Now. Check build history.

• Notice that executing only first job Buildjob1 will trigger the other two jobs TestJob1 and DeployJob1 automatically
one after other on their completion.
Verify Delivery Pipeline View
• Go to dashboard. Click on DeliveryPipeline1 tab.
Add More Features to Pipeline View
• Go to Dashboard. Click
DeliveryPipeline1 view. Click on
Edit View.

• Modify Number of pipeline


instances per pipeline from 3 to
4. It will show 4 pipelines
instances for each pipeline.

• Select Enable start of new


pipeline build option. It will
allow starting a new pipeline
run from the delivery pipeline
view.

• Select Enable rebuild option. It


will allow rerunning a task from
the delivery pipeline view.

• Select Show total build time.


Pipeline as a Code
• A reusable method provisioning infrastructure driving automation in software delivery.

• Pipeline as Code allows to define the build and deployment processes as code, making it easier to version
control and manage. Instead of using the traditional Jenkins GUI to create jobs, one can write pipeline logic in
a text file.

• Pipeline as code is a way by which one can define software delivery pipelines as code, stored and versioned in
a source repository.

• Projects must contain a file named Jenkinsfile in the repository root, which contains a "Pipeline script.“

• Presence of the Jenkinsfile in the root of a repository makes it eligible for Jenkins to automatically manage and
execute jobs based on repository branches.

• JenkinsFile contains the steps needed for running a Jenkins pipeline


Jenkins File
• The first block is pipeline. It is the main block that contains the entire declaration of a pipeline.

• Pipeline block will have stages, stage and steps block.

• declarative pipeline structure :

pipeline {
agent any

stages {
stage('Hello') {
steps { echo 'Hello World' }
}
}
}

• pipeline – contains the whole pipeline


• agent – defines the machine that will handle this pipeline
• stages – declares the stages of the pipeline
• steps – small operations inside a particular stage
Simple Scripted Pipeline
• Click New item. Enter a name and select Pipeline. Write a simple script.
• Build Now
Setup Maven in Jenkins
• Click Manage Jenkins. Click Tools.

• Add maven details.

• Click Apply and Save button.


Setup Git Plugin in Jenkins
• Click Manage Jenkins. Click Tools.

• Enter Git.

• Select Git option and click on Install without


restart.

• OR

• If Git is already installed then setup git as


per given screenshot.
Create New GitHub Repository
• Create a repo.

• Open git bash.


Initialize Repository
• Run git init DemoJenkinsfile command.
Create Java Project & Jenkinsfile
• Create a sample Java project. • Add Jenkins file.

• Add code to GitHub


Create Pipeline in Jenkins
• Go to Jenkins and click New Item.

• Enter name DemoJenkinsPipeline, select Pipeline and click ok.

• Select ‘Pipeline from SCM’ from pipeline section.


Create Pipeline in Jenkins
• Click on Build Now.

• Click on logs on the stage.


Maven
• Maven is a powerful project management tool that is based on POM (project object model).

• Maven is an open-source build tool and written in Java.

• It is used for projects build, dependency and documentation.

• Maven is declarative, everything you define in the [Link] file.

• It provides a framework which has a life cycle.

• It performs compilation of Source Code, Running Tests (unit tests and functional tests), Packaging the results
into JAR’s,WAR’s,etc., Upload the packages to remote repo’s (Nexus, Artifactory).

• Some popular IDEs supporting development with Maven Framework like Eclipse, IntelliJ IDEA, Jbuilder,
Spring Tool Suite etc.
Maven Installation
• To install maven on windows,
Download maven from
[Link]
[Link]
and extract it.

• Right click on MyComputer ->


properties -> Advanced System
Settings -> Environment
variables -> click new button

• Add MAVEN_HOME (the path


where maven is installed) in
environment variable
• Add maven path (the path of
bin directory where maven is
installed) in Path environment
variable.

• Verify maven by executing


command on command prompt
Maven Repository
• Maven repositories refer to the directories of
packaged JAR files that contain metadata.
The metadata refers to the POM files
relevant to each project. This metadata is
what enables Maven to download
dependencies.

• Maven has two types of repositories - local,


central. Maven
Repository

Local Central
Repository Repository

It is a directory on the computer where Maven runs. It It refers to any other type of repository, accessed by a variety
caches remote downloads and contains temporary of protocols such as file:// and https:// present on a web
build artifacts that you have not yet released. server, which is used when Maven needs to download
dependencies. Whenever dependency is required from the
remote repository, it is first downloaded to the local
repository, and then used.
Local Repository
• Default local repository is created under %USER_HOME%/.m2 directory.

• There is a way to change the location of maven local repository. Update [Link] file located in
MAVEN_HOME/conf/[Link], for example: C:\apache-maven-3.8.6-bin\apache-maven-3.8.6\conf.

• Default local repository is created under %USER_HOME%/.m2 directory.

• There is a way to change the location of maven local repository. Update [Link] file located in
MAVEN_HOME/conf/[Link], for example: C:\apache-maven-3.8.6-bin\apache-maven-3.8.6\conf.
Central Repository
• Maven central repository is located on the web. It has been created by the apache maven community itself.

• It contains a large number of commonly used libraries.

• When Maven does not find any dependency in local repository, it starts searching in central repository.

• The path of central repository is: [Link] It requires internet access to be searched.

• Sometimes, Maven does not find a mentioned dependency in central repository as well. It then stops the build
process and output error message to console. To prevent such situation, Maven provides concept of Remote
Repository, which is developer's own custom repository containing required libraries or other project jars.

• For example, using below mentioned [Link], Maven will download dependency (not available in central
repository) from Remote Repositories mentioned in the same [Link].
<repositories>
<repository>
<id>companyname.lib1</id>
<url>[Link]
</repository>
<repository>
</repositories>
Maven Build Life Cycle
Compile
• Compile the source code of the project.
Test-compile
• Compile the test source code into the test destination directory.
Test
• Run tests using a suitable unit testing framework (Junit is one).
Package
• Take the compiled code and package it in its distributable format, such as a JAR, WAR, or EAR file.
Integration-test
• Process and deploy the package, if necessary, into an environment where integration tests can be run.
Verify
• Run any check-ups to verify the package is valid and meets quality criteria.
Install
• Install the package into the local repository, which can be used as a dependency in other projects locally.
Deploy
• Copies the final package to the remote repository for sharing with other developers and projects.
Maven Project Structure
• Maven uses a convention for project folder structure. If we follow that, we need not describe in our configuration
setting, what is located where. Maven knows from where to pick the source files, test cases etc. Following is a
snapshot from a Maven project, and it shows the project structure,

• rootproj.
├── [Link]
└── src
├── main
│ └── java
│ └── com
│ └── ecom
│ └── [Link]
└── test
└── java
└── com
└── ecom
└── [Link]
9 directories, 3 files
Maven Project Object Model overview
• To configure the Maven, you need to use Project Object Model, which is stored in a [Link]-file

• POM stands for Project Object Model. It is fundamental unit of work in Maven. It is an XML file that resides in the
base directory of the project as [Link] And has all the configuration settings for the project build.

• Generally we define the project dependencies (Ex: dependent jar files for a project), maven plugins to execute and
project description /version etc.
POM File Elements
• Simplest [Link] should have 4 important information.

• modelVersion-4.0.0 (POM version for Maven 2 and is always required)


• groupId —will identify your project uniquely across all projects, ex:[Link], [Link]
• artifactId — is the name of the jar without version(keeping in mind that it should be jar-name friendly)
• version — if you distribute it then you can choose any typical version with numbers and dots (1.0, 1.1, 1.0.1, …)

<project xmlns="[Link]
xmlns:xsi="[Link]
xsi:schemaLocation="[Link]
[Link]

<modelVersion>4.0.0</modelVersion>
<groupId>[Link]</groupId>
<artifactId>my-app</artifactId>
<version>1</version>

</project>
• There is an element available for declaring dependencies in project [Link] This is used to
define the dependencies that will be used by the project. Maven will look for these dependencies
when executing in the local maven repository. If not found, then Maven will download those
dependencies from the remote repository and store it in the local maven repository. Example
declaring junit and log4j as project dependencies,

•<dependencies>
• <dependency>

Maven •


<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>

Dependen • <scope>test</scope>
• </dependency>

cy
• <dependency>
• <groupId>log4j</groupId>
• <artifactId>log4j</artifactId>
• <version>1.2.12</version>
• <scope>compile</scope>
• </dependency>
• </dependencies>

•scope — describes under which context this dependency will be used.


Maven Plugins
• All the execution in Maven is done by plugins. A plugin is mapped to a phase and executed as part of it. A phase is
mapped to multiple goals. Those goals are executed by a plugin. We can directly invoke a specific goal while Maven
execution. A plugin configuration can be modified using the plugin declaration.

• An example for Maven plugin is ‘compiler’, it compiles the java source code. This compiler plugin has two goals
compiler:compile and compiler:testCompile.

• Using the configuration element, we can supply arguments to the plugin.


<build>
<finalName>springexcelexport</finalName>
<plugins>
<plugin>
<groupId>[Link]</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>[Link]</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin> </plugins>
</build>
Jenkins
Maven Job
• Go to Dashboard  Manage
Jenkins  Global Tool
Configuration
• Refer demo using STS IDE and command prompt.

Maven
webapp
structure,
run,
deploy
SonarQube
• SonarQube is an open-source platform developed by SonarSource for continuous inspection of code
quality to perform automatic reviews with static analysis of code to detect bugs and code smells.

• SonarQube is a Code Quality Assurance tool that collects and analyzes source code, and provides
reports for the code quality of a project.

• It offers reports on duplicated code, coding standards, unit tests, code coverage, code
complexity, comments, bugs, and security recommendations.

• It combines static and dynamic analysis tools and enables quality to be measured continually over
time.
SonarQube Installation
• Install sonarqube server from [Link]

• Extract the downloaded file.


Launch SonarQube
• Execute [Link] file from command prompt.

• Type URL [Link] in the browser to launch SonarQube. Enter admin as both login and password.
Update password on first login. Let’s say sonar.
SonarQube Add User
1. Go to Administration  click Security menu  select 2. Click on create user button
Users from the drop down

3. Click on four
lines icon
present in
new added
user under
Tokens
column
SonarQube Token
• A token pop up screen opens. Provide a name and click on Generate button.

• A token will be generated. Click


on Done to complete token
generation.

• squ_6e9ab0fe67804658a8f6282
9a4fb1a67bd2548da
SonarQube Webhook
• As Jenkins and SonarQube are running separately, we
need to create a Webhook at SonarQube Server so
that both can communicate with each other.

• Login to SonarQube. Click Administration. General


Settings screen appears. Click Security from left side
options. “Enable local webhooks validation” to false.

• Now go to Dashboard. Click Administration. Click on


Configuration menu drop down and select Webhooks

• Click the Create button on the right side to create a


webhook.

• Provide name, URL as ‘JENKINS-URL/sonarqube-


webhook/’ and a secret (DemoJenkinsfile) for
connection with Jenkins. Click on the Create button
to save.
Jenkins Setup for SonarQube
• Login to Jenkins. Go to Dashboard > Manage • Go to Dashboard > Manage Jenkins > Tools.
Jenkins > Plugins. Install SonarQube Scanner Add below details under SonarQube
plugin in Jenkins. Scanner.
Add SonarQube Server Generated Access Token in Jenkins
Go to Dashboard > Manage Jenkins > Credentials > Click on Jenkins line item under Stores scoped to Jenkins section. Click
on Global credentials (unrestricted) hyperlink.

• Click on Add Credentials. Select “Secret Text” field


under Kind. In the Secret field, paste the generated
token from SonarQube that you previously created.
Add SonarQube Server Installation in Jenkins
• Add the SonarQube server to the Jenkins environment. Go to Dashboard > Manage Jenkins > System.

• Add below details under SonarQube servers section. Add SonarQube authentication token in the Server authentication
token drop down.

• Click on Advanced button and add SonarQube webhook token to Jenkins.


Sonar Properties in Maven Project
• Add [Link] file in root folder of the project

• Update Jenkinsfile for sonar analysis stage


Selenium
• Selenium is a free, open-source automated testing framework used to validate web applications.

• It can operate across different browsers and operating systems.

• Testing done using the Selenium testing tool is usually referred to as Selenium Testing.
Selenium Tools
• The list of tools

• Selenium Integrated Development Environment (IDE)


• Selenium Remote Control (RC)
• WebDriver
• Selenium Grid
Selenium Advantages

•It is open source.


• Has capabilities to execute scripts
across different browsers.
• Can execute scripts on various
operating systems.

• Supports mobile devices.


Selenium Disadvantages
•Supports only web-based applications
and not desktop applications.
• No IDE, so the script development
won't be as fast as QTP.
• Cannot access controls within the
browser.

•No default test report generation.


Selenium WebDriver is a web framework that permits to
execute cross-browser tests.

It is an open-source collection of APIs used for automating


web-based application testing to verify that it performs
expectedly.
Selenium It allows you to choose a programming language like
Python, Java, JavaScript, C#, PHP, and Ruby to create test
Webdriver scripts.

It interacts directly with the browser and uses the browser's


engine to control it.

It does not use an additional server like Selenium RC.


It is one of the most popular Open-Source tools and is easy to get
started with for testing web-based applications. It also allows you
to perform cross browser compatibility testing.
Supports multiple operating systems like Windows, Mac, Linux,
Unix, etc.
It provides compatibility with a range of languages including
Python, Java, Perl, Ruby, etc.

Benefits of Provides support for modern browsers like Chrome, Firefox, Opera,
Safari, and Internet Explorer.
Selenium
Selenium WebDriver completes the execution of test scripts faster
Webdriver when compared to other tools
More Concise API (Application Programming interface) than
Selenium RC’s
It also provides compatibility with iPhoneDriver, HtmlUnitDriver,
and AndroidDriver
Support for new browsers is not readily available when
compared to Selenium RC

Limited image, captcha testing.

It does not support the automation of Windows-based


Limitations of applications.

Selenium It does not have any in-built reporting mechanism and


require third party tools like TestNG
Webdriver
There is no test tool integration for test management in
Selenium.

It cannot test mobile applications and requires frameworks


like Appium.
How Selenium WebDriver Works
Test commands are converted Before executing any test cases, The browser then starts
On a high-level, Selenium
into an HTTP request by the every browser has its own driver receiving the request through
WebDriver works in three steps:
JSON wire protocol. which initializes the server. its driver.

Selenium
JSON
Language Browser Real
Wire
Bindings Driver Browser
Protocol
e.g. Java
Selenium Setup
• Pre-requisite : Install Java, Install Java IDE like eclipse, STS

• Download Webdriver Selenium Clients and WebDriver Language Bindings from


[Link]

• Extract downloaded selenium zip file.


Verify ChromeDriver To Be Downloaded
• ChromeDriver has a direct compatibility dependency on the Chrome
browser version, so a compatible version of ChromeDriver is needed to
be downloaded.

• To check the Chrome browser version, click on the three dots on the
right top corner of the browser. Click on Help in the menu. Click on
About Google Chrome in the sub-menu. Click the "About Google
Chrome" option to get the Chrome version.

• Go to [Link] Based on the


Chrome browser version, download the corresponding ChromeDriver.
Install ChromeDriver
• Based on chrome version select the chrome driver either 32 or 64 bit. For example,

• Extract the zip file and place the "[Link]" .


IDE Setup
• Launch STS IDE.

• Select New Java Project from File menu.

• Select Java version.

• Right-click on “SeleniumDemo” and select Properties.

• On the Properties dialog, click on “Java Build Path”.

• Click on the Libraries tab

• Click on “Add External JARs..”

• Select all the JAR files inside and outside the “lib” folder.

• Select Apply and all Selenium libraries got imported into the java project.
Setup ChromeDriver on Windows
• To set up and configure the ChromeDriver with the Selenium, the ChromeDriver executable file should be
accessible in the test script.

• Add a single line of code to set up the system properties for the ChromeDriver.

• [Link]("[Link]", "<Path of the ChromeDriver Executable>");


Selenium + Java Project
• Create a Java file in IDE and use chrome driver APIs to launch chrome browser.

• Right click on Java File and select Run As Java Application.

• Chrome browser gets launched and terminates when


application terminates.
Selenium handling different controls on webpage

A web application requires a browser for a user to


interact with application. The browser renders
the frontend of the application.

Selenium helps to review and analyze the code


behind a web page. It can identify, locate and
interact with webpage elements for testing
purposes.
Forms are the basic web elements used to gather
information from the website users.

These forms are composed of different GUI elements like Text


boxes, Password fields, Checkboxes, Radio buttons, dropdowns,
file inputs, etc.

Web Selenium Web Driver with Java will help to access


Elements these different form elements.

on Selenium encapsulates every form element as an object


of WebElement.
Webpage It has APIs to find these form elements and perform actions like
entering text into text boxes, password fields, selecting a data item
from drop down, clicking the buttons, etc.

WebDriver uses different properties of the Web elements like ID,


Name, Class, XPath, Tagname, CSS Selectors, link Text, etc. to
identify them.
•Web Driver provides the following two WebElement methods to find the elements.
•findElement() – finds a single web element and returns as a WebElement Selenium object.

•findElements() – returns a list of WebElement objects matching the locator criteria.

Find Web •For example,

Element •In a form of a webpage, to capture email id a textbox is created

on
•<input type="text" id="emailId" name="emailId" value="" />

•Now, to extract its value in Selenium based test case, findElement method is used

Webpage •[Link]([Link]("emailId"));

•The method findElement() takes one parameter which is a locator to the element. Different
locators like [Link](), [Link](), [Link](), [Link]() etc. locate the elements in the page
using their properties like“““ id, name or path, etc.
•<label id=“username”>User Name </label>

•getText() method is used in getting the label text.


Label
Control on •This method returns a string value.

Webpage •For example,


•String labelText =
[Link]([Link]("username")).getText();
•Selenium provides various methods to deal with drop down control. Some of them are
mentioned below:

•For selecting the option in dropdown using visible text we use selectByVisibleText method.
This method accepts string value as a parameter. Here we need to pass visible text to this
method.
•Select select=new Select([Link]([Link]("country")));

Dropdown •[Link]("India");

Control on •For selecting the option in dropdown using its index we use selectByIndex method. This
method accepts integer value as a parameter. Here we need to pass option index to this
method.

Webpage •Select select=new Select([Link]([Link]("country")));


•[Link](0);

•For selecting the option in dropdown using option value we use selectByValue method. This
method accepts string value as a parameter. Here we need to pass option value to this
method.
•Select select=new Select([Link]([Link]("country")));
•[Link]("Ind");
Intermediate Discussion of
Project and Assignment

Student’s project progress validation - Jenkins integration with


GIT, a sample maven-based java project
Containerization
•It is the process of packaging
software code, and its
App1 App2 App3 App1 App2
dependencies needed for the
application to run cross platform. Containers

•Containerization is an application- Binaries & Libraries Binaries & Libraries


packaging approach where the
code is written once and capable of
executing anywhere, making the
application highly portable. Container Engine

Host Operating System


A container is a standard unit of
software that packages up code and all
its dependencies, so the application
runs quickly and reliably from one
computing environment to another.

Container images become containers


at runtime and in the case of Docker
Container containers – images become
containers when they run on Docker
Engine.

Containers isolate software from its


environment and ensure that it works
uniformly despite differences for
instance between development and
staging
Portability: A container separates applications from
their host operating system making them portable.

Scalability : A container application withstand rising


workloads by using a service-oriented application design.

Benefits of Faster Development : A container can create a master version of


an image that can be distributed on demand, increasing
application productivity.
Containeriza
High Productivity : Containers allow developers to
tion track and make changes to the source code.

Enhanced Security : Containerization increases security


by adhering to an application separation mechanism.

Continuity : Containerization ensures continuity


because containers operate independently.
Virtualization
• It allows to run different operating
systems on the same physical App1 App2 App3
server’s hardware.
• It is the process of partitioning a
physical server into multiple virtual
servers. Binaries & Binaries & Binaries & Virtual
• The process of partitioning is Libraries Libraries Libraries Machine
carried out using a software called
'hypervisor’.
• A Hypervisor creates an abstract Guest OS Guest OS Guest OS
layer on the computer hardware.

Hypervisor

Host Operating System


Virtualization vs Containerization
Virtualization Containerization

The fundamental unit of virtualization is virtual The fundamental unit of containerization is


machines. containers.
Multiple OS on a single server. Single OS on a single server.

Replicates real hardware OS level virtualization.

VMs have their own OS. Containers share the same OS that is the host OS.

Heavyweight operation. Lightweight operation.

Not portable. Portable.

Complete isolation from host OS. Less isolation from host OS.

Comparatively more start time. Very less start time.


Docker is a centralized platform for
packaging, deploying, and running
applications. Before Docker, many users
face the problem that a particular code
is running in the developer's system but
not in the user's system. So, the main
reason to develop docker is to help
developers to develop applications
easily, ship them into containers, and
can be deployed anywhere.

Docker
Docker is an open-source centralized
platform designed to create, deploy, and
run applications. Docker uses container on
the host's operating system to run
applications. It allows applications to use
the same Linux kernel as a system on the
host computer, rather than creating a
whole virtual operating system. Containers
ensure that our application works in any
environment like development, test, or
production.
The docker container life cycle has five phases:
• Create phase
• Running phase
• Paused phase/unpaused phase
• Stopped phase
• Killed phase

Docker Paused

Container pause unpaused

Life Cycle
d
deleted
create
Create Running Killed

restart stop

Stopped
Docker Installation & Setup
Setup
• Download Docker for windows [Link]

• Double-click Docker Desktop [Link] to run the installer.

• When prompted, ensure the Use WSL 2 instead of Hyper-V option on the Configuration page is selected or not depending on your
choice of backend.

• If your system only supports one of the two options, you will not be able to select which backend to use.

• Follow the instructions on the installation wizard to authorize the installer and proceed with the install.

• When the installation is successful, click Close to complete the installation process.

• If your admin account is different to your user account, you must add the user to the docker-users group. Run Computer
Management as an administrator and navigate to Local Users and Groups > Groups > docker-users. Right-click to add the user to
the group. Log out and log back in for the changes to take effect.
Caching a cluster of containers

Flexible resource sharing

Scalability - many containers can be placed in a single host

Docker Running your service on hardware that is much cheaper than

Benefits standard servers

Fast deployment, ease of creating new instances, and faster


migrations.

Ease of moving and maintaining your applications

Better security, less access needed to work with the code running
inside containers, and fewer software dependencies
Docker Architecture
• Docker uses a Client-server
architecture.
• A command line interface (CLI) where CLIENT Docker HOST Docker Registry
we input docker commands is the
client. Docker Daemon
• Docker CLI will translate the
Docker Run
commands into REST API call, sends it
to docker daemon.
• Docker daemon then evaluates the
request and interacts with the Docker Build
underlying host machine. This docker Containers
daemon is a like server which is the Registry
main processor behind the whole Images
Docker Pull
operation.
• Most of the time docker CLI
interfaces with local docker daemon,
but it is possible you can connect a
Docker client to a remote Docker
daemon.
Docker Engine
• Docker Engine is an open-source containerization
technology for building and containerizing your
applications.
• Docker Engine acts as a client-server application. Docker CLI
• A server with a long-running daemon process dockerd.
• APIs which specify interfaces that programs can use to
talk to and instruct the Docker daemon.
• A command line interface (CLI) client docker.
REST API

Server
Docker Ecosystem
•Dockerfile : A Dockerfile is simply a plain text file that contains a set of user-defined commands, which when executed
by the docker image build Command to build the docker image. To build an image from an application a Dockerfile is
needed. The purpose of the Dockerfile is to automate the image building process, in which all the necessary
dependencies and libraries are installed.

•Dockerimage : Dockerimage is the immutable snapshot of the software with its runtime environment. This can be run
in container at any time later. Every image has a unique ID. Every image has base image, the base image does not have
any parent. Base Docker image represents an operating system, and in the case of Linux, the base image can be one of
its distributions, such as Debian, Alpine Linux. You can also download the Docker images that the other people have
already created and add additional modules to the base image deriving the various images that can exhibit the
preferred behavior.

•Docker layer : Images are typically of the read-only type. Each change that is made to the original image is stored in a
separate layer. The original image and each pre-existing layer remain unchanged. Each layer will get a unique ID.
Docker Ecosystem

•Docker container : Docker container is the top layer of image stack. This is the only top level layer which is read-
write layer. There could be several read-only images beneath the container layer. When this top level container
layer is started, Docker pulls the required image and its parent image. It continues to pull all the parent images until
it reaches the base image.
•Docker registry and repository : Docker repository is storage of docker registry. The registry is for registering the
Docker images, whereas the repository is for storing those registered Docker images in a publicly discoverable and
centralized place. A Docker Registry is a place where the Docker images can be stored in order to be publicly found,
accessed, and used by the. For example, think of this with Git and GitHub. Git is a repository and GitHub is a
registry. Git repository is storage of GitHub registry. You can also host Git repository in Bitbucket, Gitlab registries.
•Registry : A service responsible for hosting and distributing images. The default registry is the Docker Hub.
•Examples of docker registry: Docker Hub, Quay, Google Container Registry, AWS Container Registry
Docker Ecosystem

•Repository : Docker repository is a collection of different docker images with same name that have different tags.
Tag is alphanumeric identifier of the image within a repository.
•Docker Hub Registry : Docker Hub is the public default registry.
•docker pull command will download the images form Docker Hub registry.
•[Link] is the docker hub registry URL.
•This registry has images contributed by Docker community and third parties. If any image you want download form
other registry you should specify the registry URL in the pull command. Following is an example of pulling an image
from a third party repository hub:
• docker pull [Link]/myapp
•Docker daemon : A persistent background process that manages Docker images, containers, networks, and storage
volumes. The Docker daemon constantly listens for Docker API requests and processes them.
Docker Compose

Compose is a tool for defining Compose works in all Using Compose is basically a
and running multi-container environments: production, three-step process:
Docker applications. With staging, development, testing, • Define your app’s environment with a
Compose, you use a YAML file as well as CI workflows. Dockerfile so it can be reproduced
to configure your application’s anywhere.
services. Then, with a single
command, you create and start • Define the services that make up your app
all the services from your in [Link] so they can be run
configuration. together in an isolated environment.
• Run docker compose up and the Docker
compose command starts and runs the
entire app. You can alternatively run
docker-compose up using Compose
standalone(docker-compose binary).
•Docker Swarm is an orchestration management tool that runs
on Docker applications. It helps end-users in creating and
deploying a cluster of Docker nodes.

•Each node of a Docker Swarm is a Docker daemon, and all


Docker daemons interact using the Docker API. Each container
within the Swarm can be deployed and accessed by nodes of

Docker the same cluster.

Swarm •We can use Docker Swarm to make Docker work across
multiple nodes, allowing them to share containers with each
other.

•If one of the containers fails, we can use the Swarm to correct
that failure.

•Docker Swarm can reschedule containers on node failures.


Swarm node has a backup folder which we can use to restore
the data onto a new Swarm.
•Docker supports networking for its containers
via network drivers. These drivers have several
network drivers.

•The network drivers used in Docker are below:


Docker
Networking • Bridge
• Host
• None
• Overlay
• Macvlan
Kubernetes is an open-source orchestration platform designed to
manage containerized applications.

Also known as k8s or kube.

Comes with a capability of automating deployment, scaling of


application, and operations of application containers across clusters.

Kubernetes Capable of creating container centric infrastructure.

Can run application on clusters of physical and virtual machine


infrastructure.

Has the capability to run applications on cloud.

Helps in moving from host-centric infrastructure to container-


centric infrastructure.
Kubernetes is used to manage
and scale applications running in
containers, which are small,
isolated environments. It
simplifies the reliable
management of numerous apps
and services, even when they are
distributed across multiple

Kubernetes servers.

Used For
Kubernetes
automates things
like:
Kubernetes Architecture
Kubernetes Components
A Kubernetes environment is termed a cluster. It includes one or more nodes. A node is simply a machine that will run
your containers. It could be physical hardware or a VM.
The cluster has nodes and a control plane. The control plane coordinates the entire cluster’s operations, schedules new
containers onto available nodes and provides the API server that you interact with.

Kubernetes Component Description


kube-apiserver This is the part of the control plane that runs the API server. It’s the only way to interact with a running
Kubernetes cluster. You can issue commands to the API server using the Kubectl CLI or an HTTP client.
kube-controller-manager The controller manager starts and runs Kubernetes’ built-in controllers. A controller is essentially an
event loop that applies actions after changes in your cluster. They create, scale, and delete objects in
response to events such as an API request or increased load.

kube-scheduler The scheduler assigns new Pods (containers) onto the nodes in your cluster. It establishes which nodes
can fulfill the Pod’s requirements, then selects the most optimal placement to maximize performance
and reliability.

kubelet Kubelet is a worker process that runs on each of your nodes. It maintains communication with the
Kubernetes control plane to receive its instructions. Kubelet is responsible for pulling container images
and starting containers in response to scheduling requests.

kube-proxy Proxy is another component found on individual nodes. It configures the host’s networking system so
traffic can reach the services in your cluster.
Kubernetes Basic Terms
Term Description

Node Nodes represent the physical machines that form Kubernetes cluster. They run the containers created. Kubernetes tracks
the status of nodes and exposes each one as an object.

Namespace Kubernetes namespaces isolate different groups of resources. They avoid name collisions by scoping the visibility of
resources. Creating two objects with the same name is forbidden within the same namespace. For example, one can’t
create two Pods that are both called database. Namespaces resolve this by providing logical separation of resources.

Replica Set Replica Sets are used to consistently replicate a Pod. They provide a guarantee that a set number of replicas will be
running at any time. If a node goes offline or a Pod becomes unhealthy, Kubernetes will automatically schedule a new
Pod instance to maintain the specified replica count.

Deployment Deployments wrap ReplicaSets with support for declarative updates and rollbacks. They’re a higher level of abstraction
that’s easier to control. A Deployment object lets you specify the desired state of a set of Pods. This includes the number
of replicas to run. Modifying the Deployment will automatically detect the required changes and scale the ReplicaSet as
required.

Services Kubernetes Services are used to expose Pods to the network. They allow defined access to Pods either within cluster or
externally. Kubernetes Services are resources that map network traffic to the Pods in cluster. You need to create a Service
each time you expose a set of Pods over the network, whether within your cluster or externally. Services sit in front of
your Pods to achieve this behavior. All network traffic flows into the Service before being redirected to one of the
available Pods.
Diagrams
Deployment
Namespace
Pod
• The pod is a collection of one or more containers with shared storage
• It is the smallest unit of the Kubernetes application
• Pods share the physical resources of the host machine in the form of CPU, RAM and storage
• Pod containers can contain multiple applications

NODE

POD POD

Container Container

Container Container
Puppet

• Puppet is an open-source DevOps configuration management tool.


• It is used to centralize and automate the configuration management procedure.
• It deploys, configures, and manages the servers.
• It is also used as deployment tool and helps in automatic software deployment on the system.
• Open-Source Puppet
• It is a basic version of Puppet configuration
Puppet management tool, which is also known as
Open-Source Puppet. It is available directly
Versions from Puppet’s website and is licensed under
the Apache 2.0 system.
• Puppet Enterprise
• Commercial version that offers features like
compliance reporting, orchestration, role-
based access control, GUI, API, and
command-line tools for effective
management of nodes.
Puppet Architecture
• Puppet is based on a Pull deployment model,
where the agent nodes check in regularly after
every 1800 seconds with the master node to Modules
see if anything needs to be updated in the Environments
Manifests
agent. If anything needs to be updated the
agent pulls the necessary puppet codes from Puppet Server
the master and performs required actions. Templates
The Master:
A Linux based machine with Puppet master Files Inbuilt CA
software installed on it. It is responsible for
maintaining configurations in the form of puppet
codes. The master node can only be Linux.
The Agents:
Puppet Client 1 Puppet Client 2 Puppet Client 3
The target machines managed by a puppet with
the puppet agent software installed on them. Puppet Agent Puppet Agent Puppet Agent
The agent can be configured on any supported
operating system such as Linux or Windows or Factor Factor Factor
Solaris or Mac OS.
The communication between master and agent is
established through secure certificates.
•Ansible is an open source automation and orchestration tool

Ansible for software provisioning, configuration management, and


software deployment.
•Ansible is easy to deploy because it does not use any agents
or custom security infrastructure.
•Ansible is designed for multi-tier deployment.
Advantage •Ansible is free to use.
s of •Ansible is very consistent and lightweight, and no constraints
regarding the operating system.
Ansible •Ansible has comprehensive documentation and easy to learn
structure and configuration.
Playbook
• Ansible Playbooks are the way of sending commands to remote systems through scripts.
• Ansible playbooks are used to configure complex system environments to increase flexibility by
executing a script to one or more systems.
• Playbooks are the files where Ansible code is written. Playbooks are written in YAML format.
• Playbooks are one of the core features of Ansible and tell Ansible what to execute.
• Playbooks are like a to-do list for Ansible that contains a list of tasks.
• Playbooks contain the steps which the user wants to execute on a particular machine.
• Playbooks are run sequentially.
Playbook Structure
• A playbook is a collection of one or more plays. Play
• Playbooks are structured by using Plays. Target
Task Module Environment
• There can be more than one play inside a
playbook. Task
• The function of the play is to map a set of
instructions which is defined against a particular Play
Module
host.
Task
• Tasks are the lists of the actions which
need to perform in the playbooks. Target
Play Environment
• All the playbooks should contain the Module
tasks to be executed. Task

• Tasks are the interface to ansible modules for


roles and playbooks.
• Roles are a collection of tasks, which can be moved
from one playbook to another, can be run
independently but only through a playbook file.

Ansibl • When dealing with extensive playbooks, it is easier to


split the tasks into roles. This also helps in reusing the
roles in the future.

e • Each role is limited to a particular functionality or


desired output.
• Roles are not playbooks. Roles are small functionality

Roles that can be used within the playbooks independently.


• There is no way to directly execute a role. Roles have no
explicit setting for which host the role will apply to.
• Nagios is an open-source continuous
monitoring tool.

Nagio • It monitors complete IT infrastructure


including its networks, systems, applications,

s
services processes etc.
• Nagios has server-agent architecture.

Nagio • Nagios server is installed on the host and plugins are


installed on the remote hosts/servers which are to be
monitored.

s • Nagios sends a signal through a process scheduler to


run the plugins on the local/remote hosts/servers.

Archit • Plugins collect the data (CPU usage, memory usage


etc.) and sends it back to the scheduler.

ecture • Then the process schedules send the notifications to


the admin/s and updates Nagios GUI.
Nagio • The Nagios daemon which run checks on
remote machines in NRPE (Nagios Remote
Plugin Executor).

s • It helps to monitor remote machine metrics


such as disk usage, CPU load etc.

NRPE
• AWS means Amazon Web Services.
• Amazon Web Services (AWS) is a highly available,
secure cloud services platform.

AWS
• AWS is a cloud platform that offers several on-
demand operations like compute power, database
storage, content delivery, etc.
• Providing a pay-as-you-go system.
AWS
• AWS is a very cost-effective service.

Advantages
• It offers billing and management for the centralized
sector, hybrid computing, and fast installation or
removal of your application in any location with few
clicks.
AWS
• AWS has supportive paid packages for intensive or
immediate response. Thus, users might need to pay
extra money for that.
Disadvanta
ges • From region to region, AWS sets some default
limitations on resources such as volumes, images,
or snapshots.
AWS EC2
• EC2 provides compute capacity in the cloud.
• This capacity is secure and resizable based on the
user’s requirements.
• EC2 can expand or shrink the resources provided,
depending on the load the organization is facing.
AWS • It allows you to pay only for compute time.
• No need for provisioning and managing servers.
Serverless Lambda executes code only when required, and
scales automatically.
Service - • It can handle a few requests a day, all the way to
thousands a second.
AWS Lambda
AWS S3
• S3 stands for Simple Storage Service.
• S3 is an object storage.
• It can store and retrieve data from
anywhere: websites, mobile apps, IoT
sensors, and so on.
AWS
• Amazon Glacier is a cloud storage
service that is used for archiving data
and long-term backup.
Glacier • The glacier is used for data archiving
and long-term backup.
AWS EBS
• EBS stands for Elastic Block Store.
• Amazon Elastic Block Store provides
block storage volumes for instances of
Amazon EC2.
• EBS is a reliable storage volume that
can be attached to any running
instance that is in the same availability
zone.
AWS EFS
• EFS stands for Elastic File Storage.
• Amazon EFS provides elastic file storage, which
can be used with AWS Cloud Services and
resources that are on-premises
• It is easy to use and offers a simple interface that
allows you to create and configure file systems
quickly and easily.
AWS RDS
• RDS stands for Relational Database
Service.
• Amazon RDS eases the process
involved in setting up, operating, and
scaling a relational database in the
cloud.
• It helps with tasks like hardware
provisioning, database setup, backup,
and so on.
• It frees us from managing the hardware
and enables us to focus on the
application.
• AWS CodePipeline is a fully managed continuous
delivery service that helps to automate the
release pipelines for fast and reliable application
AWS and infrastructure updates.
• CodePipeline automates the build, test, and
CodePipelin deploy phases of the release process every time
there is a code change, based on the release
e model.
• With AWS CodePipeline, you only pay for what
you use. There are no upfront fees or long-term
commitments.
CI/CD using AWS CodePipeline
Commit Events AWS Trigger AWS
AWS CloudWatch
CodeCommit CodePipeline
Events
Code Files

The typical AWS CodePipeline workflow includes the following stages: Trigger build
Action : Build AWS
Source Stage: This is where the code is stored. The source could be AWS CodeCommit, & Test CodeBuild
GitHub, or S3 where your source code resides. Whenever there is a change in the code,
the pipeline is triggered.
Build Stage: After the code is retrieved, the build process happens. This is done using Stores artefact
AWS CodeBuild or any custom build system. CodeBuild compiles the code, runs tests, Pass
and produces artifacts. AWS S3
Test Stage: This stage runs tests to ensure the build is successful and that no issues bucket
exist in the application.
Deploy Stage: The final step involves deploying the built application to the chosen
environment, such as AWS Elastic Beanstalk, EC2, Lambda, or even on-premises Trigger deploy
Action : AWS
servers.
Deploy in env CodeDeploy

An example of AWS Codepipeline solution has the following workflow:


• A change or commit to the code in the CodeCommit application repository triggers Deploy artefact
CodePipeline with the help of a CloudWatch event.
• The pipeline downloads the code from the CodeCommit repository, initiates the Build EC2 instances
with
and Test action using CodeBuild, and securely saves the built artifact on the S3 bucket.
CodeDeploy
• If the preceding step is successful, the pipeline triggers the Deploy action using agent
CodeDeploy and deploys the app in environment .

You might also like