DEVOPS Lab Answers
DEVOPS Lab Answers
Referencecoursename:SoftwareengineeringandAgilesoftware development
Get an understanding of the stages in the software development lifecycle, the process
models, values and principles of agility and the need for agile software development. This
will enable you to work in projects following an agile approach to software development.
Answer:
PhasesofSoftwareDevelopmentlifecycle.Valuesandprinciplesofagilesoftwaredevelopment. What Is
an SDLC?
Asoftwaredevelopmentlifecycle(SDLC)isamethodologyfollowedtocreatehigh-qualitysoftware.By
adhering toastandardsetoftools,processes,andduties,asoftwaredevelopmentteamcanbuild,design, and develop
products that meet or exceed their clients' expectations.
Phasesof
the
Software
DevelopmentLifeCycle
SDLCprocessesgenerallynumberat6distinctstages:planning,analysis,designing,developmentand testing,
implementation, and maintenance. Each of them is briefly explained below.
1. Planning
The very first phase of the SDLC starts with requirement gathering. This is known as the planning stage.
Itis the most important phase of the entire SDLC from the perspective of project managers and
stakeholders.
Theplanningstageanswerssuchquestionsas:
Howwillthesoftwarebeused?
Whatdatawillserveastheinputofthesoftware?
Whatwillbetheoutputofthesoftware?
Whoisgoingtousethe software?
1|Page
2. Analysis
Once all the requirements are known, it’s time to analyze them for feasibility and validity. The team
decides whether it will be possible to add the requirements to the software. After that, a Requirement
Specification document is designed. This serves as the guide for carrying out the next phase of the SDLC.
3. Designing
This stage includes the designing of requirements specified in the very first phase of the SDLC. In
additiontoassistinginspecifyinghardware andsystem requirements,that stagealsohelpsdefinethe overall
software architecture.
The system design specifications prepared in the designing phase serve as the input for the next i.e.
fourth stage of the SDLC. During the designing phase, testers are required to form an apt testing strategy. It
contains what needs to be tested, and how it needs to be tested.
4. Development&Testing
Some development teams consider development and testing to fall under a single-phase, othersprefer
to break it into two sub-phases. Irrespective of the choice a development team makes, the whole process
remains the same. It’s all a matter of preference. Once the system design documentation iscomplete, the
whole task is divided into modules or units. After that, the actual coding begins.
Because this phase includes coding, it is the most important phase of the SDLC for the developer
team. Moreover, this is the longest phase of the entire software development lifecycle. Once the code isfully
developed, testing is carried out against the requirements. Testing includes functional testing, such as
acceptance testing, integration testing, system testing, and unit testing, as well as non-functional testing.
5. Implementation
Also known as the deployment phase, the implementation phase occurs right after the successful
testing of the software product. It is focused on delivering the software to the end- user or installing it onto
the customer’s system(s).
The first thing that takes place once the product is delivered to the customer is beta testing. All bugs
and enhancements are then reported to the developer team working on the project. Once the changes are
complete, the final deployment takes place.
6. Maintenance
Finally,there’sthemaintenancephase,whichoccursovertimeaftertheproducthasbeen
released. This phase deals with dealing with problems experienced by the customers/end- users while using
the software.
AdvantagesandDisadvantagesofSDLCs
2|Page
WhatisthebestSDLC methodology?
There is no straight answer to this question, as the software life cycle model you choose will depend
on the size and scope of the software you are building, on top of other factors. The best SDLC methodology
will always come down to the requirements and project context.
There are also alternatives to the types of SDLC methodologies detailed further below. The most
popular one is the RAD or Rapid Application Development. RAD offers implementation of CASE tools,
joint application development, and prototyping. The advantages of RAD are active user involvement, afaster
approach, and reduced development cost.
ThemainSDLCmodelsinclude:
Waterfall:Followsasequentialmodelofphases,eachofwhichhasitsowntasksandobjectives
Cleanroom:Aprocessmodelthatremovesdefectsbeforetheycauseseriousissues
Incremental:Requirementsaredividedintomultiplestandalonemodules
V-Model:ProcessesareexecutedsequentiallyinaV-shape(eachstepcomeswithitsown testing
phase)
Prototyping:Aworkingreplicationoftheproductisusedtoevaluatedeveloperproposals
3|Page
BigBang:Requiresverylittleplanningandhasnoformalprocedures;however,it'sahigh- risk
model
Agile:Usescyclical,iterativeprogressiontoproduceworkingsoftware
The last one on the list, Agile, is what we're focusing on today. You see, a traditional SDLC (like
Waterfall) front-loads the work – so if you require a large product, it can take a long time before the team
even builds aworkingprototype. Most softwaredevelopment startups don't havethefinancial means towait
that long. Well-funded competitors could beat them to themarket; so, to makeprocesses morerapid without
compromising on quality, many development companies are embracing the Agile software development
lifecycle.
1. Waterfallmodel:
The waterfall model uses a sequential approach to building any software. Below is the phases waterfall
model as follows:
The model has various phases starting with the Analysis phase. In this phase, you try to analyze the
requirements given by the clients
In the Design phase, the analysis will be transformed into an ordered structure, i.e., you prepare a blueprint
of the software
After completing the design phase, it’s time for developers to get their hands dirty by coding for the
application. This would be the source code, and you test it in the testing process. Different checks on the
application are performed, such as unit testing, integration testing, performance testing, etc
IntheDeploymentphase,thetestedapplicationisdeployedontoproductionservers
Finally comes the Monitoring phase, wherein 60 percent of the entire effort is spent monitoring the
application’s performance
Let’sseeitsadvantagesanddisadvantages
Advantages:
Easytouseandsimpletounderstand
Asit’satop-downapproachprocess,overlappingofthephasesisavoided
Suitableforsmall-projects
4|Page
Easytestingand analysis
Disadvantages:
Changestotheproductarecomplicatedtodrawwhileitisinthetestingstage
Notsuitableforcomplexprojects
Theendproductisonlyavailableattheendofthecycle
To summarize, the Waterfall model was only acceptable for projects with stable specifications. By stable, I
mean that over time, requirements will not change. But this is an improbable thing in today’s world, as
specifications keep changing from time to time.
2. LeanSoftwareDevelopmentLifeCycle
TheLeanmethodologytakesinspirationfromleanmanufacturingpracticesandprinciples.It follows a set
of seven principles, which are:
Eliminatewaste
Amplify/refinelearning
Decideaslateaspossible
Deliverasfastaspossible
Empowertheteam
Emphasizeconceptualintegrity
Seethewhole/Operatingfromthetop-level
In actuality,theLeanmethodologyisverymuchsimilartotheAgilemethodologywithsome noteworthy
differences.
The most important distinction between the two SDLC methodologies lies in terms of
prioritizingcustomersatisfaction.TheAgilemodelmakescustomersatisfactionapriority from the
very beginning. Consequently, the project teams involved respond instantly to stakeholder
feedback throughout the SDLC procedure.
Ontheotherhand,Leanmethodologygivesthetopmostprioritytotheeliminationofwaste. This is
done in order to create more overall value for the clients.
Pros:
Applicableacrossteamboundaries,doingwelltointegrateteamsandoptimizecollaboration.Thus,it works well in
line with the Agile and DevOps methodologies
Facilitatesdeliveringgreaterfunctionalityinashorterspanoftime
2.LeanSoftwareDevelopmentLifeCycle
5|Page
TheLeanmethodologytakesinspirationfromleanmanufacturingpracticesandprinciples.It follows a set
of seven principles, which are:
Eliminatewaste
Amplify/refinelearning
Decideaslateaspossible
Deliverasfastaspossible
Empowertheteam
Emphasizeconceptualintegrity
Seethewhole/Operatingfromthetop-level
In actuality,theLeanmethodologyisverymuchsimilartotheAgilemethodologywithsome noteworthy
differences.
The most important distinction between the two SDLC methodologies lies in terms of prioritizing customer
satisfaction.TheAgilemodelmakescustomersatisfactionapriorityfromtheverybeginning.Consequently, the
project teams involved respond instantly to stakeholder feedback throughout the SDLC procedure.
On the other hand, Lean methodology gives the topmost priorityto the elimination of waste. This is done in
order to create more overall value for the clients.
Pros:
Applicable across team boundaries, doing well to integrate teams and optimize
collaboration.Thus,itworkswellinlinewiththeAgileandDevOpsmethodologies
6|Page
Facilitates delivering greater functionality in a shorter span of time, Easily scalable, making it an apt fit as
an alternative to contemporary SDLC methodologies designed for large, complex projects
Empowers the project development team in terms of the decision-making process. As a result, it improves
motivation
Savescostandtimebyeliminatingunessentialactivities
Cons:
Demands excellent documentation, especially with respect to business requirements. Failing to do it might
result in underdeveloped or wrongly developed areas pertaining to insufficient documentation
Heavily teamdependent.Thismeansitisessentialtoputtogetheranexperiencedteamwitha highskill level
Relativelyeasytolose focus
Easilyscalable,makingitanaptfitasanalternativetocontemporarySDLC
methodologies designed for large, complex projects
Empowerstheprojectdevelopmentteamintermsofthedecision-makingprocess.As a
result, it improves motivation
Savescostandtimebyeliminatingunessentialactivities
Cons:
Demandsexcellentdocumentation,especiallywithrespecttobusinessrequirements.
Failingtodoitmightresultinunderdevelopedorwronglydevelopedareaspertaining to
insufficient documentation
Heavilyteamdependent.Thismeansitisessentialtoputtogetheranexperienced team
with a high skill level
Relativelyeasytolose focus
SpiralSoftwareDevelopmentLifeCycle
7|Page
The Spiral methodology is considered one of the most flexible SDLC models. Typically adopted for full-
blown projects, the Spiral model lets development teams build a highly customized product.
Spiral methodology passes through four phases repeatedly until the project is completed. This allows for
followingmultiple rounds of product refinement. These four phases are planning, risk analysis, engineering,
and evaluation. Each iteration of the Spiral methodology begins with predicting potential risks and the best
way to avoid or mitigate them.
Pros:
Canaccommodatenewchangesorfunctionalityatlaterstagesofdevelopment
Costestimationbecomesastheprototypebuildisdoneinsmallincrements
Betterriskmanagementwithrepeateddevelopment
Emphasizescustomerfeedback
Fasterdevelopmentandsystematicadditionoffeatures
Cons:
Demandsriskmanagementexpertise
Highriskofnotmeetingbudgetorscheduledeadlines
Impracticalforsmallprojects
Muchmoredocumentationduetointermediatephases
8|Page
V Model stands for Verification and Validation Model. Though inspired by the Waterfall model, where the
testing is done at the end of the project, it differs in that it introduces testing at every stage of development.
Similar to the Waterfall model, each next stage of the V model begins only when the previous one has been
completed.
Pros:
Abilitytoavoidthedownwardflowofdefects
Anaptfitforsmallprojectswitheasilyunderstandablerequirements
Higherchancesofsuccess
Offerseaseandsimplicity
Proactivetrackingofpotentialdefects
Savesalotoftimeasplanninganddesigningrelatedtotestingisdonebeforethe actual
coding takes place
Cons:
EvenmorerigidthantheWaterfallmodel
Noearlyprototypecreationispossibleasthesoftwareisdevelopedduringtheimplementationphase
Requirementandtestdocumentsneedtobeupdatedifchangesaremadeduringthedevelopment The
The Agile Manifesto is comprised of four foundational values and 12 supporting principles which lead the
Agile approach to softwaredevelopment. Each Agilemethodologyapplies thefour values in different ways,
but all of them rely on them to guide the development and delivery of high-quality, working software.
1. IndividualsandInteractionsOverProcessesandTools
The first value in the Agile Manifesto is “Individuals and interactions over processes and tools.” Valuing
people more highly than processes or tools is easy to understand because it is the people who respond to
business needs and drive the development process. If the process or the tools drive development, theteam is
less responsive to change and less likely to meet customer needs. Communication is an example of the
differencebetweenvaluingindividualsversusprocess.Inthecaseofindividuals,communicationisfluid
9|Page
and happens when a need arises. In the case of process, communication is scheduled and requires specific
content.
2. WorkingSoftwareOverComprehensiveDocumentation
Historically, enormous amounts of time were spent on documenting the product for development and
ultimate delivery. Technical specifications, technical requirements, technical prospectus, interface design
documents,testplans,documentationplans,andapprovalsrequiredfor each.Thelist wasextensiveandwas
acauseforthelongdelays indevelopment.Agiledoesnoteliminatedocumentation,butitstreamlinesitina formthat
givesthedeveloperwhatisneededtodothework withoutgettingboggeddowninminutiae.Agile documents
requirements as user stories, which are sufficient for a software developer to begin the task of building a
new function.The Agile Manifesto values documentation, but it values working software more.
3. CustomerCollaborationOverContractNegotiation
Negotiation is the period when the customer and the product manager work out the details of a delivery,with
points along the way where the details may be renegotiated. Collaboration is a different creature entirely.
With development models such as Waterfall, customers negotiate the requirements for the product, often in
great detail, prior to any work starting. This meant the customer was involved in the process of development
before development began and after it was completed, but not during the process. The Agile Manifesto
describes a customer who is engaged and collaborates throughout the development process, making. This
makes it far easier for development to meet their needs of the customer. Agile methods may include the
customer at intervals for periodic demos, but a project could just as easily have an end-user as a daily part of
the team and attending all meetings, ensuring the product meets the business needs of the customer.
4. RespondingtoChangeOverFollowingaPlan
Traditionalsoftwaredevelopmentregardedchangeasanexpense,soit wastobeavoided.Theintentionwas to
develop detailed, elaborate plans, with a defined set of features and with everything, generally, having as
high a priority as everything else, and with a large number of many dependencies on delivering in a certain
order so that the team can work on the next piece of the puzzle.
With Agile, the shortness of an iteration means priorities can be shifted from iteration to iteration and new
features can beadded into thenext iteration. Agile’s view is that changes always improve aproject; changes
provide additional value.
Perhaps nothingillustrates Agile’s positive approach to change better than the concept of Method Tailoring,
definedinAn AgileInformationSystemsDevelopmentMethodinuseas:“Aprocessorcapabilityinwhich human
agents determine a system development approach for a specific project situation through responsive changes
in, and dynamic interplays between contexts, intentions, and method fragments.” Agile methodologies allow
the Agileteam to modifythe process and makeit fit theteam ratherthan theotherway around.
TheTwelveAgileManifestoPrinciples
TheTwelvePrinciplesaretheguidingprinciplesforthemethodologiesthat areincludedunderthetitle“The
AgileMovement.”Theydescribeaculturein which changeis welcome, and thecustomeris thefocus ofthe work.
They also demonstrate the movement’s intent as described by Alistair Cockburn, one of the signatories to
the Agile Manifesto, which is to bring development into alignment with business needs.
Thetwelveprinciplesofagiledevelopmentinclude:
10|
1. Customer satisfaction through earlyand continuous software delivery– Customers are happier when they
receiveworkingsoftware at regularintervals, ratherthan waitingextended periods oftimebetween releases.
2. Accommodate changing requirements throughout the development process – The ability to avoid delays
when a requirement or feature request changes.
3. Frequent delivery of working software – Scrum accommodates this principle since the team operates
insoftware sprints or iterations that ensure regular delivery of working software.
4. Collaboration between the business stakeholders and developers throughout the project – Better decisions
are made when the business and technical team are aligned.
5. Support, trust, and motivate the people involved – Motivated teams are more likely to deliver their
bestwork than unhappy teams.
6. Enable face-to-face interactions – Communication is more successful when development teams are co-
located.
7. Working software is the primary measure of progress – Delivering functional software to the customer is
the ultimate factor that measures progress.
8. Agile processes to support a consistent development pace – Teams establish a repeatable and
maintainable speed at which they can deliver working software, and they repeat it with each release.
9. Attention to technical detail and design enhances agility – The right skills and good design ensures the
team can maintain the pace, constantly improve the product, and sustain change.
10. Simplicity–Developjustenoughtogetthejobdoneforrightnow.
11. Self-organizing teams encourage great architectures, requirements, and designs – Skilled and motivated
team members who have decision-making power, take ownership, communicate regularly with other team
members, and share ideas that deliver quality products.
12. Regular reflections on how to become more effective – Self-improvement, process improvement,
advancing skills, and techniques help team members work more efficiently.
The intention of Agile is to align development with business needs, and the success of Agile is apparent.
Agile projects are customer focused and encourage customer guidance and participation. As a result, Agile
has grown to be an overarching view of software development throughout the software industry and an
industry all by itself.
ThePhasesOfAgileSoftwareDevelopmentLifeCycle&WorkflowAndProjectManagement
ProjectManagementPhases
11|
Regardless of the scope, any project should follow a sequence of actions to be controlled and managed.
According to the Project Management Institute (PMI), a typical project management process includes the
following phases:
1. initiation,
2. planning,
3. execution,
4. performance/monitoring,and
5. projectclose.
Usedasaroadmaptoaccomplishspecifictasks,thesephasesdefinetheprojectmanagementlifecycle.
Yet, this structure is too general. A project usually has a number of internal stages within each phase. They
can vary greatly depending on the scope of work, the team, the industry, and the project itself.
In attempts to find a universal approach to managing any project, humanity has developed a significant
number of PM techniques and methodologies.
TraditionalProjectManagementMethodologies
Based on the above-described classic framework, traditional methodologies take a step-by-step approach to
the project execution. Thus, the project goes through the initiation, planning, execution, monitoring straight
to its closure in consecutive stages.
Often called linear, this approach includes a number of internal phases that are sequential and executed in
chronologicalorder.Appliedmostcommonlywithintheconstructionormanufacturingindustry,wherelittle or no
changes are required at every stage, traditional project management has found its application in software
engineering as well.
Known as the Waterfall model, it has been a dominant software development methodology since the early
1970s, when formally described by Winston W. Royce: “There are two essential steps common to all
computer program developments, regardless of size or complexity. There is first an analysis step, followed
second by a coding step … This sort of very simple implementation concept is in fact all that is required if
the effort is sufficientlysmall and if the final product is to be operated bythose who built it – as is typically
done with computer programs for internal use.”
12|
Exercise2:
Referencecoursename:Development&TestingwithAgile:Extreme
Programming: Get a working knowledge of using extreme automation through XP
programming practices of test first development, refactoring and automating test case
writing.
Solve the questions in the “Take test” module given in the reference course nameto gauge
your understanding of the topic.
Answer:
WhatisAgile?
AgileMethodologyinvolvescontinuousiterationofdevelopmentandtestingintheSDLCprocess.This software
development method emphasizes on iterative, incremental, and evolutionary development.
Agiledevelopmentprocessbreakstheproductintosmallerpiecesandintegratesthemforfinaltesting.It can be
implemented in many ways, including scrum, kanban, scrum, XP, etc.
AgileVs.DevOps
StakeholdersandcommunicationchaininatypicalITprocess.
AgileaddressesgapsinCustomerandDevelopercommunications
13|
DevOpsaddressesgapsinDeveloperandITOperationscommunications
KEYDIFFERENCE
DevOpsisapracticeofbringingdevelopmentandoperationsteamstogetherwhereasAgileisan iterative
approach that focuses on collaboration, customer feedback and small rapid releases.
DevOpsfocusesonconstanttestinganddeliverywhiletheAgileprocessfocusesonconstantchanges.
DevOpsrequiresrelativelyalargeteamwhileAgilerequiresasmallteam.
DevOpsleveragesbothshiftsleftandrightprinciples,ontheotherhand,Agileleverageshift-left principle.
The target area of Agile is Software development whereas the Target area of DevOps is to give end-
to-end business solutions and fast delivery.
DevOpsfocusesmoreonoperationalandbusinessreadinesswhereasAgilefocusesonfunctional and non-
function readiness.
DifferenceBetweenAgileandDevOps
Parameter Agile DevOps
Agilereferstoaniterativeapproach
Whatisit? which focuses on collaboration,DevOpsisconsideredapracticeofbringing
customerfeedback,andsmall,rapid development and operations teams together. releases.
Agile helps to manage complexDevOpscentralconceptistomanageend-to-end
Purpose projects. engineeringprocesses.
Agileprocessfocussesonconstant
Task DevOpsfocusesonconstanttestinganddelivery. changes.
ImplementationAgile method canbe implementedTheprimarygoalofDevOpsistofocuson
14|
Parameter Agile DevOps
withinarangeoftacticalframeworkscollaboration,soitdoesn’thaveanycommonly
likeasprint,safeandscrum. acceptedframework.
Agile development emphasizes training
DevOps divides and spreads the skill set between
Teamskillset allteammemberstohaveawide
the development and operation teams.
varietyofsimilarandequalskills.
SmallTeamisatthecoreofAgile.As
team, the fewer people on Relativelylargerteamsizeasitinvolvesallthe smaller is the
Teamsize stack holders.
it,thefastertheycanmove.
AgiledevelopmentismanagedinunitsDevOpsstrivesfordeadlinesandbenchmarks
of“sprints.”Thistimeismuchlessthanwithmajorreleases.Theidealgoalistodeliver
Duration
amonthforeachsprint. codetoproductionDAILYoreveryfewhours.
Feedback Feedback is given by the customer. Feedback comes from the internal team.Target
Areas Software Development End-to-endbusinesssolutionandfastdelivery.
Shift-Left
Leverageshift-left Leveragebothshiftsleftandright.
Principles
Agile emphasizes on software
developmentmethodologyfor
developingsoftware.Whenthe DevOpsisallabouttaking softwarewhichis
Emphasis developed and released, the readyfor release and deploying it in a reliable and software is
secure manner.
agileteamwillnotcarewhathappens
toit.
Anyteammembershouldbeabletodo
what’s required for the progress of the
project. Also, when each team member In DevOps, development teams and operational
Cross- canperformeveryjob,itincreases teamsareseparate.So,communicationisquite
functional complex.
understandingandbondingbetween
them.
DevOps communications involve specs and
Scrum is most common designdocuments.It’sessentialforthe
methods of
implementingAgilesoftware
operationalteamtofullyunderstandthesoftware
development.Dailyscrummeetingis
Communication
carriedout. releaseanditshardware/networkimplicationsfor
adequatelyrunningthedeploymentprocess.
Agile method is to give priority to the IntheDevOps,processdocumentationis
workingsystemovercomplete foremost because it will send the software to the
documentation. It is ideal when you’reoperationalteamfordeployment.Automation
Documentation flexibleandresponsive.However,it minimizestheimpactofinsufficient
canhurtwhenyou’retryingtoturn documentation. However, in the development of
thingsovertoanotherteamforcomplexsoftware,it’sdifficulttotransferallthe
deployment. knowledgerequired.
AutomationistheprimarygoalofDevOps.It
Automation Agile doesn’t emphasize on worksontheprincipletomaximizeefficiency when
automation.Thoughithelps.
deploying software.
ItaddressesthegapbetweencustomerItaddressesthegapbetweendevelopment+
Goal needanddevelopment&testingteams.testingandOps.
15|
Parameter Agile DevOps
It focuseson functionalandnon-Itfocusesmoreonoperationalandbusiness
Focus functionreadiness. readiness.
DevelopingsoftwareisinherenttoDeveloping,testingandimplementationallare
Importance Agile. equallyimportant.
Speedvs.Risk IntheDevOpsmethod,theteamsmustmakesure
Teams using Agile support rapidthat the changes which are made to the
change, and a robust application
structure. architectureneverdeveloparisktotheentire
project.
Agileproducesbetterapplications DevOps,alongwithautomationandearlybug suites with the
desired requirements. It
Quality removal,contributestocreatingbetterquality.caneasilyadaptaccordingtothe
DevelopersneedtofollowCodingand
changesmadeontime,duringtheArchitecturalbestpracticestomaintainquality
projectlife. standards.
JIRA,Bugzilla,KanboardaresomePuppet,Chef,TeamCityOpenStack,AWSare
Toolsused popularAgiletools. popularDevOpstools.
Theagilemethodneedsteamstobe
DevOpsprocessneedstodevelopment,testing
moreproductivewhichisdifficultto
Challenges and production environments to streamline work. match
every time.
Agileoffersshorterdevelopmentcycle
Advantage DevOpssupportsAgile’sreleasecycle. and
improved defect detection.
Exercise3:
Modulename:DevOpsadoptioninprojects
https://infyspringboard.onwingspan.com/web/en/app/toc/
lex_auth_013538989171924992269_shared/overviewhttps://infyspringboard.onwingspan.com/web/
en/app/toc/lex_auth_013267705509019648550/overview
It is important to comprehend the need to automate the software development lifecyclestages
through DevOps. Gain an understanding of the capabilities required to implement DevOps,
continuous integration and continuous delivery practices.Solve the questions given in Quiz1,
Quiz2, Quiz 3
Answer:
16|
DevOpsArchitecture
Developmentandoperationsbothplayessentialrolesinordertodeliverapplications.The
deploymentcomprisesanalyzi therequirements,designing,dev ng,andtestingofthe
ng software components or o elopi
framew
rks.
Theoperationconsistsoftheadministrativeprocesses,services,andsupportforthesoftware
.
Whenboththedevelopmentandoperationsarecombinedwithcollaborating,thentheDevOp
s a
architectureisthesolutiontofixthegapbetweendeploymentandoper tionterms;therefore,
delivery can be faster.
17|
1) Build
WithoutDevOps,thecostoftheconsumptionoftheresourceswasevaluaedbasedonthepre-
definedindividualusagewithfi xedhardwareallocation.AndwithDevO s,theusageofcloud,
sharingof resources comes p the upontheuser'sneed,
into picture,andthebuildisdependent
whichisamechanismtocontroltheusageofresourcesorcapacity.
2) Code
ManygoodpracticessuchasGitenablesthecodetobeused,whichensur eswritingthecodefor
business,helpstotrackchanges,gettingnotifiedaboutthereasonbehindthedifferenceinthe
actualandtheexpectedoutput andifnecessaryrevertingtotheoriginal codedeveloped.The
,
codecanbeappropriatelyarrangedinfiles,folders,etc.Andtheycanbereused.
3) Test
Theapplicationwillbereadyforproductionaftertesting.Inthecaseofmanualtesting,it
consumesmoretime in testing and moving thecodeto theoutput. Thetesting can
beautomated, which decreases the time for testing so that the time to deploy the
code to production can be reduced as automating the running of the scripts will
remove many manual steps.
18|
4) Plan
DevOps use Agile methodology to plan the development. With the operations and
development team in sync, it helps in organizing the work to plan accordingly to
increase productivity.
5) Monitor
Continuous monitoring is used to identify any risk of failure. Also, it helps in tracking
the system accurately so that the health of the application can be checked. The
monitoring becomes more comfortable with services where the log data may get
monitored through many third-party tools such as Splunk.
6) Deploy
Many systems can support the scheduler for automated deployment. The cloud
management platform enables users to capture accurate insights and view the
optimization scenario, analytics on trends by the deployment of dashboards.
7) Operate
DevOps changes the way traditional approach of developing and testing separately.
The teams operate in a collaborative way where both the teams actively participate
throughout the service lifecycle. The operation team interacts with developers, and
they come up with a monitoring plan which serves the IT and business requirements.
8) Release
Deployment to an environment can be done by automation. But when the deployment
is made to the production environment, it is done by manual triggering. Many
processes involved in release management commonly used to do the deployment in
the production environment manually to lessen the impact on the customers.
DevOpsLifecycle
DevOps defines an agile relationship between operations and Development. It is a
process that is practiced by the development team and operational engineers
together from beginning to the final stage of the product.
19|
LearningDevOpsisnotcompletewithoutunderstandingtheDevOpslifecyclephases.TheDevOps lifecycle
includes seven phases as given below:
1) ContinuousDevelopment
Thisphaseinvolvestheplanningand codingofthesoftware.Thevisionoftheprojectisdecidedduringthe planning
phase. And the developers begin developing the code for the application. There are no DevOps tools that are
required for planning, but there are several tools for maintaining the code.
2) ContinuousIntegration
This stage is the heart of the entire DevOps lifecycle. It is a software development practice in which the
developersrequireto commitchangestothesourcecodemorefrequently. Thismaybeon adailyorweekly basis.
Then every commit is built, and this allows early detection of problems if they are present. Building code is
not only involved compilation, but it also includes unit testing, integration testing, code
review, and packaging.
Thecodesupportingnewfunctionalityiscontinuouslyintegratedwiththeexistingcode.
Therefore, there is continuous development of software. The needstobeintegrate
updated code sd ers.
continuouslyandsmoothlywiththesystemstoreflectchangestotheen
d-u
20|
3) ContinuousTesting
Thisphase,wherethedevelop d softwareiscontinuouslytestingforbugs.Forconstanttesting,
e
automationtesting toolssuch asTestNG,JUnit,Selenium, etcareused. ThesetoolsallowQAsto
testmultiplecode-basesthorouhlyinparalleltoensurethatthereisnoflawinthefunctionality.
g
Inthisphase,DockerContainerscanbeusedforsimulatingthetestenvironment.
Seleniumdoestheautomationtesting,andTestNGgeneratesthereports.Thisentiretesting
phasecanautomatewiththehelpofaContinuousIntegrationtoolcalledJenkins.
21|
4) ContinuousMonitorin
g
Monitoring isaphasethat DevOpsprocess, where
involvesalltheoperationalfactorsoftheentire
important information about the use of the software is recorded and carefully
processed to find out trends and identify problem areas. Usually, the monitoring is
integrated within the operational capabilities of the software application.
Itmayoccurintheformofdoumentationfilesormaybeproducelarge-scaledataaboutthe
c
application parameters when it is in a continuous use position. The system errors such
as server not reachable, low memory, etc are resolved in this phase. It maintains the
security and availability of the service.
5) ContinuousFeedback
Theapplicationdevelopmentisconsistentlyimprovedbyanalyzingtheresultsfromtheoperations
ofthesoftware.Thisiscarriedotbyplacingthecriticalphaseofconstantfeedbackbetweenthe
u
operationsandthedevelopmentofthenextversionofthecurrentsoftwareapplication.
ThecontinuityistheessentialfactorintheDevOpsasitremovestheunnecessarystepswhichare
required to take a software application from development, using it out its issues and
to find producing a better version.
s It kills the efficiency that may hthen
be possible with t number of interested customers. eappandreducethe
6) ContinuousDeployment
In thisphase, the codeisdeployed to the production servers. n
Also,itisesse code is correctly used on all the servers. tialto ensurethatthe
22|
The new code is deployed continuously, and configuration management tools play an
essential role in executing tasks frequently and quickly. Here are some popular tools
which are used in this phase, such as Chef, Puppet, Ansible, and SaltStack.
Containerizationtoolsarealsoplayinganessentialroleinthedeployment
phase.VagrantandDockerare popular tools that are used for this purpose. These
tools help to produce consistency across development, staging, testing, and
production environment. They also help in scaling up and scaling down instances
softly.
7) ContinuousOperations
All DevOps operations are based on the continuity with complete automation of the
release process and allow the organization to accelerate the overall time to market
continuingly.
It is clear from the discussion that continuity is the critical factor in the DevOps in
removing steps thatoften distractthedevelopment, takeitlongerto detectissuesand
producea better version of the product after several months. With DevOps, we can
make any software product more efficient and increase the overall count of interested
customers in your product.
DevOpstech:Deploymentautomation
Deployment automation is what enables you to deploy your software to testing and production
environmentswiththepushofabutton.Automationisessentialtoreducetheriskofproduction
deployments. It's also essential for providing fast feedback on the quality of your software by
allowing teams to do comprehensive testing as soon as possible after changes.
Anautomateddeploymentprocesshasthefollowing inputs:
Packagescreatedbythecontinuousintegration(CI)process(thesepackagesshouldbe
deployable to any environment, including production).
Scriptstoconfiguretheenvironment,deploythepackages,andperformadeploymenttest
(sometimes known as a smoke test).
Environment-specificconfigurationinformation.
23|
1. Preparethetargetenvironment,perhapsbyinstallingandconfiguringanynecessarysoftware,or by
starting up a virtual host from a pre-prepared image in a cloud provider such as Google Cloud.
2. Deploythepackages.
3. Performanydeployment-relatedtaskssuchasrunningdatabasemigrationscripts.
4. Performanyrequiredconfiguration.
5. Performadeploymenttesttomakesurethatanynecessaryexternalservicesarereachable,and that the
system is functioning.
Howtoimplementdeploymentautomation
Whenyoudesignyourautomateddeploymentprocess,werecommendthatyoufollowthese best
practices:
Usethesamedeploymentprocessforeveryenvironment,includingproduction.Thisrule helps
ensure that you test the deployment process many times before you use it to deploy to
production.
Allow anyone with the necessary credentials to deploy any version of the artifact to any
environmentondemandinafullyautomatedfashion.Ifyouhaveto createaticketandwait for
someone to prepare an environment, you don't have a fully automated deployment process.
Use the same packages for every environment. This rule means that you should keep
environment-specificconfigurationseparatefrompackages.Thatway,youknowthatthe
packages you are deploying to production are the same ones that you tested.
Make it possible to recreate the state of any environment from information stored in
versioncontrol.Thisrulehelpsensurethatdeploymentsarerepeatable,andthatintheeventof a
disaster recovery scenario, you can restore the state of production in a deterministic way.
Ideally, you have a tool that you can use autonomously to make deployments, that records
whichbuildsarecurrentlyineachenvironment,andthatrecordstheoutputofthedeployment process
for audit purposes. Many CI tools have such features.
DevOpsOrchestration
DevOpsorchestrationistheautomationofnumerousprocessesthatrunconcurrentlyinorderto reduce
production issues and time to market, while automation is the capacity to do a job or a series of
procedures to finish an individual task repeatedly.
24|
Many people believe that DevOps orchestration is just merging several jobs into a larger script,
but it is much more than that. DevOpsorchestration services include such jobs into a process or
workflow,whichmayinvolvemanyautomatedtasksandstages,andresourcestostreamlinethe entire
workflow or process.
Automationcanbeprettycomplicatedatscale,althoughitisusuallyfocusedonaparticular operation to
fulfill a goal, such as a server deployment. When automation has reached its limitations, that’s
when orchestration comes into play.
WhyInvestinDevOpsOrchestration?
DevOpsteamsmustnavigateacrossdepartments,requiringasolutionwheretheirtoolscanalso be
piloted smartly. This situation calls for DevOps orchestration solutions, which have the ability
to combine numerous automated elements from different DevOps toolkits.
WithDevOpsorchestration,teamscanutilizetheircurrentin-useautomationtoolswhilebeing able to
engage under an overarching umbrella designed to pull everything into a single workflow.
WithDevOpsorchestration,teamscanutilizetheircurrentin-useautomationtoolswhilebeing able to
engage under an overarching umbrella designed to pull everything into a single workflow.
25|
1. Accelerateyourautomatinoprocess
n
DevOpsorchestrationensuresseamlessandquickdeliveryofnewbuildsitoproductionand
p
minimizestheeffortspentonreetitivetasks.Asaconsequence,DevOpsteamscanfocus on
o
morecriticalprojectsanddecision-makingratherthanbuildingpipelines.
2. Improvecross-teamcollaboration
Havingaplatformwhereallactivitiesareconsolidatedandupdatedconstantlyboostseffective
communication between operation and development teams, with everyone in sync throughout
all steps.
3. Ensurehigherreleasequality
26|
DevOpsorchestrationlowersthechanceofmistakesreaching theend-user by includingquality
controlactivitiessuchasapprovals,scheduling,securitytesting,andautomaticstatusreporting.
4. ReducecostsforITinfrastructureandhuman resources
DevOps orchestration lowers infrastructure investment costs and the number of IT employees
required.Inthelongrun,firmscanexpandtheircloudservicefootprintandbemoreflexiblein allocating
business costs.
5. BuildtransparencyacrosstheSDLC
Itisn’teasytoestablishclarityandopennessthroughoutaprojectwhentasksandinformation are
siloed. DevOps orchestration is used to coordinate all tasks, centralize data related to all
operations,andprovideupdatesandprogresstokeystakeholdersthroughoutthedevelopment
lifecycle.
6. Boostthevelocityofreleases
Real-lifeApplicationsofDevOps
1. Application of DevOpsintheOnlineFinancialTradingCompany
The methodology in the process of testing, building, and development was automated in the
financial trading company. Using the DevOps, deployment was being done within 45 seconds.
These deployments used to take long nights and weekends for the employees. The time of the
overall process reduced and the interest of clients increased.
27|
2. UseofDevOpsinNetworkcycling
Deployment, testing and rapid designing became ten times faster. It became effortless for the
telco service provider to add patches of security every day, which used to be done only every
three months. Through deployment and design, the new version of network cycling was being
rolled out.
3. ApplicationinCarManufacturingIndustries
Using DevOps, employees helped car manufacturers to catch the error while scaling the
production, which was not possible before.
4. BenefitstoAirlinesIndustries
With the benefit of DevOps, United Airlines saved $500,000 by changing to continuous testing
standards. It also increased its coverage of code by 85%.
5. ApplicationtoGMFinancial
Regression testing time was reduced by 93%, which in turn reduced the funding period of load
by five times.
6. Bug ReductionBenefitof DevOps
DevOps has reduced the bugs by up to 35% and in many cases of pre-production bugs up to
40%. By using DevOps, Rabobank was able to provide better quality applications for their
clients within less time because it massively reduced the time taken for regression testing.
7. LessTimeforIntegration
Key Bank used DevOps to reduce the time taken for the integration of security and compliance
into the process from 3 months to 1 week.
8. DecreasedComputationCostandOperationTime
By the use of DevOps, Computation time has been dramatically reduced. In many cases, it has
reduced the computing time from up to 60%. When the time taken to complete a task is
decreased, then the cost involved the process also decreases.
9. Faster DevelopmentofSoftware
TheDevOpshelpsinthefasterdeliveryofappsbecauseitensuresspeedierdelivery.
10. ImprovementinTeamCollaboration
Transparency is required for better decision-making and works better efficiency of resources.By
using DevOps, teams can be more transparent in their work of developing applications and
software. There are many big tasks of a project which are broken down into many small tasks
that are allotted to different teams or people in the organisation.
11. ReliableEnvironmentsforOperations
DevOps provide a better environment that is more stable for the team to work together. The
people in the group can rely on the environment for all kinds of operations and tasks.
12. EarlyDefectsDetection
In the environment of DevOps, the error and the defects can be known at a very first stage.
DevOps helps in the fast detection of defects.
28|
13. FasterCorrection
With the help of DevOps, All the defects are detected very early. Because of this, mistakes can
be corrected very fast. There is a lot of time which gets saved in this kind of DevOps
environment because the work is very fast, so the correction work is also completed very fast.
14. ContinuousOperationofMonitoring, Testing,Deployment,andRelease
There is a massive demand for software professionals to keep on delivering high-quality
applications and software.DevOps Developer salaryis ever increasing in India. A software
development team is expected to develop the software application within a shorter time period
which can be launched into the market. The team of software is required to adopt a shorter
release cycle.
All of the requirements of delivering high-quality software, developing software applications in
less time frame. Also, a minimum period to launch the software applications and short release
cycles can only be fulfilled by the use of DevOps.
15. Increased Focus onOperations
When less time is taken for the tasks and operation with the help of DevOps, It allows one
person to focus more on the quality of activities and functions. There is more time for one to
give his quality work because now there is DevOps minimize more time to focus as all the time
for other services.
16. AutomationTestingintegrationintoDevOps
When the framework ofautomated testing is integrated into the DevOps,Ithelps to save a lotof
money and time, which then increases the available time and quality of the work.
Exercise4:
29|
https://infyspringboard.onwingspan.com/web/en/app/toc/
lex_auth_01281262696086732810122_shared/overview
Modulename:ImplementationofCICDwithJavaandopensourcestack
ConfigurethewebapplicationandVersioncontrolusingGitusingGitcommandsandversion control
operations.
Answer:
GitInstallationonWindows
Step1:
DownloadthelatestversionofGitandchoosethe64/32bitversion.Afterthefileis
Step2:
ChecktheGitversion:
30|
$git--version
Step3:
Foranyhelp,usethefollowing command:
$githelp config
This command will lead you to a browser of config commands. Basically, the help the
commandprovidesamanualfromthehelppageforthecommandjustfollowingit(here,it's config).
Anotherwaytousethesamecommandisasfollows:
$gitconfig--help
Step4:
Createalocaldirectoryusingthefollowing command:
$mkdirtest
$ cdtest
Step5:
Thenextstepistoinitializethedirectory:
31|
$gitinit
Step6:
Gotothefolderwhere"test"iscreatedandcreateatextdocumentnamed"demo."Open "demo"
and put any content, like "Hello Simplilearn." Save and close the file.
Step7:
EntertheGitbashinterfaceandtypeinthefollowingcommandtocheckthestatus:
$git status
Step8:
Addthe"demo"tothecurrentdirectoryusingthefollowing command:
$ gitadd demo.txt
Step9:
Next,makeacommitusingthefollowingcommand:
$gitcommit-m"committing atextfile"
Step10:
32|
$gitconfig--globaluser.username
Note:simplilearn-githubistheusernameontheGithubaccount. Step
11:
OpenyourGithubaccountandcreateanewrepositorywiththename"test_demo"andclickon "Create
repository." This is the remote repository. Next, copy the link of "test_demo."
Step12:
GobacktoGitbashandlinktheremoteandlocalrepositoryusingthefollowingcommand:
$gitremoteaddorigin<link>
Pushthelocalfileontotheremoterepositoryusingthefollowing command:
$gitpushorigin master
Step14:
MovebacktoGithubandclickon"test_demo"andcheckifthelocalfile"demo.txt"ispushed to this
repository.
AdditionalCustomizationOptions
1. Thisoptionenablesuserstoaddextraelementssuchassymboliclinksforcommandlines.
Nevertheless, one should always prefer default options for shortcuts or more.
33|
2. TherearesomeexperimentaloptionsavailablesuchaspseudocontrolSupportorBuiltinfile system
monitor concerning your installed Git version.
HowtoLaunchGitin Windows?
Therearetwomethodstolaunchgitinwindows.Oneislaunchinggitusingabashscripting shell with
the help of the command line and another is launching git using a graphical user interface.
1. Tolaunchgitviabashscripting shell,
First,openthewindowandsearchforgitbashandopenit.
2. Tolaunchgitviagraphicaluserinterface(GUI),similarly,firstopenthewindowandsearch for git
GUI and click on the application icon and open it.
ConfigureGitHubCredentials
You can configure your local GitHub installation with credentials by using the following
commands.Also,don'tforgettoaddyourownGitHubcredentialsforusernameandemail address.
1. gitconfig–globaluser.n
ame "github_username"
2. gitconfig–globaluser.e
mail "email_address"
CloneaGitHub Repository
1. InitiallyyouneedtoclicktheoptionsrepositoryonGitHub.
2. Theninthetoprightcorner,clicktheoptioncloneordownloadwhereasmalldrop-down box will
appear having a URL for cloning over HTTPS.
3. ThenenterintoyourPowershellwindowsandwritecloneURLas: git
clone repository_url
4. On theother hand, you can clone a github repository with SSH URLs where first you need to
generateanSSHkeypaironyourwindowsworkstationaswellasneedtoassignapublickey to your
GitHub account.
ListRemoteRepositories
34|
1. MakeacopyoftherepositoryfromGitHubforyourworkingdirectory.
2. Ensurethattheworkingdirectoryshouldhavetheprojectnameas
"cdgit_project"andreplacetheprojectnamefromthedownloadedrepository.
3. Iftheaboveoptiondoesn'twork,you can listthecontentusing "lscommand"forthecurrent
directory, especially to check your exact number of spellings.
4. Besides,youcanlisttheremoterepositoryinthesub-directoryas"gitremote-v".
Summary:StepsForGitInstallationonWindows10
1. Downloadandinstall Git
2. Gitbash interface
3. BasicGitcommands
4. Createalocalrepository
5. Connecttotheremoterepository
6. PushthefiletoGitHub
Step1.Downloadtheinstaller
GototheGitForWindowswebsiteandclickonthe[Download]buttontodownloadandsave the
installer. Once downloaded double-click on the .exe file to begin installation.
35|
Step2.License Information
ToaccepttheLicenseAgreementclick[Next>]
36|
Step3.SelectInstallationFolder
Irecommendselectingadirectorypathwithnospacesinthename,asintheillustrationbelow
37|
Step4.SelectComponents
Selectthefollowingcomponentsandfileassociations,thenclick[Next>]
38|
Step5.SelectStartMenu Folder
Step6.ChooseDefaultEditor
39|
40|
Step7.SelectDefaultBranch Name
LetGitdecideandclick[Next>]
41|
Step8.AdjustPATHEnvironment
Makesureyouselect“UseGitfromGitBash only”
Step9.SelectHTTPS transport
SpecifythelibrarytouseforsecureHTTPconnections.GoforOpenSSLunlessyouhavea reason to do
otherwise
42|
43|
Step10.ConfigureLineEndingConversions
Makesureyouselect“CheckoutWindows-style,commitUnix-stylelineendings”
44|
Step11.SelectBehaviourofPullCommand
SelectDefault
45|
Step12.SelectCredentialHeler p
Gowiththerecommendedchoice
46|
Step13.ConfigureExtraOptions
Leaveuncheckedandclick[Next>]
47|
Step14.ConfigureExperimentalOptions
Leaveuncheckedandclick[Next>]
48|
Step15.ProgressBar
Installationbegins…
49|
Step16.InstallationComplete
Clickon[Finish].Congratulations…jobdone!
Exercise5:
Module Name: Implementation of CICD with Java and open source stack Configure a static
code analyzer which willperformstatic analysisof the web application code and identifythe
coding practices that are not appropriate. Configure the profiles and dashboard of the static
code analysis tool. https://infyspringboard.onwingspan.com/web/en/app/search/learning?
lang=en&q=Implementation%20of%20CICD%20with%20Java%20and%20open%20source
%20stack&f=%7B%7D
Exercise-5
50|
SonarQube–GetStartedwithStaticCodeAnalysis!
You are probably familiar with the termstatic code analysis, especially if you have a few years
of experience under your belt.
Andifyourejustgettingstarted,letsgo to thebeginning:
Why isitsoimportant?
Static analysis allows us to identify potential bugs, code smells and security vulnerability even
before our code goes into the production environment.
It allows us to fully enforce code quality practices across multiple teams and prevent
possibleerrors that might occur after the release.
Staticanalysisisanessentialpartoftheproductdevelopmentprocess.
There are a lot of tools that can be leveraged for this purpose today. Some of the most popular
and widely used tools areVeracodeandSonarQube. You can check out the pros and cons, as
well as user reviews for both tools hereand decide which option better suits your needs.
Basicconfiguration
As Java run-time is the main prerequisite, the first thing we need to do is to download andinstall
a Java Development Kit (JDK).
You can run the JDK without setting theJAVA_PATHenvironment variable, or you can
optionallysetitsothatyoucanconvenientlyruntheJDKexecutablefiles
(javac.exe,java.exe,javadoc.exe) from any directory without having to type the full path of the
command. If you do not set theJAVA_PATHvariable, you need to specify the full path to the
executable file everytime yourunit.Ifyouare always lookingforwaystomakeyourworkflow more
efficient, let s choose a more practical way so you don t have to this every time.
51|
NextstepistodownloadSonarQubeserverandextractittoaspecifiedlocatione.g. C:\
sonarqube.
Afterthis,navigatetothe“conf”sub-folderandenterapathtojavaexecutableina wrapper.conf
file
Nowtheonlythingleftistorunsonarserverfromthefollowingpath:
C:\sonarqube\bin\windows-x8664
52|
Ifeverythinggoeswell,youshouldgetamessagethattheSonarserverisupandrunning:
Now,ifyouopenhttp://localhost:9000/addressyoullseethehomescreenfromwhichyoucan log in
and start exploring!
53|
Althoughyoullhaveafullyfunctionalstaticanalysistoolatthispoint,keepinmindthat SonarQube uses
an embedded database. What does this mean?
Anembeddeddatabaseisusedforevaluationpurposesonly.Theembeddeddatabasewill not
scale, it will not support upgrading to newer versions of SonarQube, and there is no
support for migrating your data out of it into a different database engine.
Havingthisinmind,letsavoidtheabove-mentionedlimitationandmakeoursonarmore maintainable!
Settingupthedatabase
Aftersuccessfulinstallation,thefirstthingweneedtodoiscreateourdatabaseandseta proper
collation:
Dontforget:CollationMUSTbecase-sensitive(CS)andaccent-sensitive (AS)
54|
Afterthedatabasehasbeensuccessfullycreated,weneedtocreateserverloginandauser:
55|
56|
Also,makesuretheuserhasDbOwnerrole:
57|
At this point, we are almost done with the database set up. But, before we can test everything
fromSQLmanagementstudioweneedtoenableTCP/IPnetworkprotocolintheconfiguration
manager:
aswellastheSQLserverauthentication mode:
58|
Ifyoufollowedallsteps,youshouldbeabletologintoSonarQubedatabase:
59|
SonarQubeconfiguration
60|
AfterwerunStartSonar.batfile,SonarQubeshouldbeupandrunning! Project
analysis
Thefirstthingweneed todoistocreateanewproject:
Nowadditspathaswellasanms-buildpathtotheenvironmentpathvariable:
61|
Theonly thing thatsleftto donow istorungiven commands,oneafteranother,fromtheroot level of
your project:
62|
Conclusion
If you don t have static code analyzers already configured as a part of your CD/CI
pipeline,pleasedoitbecauseyoulldefinitelywritecleaner,moremaintainableandless bug-
prone code.
Exercise6:
ModuleName:ImplementationofCICDwithJavaandopensource stack
Write a build script to build the application using a build automation tool like Maven. Create
afolderstructurethatwillrunthebuildscriptandinvokethevarioussoftwaredevelopment
63|
build stages. This script should invoke the static analysis tool and unit test cases and deploy
the application to a web application server like Tomcat.
https://infyspringboard.onwingspan.com/web/en/app/search/learning?
lang=en&q=Implementation%20of%20CICD%20with%20Java%20and%20open
%20source%20stack&f=%7B%7D
Exercise-6
Whatisabuildtool?
The build tool is used to set up everything which is required to run your java code
independently. This can be applied to your entire java project. It generates source code,
compilingcode,packagingcodetoajaretc.Mavenprovidesacommonplatformtoperform these
activities which makes programmer’s life easier while handling the huge project.
Maven provides pom.xml which is the core of any project. This is the configuration file where
allrequiredinformation’sarekept.ManyoftheIDEs(IntegratedDevelopmentEnvironments) are
available which makes it easy to use. IDEs are available for tools like Eclipse, NetBeans,
IntelliJ etc.
Mavenstoresallprojectjars.Libraryjarisinaplacecalledrepositorywhichcouldbeacentral, local or
remote repository. Maven downloads the dependency jar from a central repository.
Most of the commonly used libraries are available in http://repo1.maven.org/maven2/.
Downloaded libraries are stored in the local repository called m2. Maven uses the libraries
available in an m2 folder and if any new dependency added then maven downloads from the
centralrepositorytolocalrepository.Iflibrariesarenotavailableinthecentralrepositorythen maven
looks for the remote repository. The user has to configure the remote repository
inpom.xmltodownloadfromtheremote repository.
Below istheexampleofconfiguringaremoterepositorytopom.xmlfile.Provideidand URL of
the repository where libraries are stored.
<repositories>
<repository>
<id>libraryId</id>
<url>http://comanyrepositryId</url>
</repository>
</repositories>
GeneralPhrasesusedin Maven:
groupId:GenerallygroupIdreferstodomainid.Forbestpracticescompanynameis used
as groupId. It identifies the project uniquely.
artifactId:ItisbasicallythenameoftheJarwithoutversion.
version:Thistagisusedtocreateaversionoftheproject.
Localrepository:Mavendownloadsalltherequireddependenciesandstoresinthelocal
repository called m2. More details regarding the same would be shared in the next topic.
BuildLife Cycle:
64|
Basicmavenphasesareusedasbelow.
clean:deletesallartifactsandtargetswhicharecreated already.
compile:usedtocompilethesourcecodeoftheproject.
test:testthecompiledcodeandthesetestsdonotrequiretobepackagedordeployed.
package:packageisusedtoconvertyourprojectintoajarorwaretc.
install:installthepackageintothelocalrepositoryforuseofanotherproject.
MavenSetup:
Step1:TosetupMaven,downloadthemaven’slatestversionformApachedependingupon different
OS.
Step2:Unzipthefolderandsaveitonthelocaldisk.
Step3:CreateenvironmentvariableforMAVEN_HOME.Followthebelowstep:
NavigatetoSystemProperties->AdvancedSystemSettings>EnvironmentVariable->System
Variable ->New ->Add path of Maven folder
65|
Step4:Editpathvariableandprovidethebinfolderpath.
Step5:Nowverifythemaveninstallationusingcommandpromptanddon’tforgettosetup JAVA_HOME
Usemvn–versiontoverifymavenversionandoutputcomeslikebelow.
InstallmavenIDEinEclipse:
MavenprovidesIDEtointegratewitheclipse.IamusingeclipseJunohere.
NavigatetoHelp->EclipseMarketplace->Searchmaven->MavenIntegrationforEclipse-
>INSTALL
66|
Afterinstallation,youhavetorestarteclipse.
Thenright-clickonpom.xmlandverifyalltheoptionsareavailablelikebelow.
CreateMavenproject:
Step1:NavigatetoFile-new-others-Maven-MavenProject-ClickNext
67|
Step2:ChecktheCreateasimpleprojectandclick Next
68|
Step4:Afterfinish,youwillfind theprojectstructureiscreated likebelow.pom.xmliscreated which is
used to download all dependencies.
pom.xmlfilelookslike below:
<projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/
XMLSchehttp://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.softwaretestinghelp.test</groupId>
<artifactId>com.softwaretestinghelp.selenium</artifactId>
<version>0.0.1-SNAPSHOT</version>
</project>
Step5:Adddependenciesfor Selenium.
AllseleniumMavenartifactsareavailableinbelowcentralrepository
69|
http://repo1.maven.org/maven2/org/seleniumhq/selenium/
Add following dependencies in pom.xml for selenium
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.41.0</version>
</dependency>
Similarly,followingisthedependencyforJunit:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
</dependency>
Ifyouwanttoaddotherthird-partyjarsthenaddthosedependenciesinpom.xml
Step6:Finalpom.xmlwillbelikebelow:
<projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/
XMLSchehttp://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.softwaretestinghelp.test</groupId><artifactId>com.softwaretestinghelp.selenium</arti
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.41.0</version>
</dependency>
</dependencies>
</project>
Step7:Mavenwilldownloadallthedependencyjarsintothelocalrepositorycalled.m2. M2 folder
is basically inside Users->username->m2
Allthejarswillbeplacedinafoldercalledrepositorywhichisinside.m2folder.Mavenwill create
separate folders for the different version and different group id.
70|
Step8:Ifan m2 folderdoesnotpopulateinMaven dependencies,thenyou canpopulatethose jars
manually.
– EclipseWindows->Preference
– NavigateJava->BuildPath->ClasspathVariables
– ClickNewButton->DefineM2_REPOandprovidethepathofthem2folder.
71|
Step9:Uponsuccessfulsetup,youwillfindMavenDependenciesfolderlikebelowwhichwill have the
required dependency jar for the project
Buildthe Project:
TheprojectcanbebuiltbybothusingIDEandcommandprompt. Using
Entergoalslikecleaninstalletc.andclickRun.
Samecanbedoneusingacommandprompt.Navigatetoprojectfolderwherepom.xmllies. And use
below commands to clean, compile and install
Forclean:mvnclean
Forcompile:mvncompile
ForInstall:mvninstall
72|
Belowistheinfowhichisdisplayedwhenyoucleananyprojectandshows“BUILD
SUCCESS”.
[INFO]Scanningforprojects... [INFO]
[INFO]
[INFO]Buildingcom.softwaretestinghelp.0.0.1-SNAPSHOT
[INFO]
[INFO]
[INFO]---maven-clean-plugin:2.4.1:clean(default-clean)@com.softwaretestinghelp---[INFO]Delet
[INFO]
[INFO]BUILDSUCCESS
[INFO]
[INFO]Totaltime:0.702s
[INFO]Finishedat:SatMay2418:58:22IST2014 [INFO]
Final Memory: 2M/15M
[INFO]
Conclusion:
Mavensimplifiesthecodehandling andprocessofbuilding theproject.Mostoftheprojects follow
maven structure.
Download all dependencies provided the dependencies are available in maven central
repository.Ifanyofthedependencyisnotavailableinmavencentralrepositorythenyouhave to add
repository path in pom.xml explicitly.
Therearemanyotherbuildtoolsavailableinlikeant.Butitisbettertousemavenwhiledealing with
different versions and different dependencies. Maven even can manage the dependenciesof
dependencies. Other tools may not provide such flexibility like maven. Please post your queries
anything related to maven here.
NextTutorial#25:Intheupcomingtutorial,wewoulddiscusscontinuousintegrationtool known as
Hudson. We would study about its importance, role and benefits into Test Automation
Framework.Wewould look at the Hudson straight from the beginning, fromits installation to its
working.
Exercise-7
Windows
Tableof Contents
Prerequisites
InstallationstepsusingWindowsMSIinstaller
SilentInstallwith theMSIinstallers
Post-installationsetupwizard
73|
o UnlockingJenkins
o CustomizingJenkinswithplugins
o Creatingthefirstadministratoruser
TroubleshootingWindowsinstallation
o Invalidservicelogoncredentials
The simplest way to install Jenkins on Windows is to use the Jenkins Windows installer. That
program will install Jenkins as a service using a 64 bit JVM chosen by the user. Keep in mind
thatto run Jenkinsasaservice,theaccountthatrunsJenkinsmusthavepermission to login asa service.
Prerequisites
Minimumhardwarerequirements:
256MBofRAM
1GBofdrivespace(although10GBisarecommendedminimumifrunningJenkinsasa Docker
container)
Recommendedhardwareconfigurationforasmallteam:
4 GB+ ofRAM
50 GB+ of drive space
Comprehensivehardwarerecommendations:
Hardware:seetheHardwareRecommendationspage
Software requirements:
Java:seetheJavaRequirementspage
Webbrowser:seetheWebBrowserCompatibilitypage
ForWindowsoperatingsystem:WindowsSupportPolicy
ForLinuxoperatingsystem:LinuxSupportPolicy
Step1:Setupwizard
OnopeningtheWindowsInstaller,anInstallationSetupWizardappears,ClickNexton the
Setup Wizard to start your installation.
74|
Step2:Selectdestinationfolder
SelectthedestinationfoldertostoreyourJenkinsInstallationandclickNextto continue.
75|
Step3:Servicelogoncredentials
WhenInstallingJenkins,itisrecommendedtoinstallandrunJenkinsasanindependent windows
service using a local or domain user as it is much safer than running Jenkins
usingLocalSystem(Winowsequivalentofroot)whichwillgrantJenkinsfullaccessto
d
yourmachineandservices.
To run Jenkins service using a local or domain user, specify the domain user name and
passwordwithwhichyouwanttorunJenkins,clickonTestCredentialstotestyourdomain credentials
and click on Next.
76|
IfyougetInvalidLogonErrorpop-upwhiletryingtotestyourcredentials,followthes
Step4:Portselection
77|
Step5:SelectJavahome directory
The installation process checks for Java on your machine and prefills the dialog with the
Javahomedirectory.IftheneededJavaversionisnotinstalledonyourmachine,youwill be
prompted to install it.
OnceyourJavahomedirectoryhasbeenselected,clickonNexttocontinue.
78|
Step6:Customsetup
SelectotherservicesthatneedtobeinstalledwithJenkinsandclickonNext.
79|
Step7:InstallJenkins
ClickontheInstallbuttontostarttheinstallationofJenkins.
80|
Additionally,clickingontheInstallbuttonwillshowtheprogressbarofinstallation,asshown below:
81|
Step8:FinishJenkinsinstallation
Oncetheinstallationcompletes,clickonFinishtocompletetheinstallation.
JenkinswillbeinstalledasaWindowsService.Youcanvalidatethisbybrowsing the
services section, as shown below:
82|
Seetheupgradestepswhenyouupgradetoanew release.
SilentInstallwiththeMSIinstallers
MSIinstallerscanbeinstalledviaasilentmethod,which can showbasicUI(/qb)ornoUIatall (/qn). The
silent method does notprompt for user input so there are properties thatyou can pass to the
installer to set the specific values.A very basic command line is shown below for a silent install.
msiexec.exe/i"path\to\jenkins.msi"/qn/norestart
Thiswilluseallofthedefaultvaluesforthingsthatwouldnormallybeapromptsuch as:
Installationdirectory
Serviceaccountusername/password
Javainstallationdirectory
TheportforJenkinstolisten on
EachofthesethingscanbeoverriddenbypassingaNAME=VALUEpropertypairforwhatyou want to
override:
83|
PropertyName Description
PathtothedirectorytoinstallJenkins.(Default:C:\Program Files\Jenkins)
INSTALLDIR
PORT TheportJenkinswilllistenon.(Default:8080)
The directory where java.exe can be found. (Default: The first Java
JAVA_HOME runtimefoundintheregistrywithJava11beinghigherprioritythan Java 17)
Theusernamethattheserviceshouldrunas.Theaccountmusthave
SERVICE_USERNAME LogonAsService permissions. (Default: In silent mode, the
LOCALSYSTEM account)
The password for the SERVICE_USERNAME account. This should
SERVICE_PASSWORD onlybeprovidedifSERVICE_USERNAMEisprovided.(Default:In silent
mode, none for LOCALSYSTEM)
Amorecomplexexample,includingthecreationofalogfilefortheinstallationprocessis shown
below:
msiexec.exe/i"path\to\jenkins.msi"/qn/norestartINSTALLDIR="D:\Jenkins"
JAVA_HOME="C:\ProgramFiles\SomeJava"PORT=80/L*v"path\to\logfile.txt"
ThiswouldinstallJenkinsintoD:\Jenkins,usetheJavaruntimefromC:\Program Files\
SomeJava and Jenkins would be listening on port 80.
Post-installationsetupwizard
Afterdownloading,installingandrunningJenkins,thepost-installationsetupwizardbegins.
Thissetupwizardtakesyouthroughafewquick"one-off"stepstounlockJenkins,customizeit with
plugins and create the first administrator user through which you can continue accessing
Jenkins.
UnlockingJenkins
WhenyoufirstaccessanewJenkinsinstance,youareaskedtounlockitusinganautomatically- generated
password.
Step1
Browsetohttp://localhost:8080(orwhicheverportyouconfiguredforJenkinswhen installing
it) and wait until the Unlock Jenkins page appears.
84|
Step2
TheinitialAdministratorpasswordshouldbefoundundertheJenkinsinstallationpath (set at
Step 2 in Jenkins Installation).
FordefaultinstallationlocationtoC:\ProgramFiles\Jenkins,afile
calledinitialAdminPasswordcanbefoundunderC:\ProgramFiles\Jenkins\secrets.
85|
Step3
OpenthehighlightedfileandcopythecontentoftheinitialAdminPasswordfile.
Step4
OntheUnlockJenkinspage,pastethispasswordintotheAdministrator password
field and click Continue.
Notes:
YoucanalsoaccessJenkinslogsinthejenkins.err.logfileinyourJenkins
directory specified during the installation.
TheJenkinslogfileisanotherlocation(intheJenkinshomedirectory)wherethe initial
password can also be
86|
obtained.
This password must be entered in the setup wizard on new Jenkins installations
beforeyoucanaccessJenkins’smainUI.Thispasswordalsoservesasthedefault
administrator account’s password (with username "admin") if you happen to skip
the subsequent user-creation step in the setup wizard.
CustomizingJenkinswithplugins
AfterunlockingJenkins,theCustomizeJenkinspageappears.Hereyoucaninstallanynumber of
useful plugins as part of your initial setup.
Clickoneofthetwooptions shown:
Installsuggestedplugins-toinstalltherecommendedsetofplugins,whicharebasedon most
common use cases.
Selectpluginstoinstall-tochoosewhichsetofpluginstoinitiallyinstall.Whenyou first
access the plugin selection page, the suggested plugins are selected by default.
Ifyouarenotsurewhatpluginsyouneed,chooseInstallsuggestedplugins.Youcani point in
time via the Manage Jenkins>Manage Pluginspage in Jenkins.
ThesetupwizardshowstheprogressionofJenkinsbeingconfiguredandyourchosensetof Jenkins
plugins being installed. This process may take a few minutes.
Creatingthefirstadministrator user
Finally,aftercustomizingJenkinswithplugins,Jenkinsasksyoutocreateyourfirst
administrator user.
1. WhentheCreateFirstAdminUserpageappears,specifythedetailsforyour
administrator user in the respective fields and click Save and Finish.
2. WhentheJenkinsisreadypageappears,clickStartusingJenkins.
Notes:
o ThispagemayindicateJenkinsisalmostready!insteadandifso,clickRestart.
87|
o Ifthepagedoesnotautomaticallyrefreshafteraminute,useyourwebbrowserto refresh
the page manually.
3. Ifrequired,logintoJenkinswiththecredentialsoftheuseryoujustcreatedandyouare ready to
start using Jenkins!
TroubleshootingWindowsinstallation
Invalid service logon credentials
Wheninstallingaservicetorununderadomainuseraccount,theaccountmusthavetherightto logon as a
service. This logon permission applies strictly to the local computer and must be granted in the
Local Security Policy.
PerformthefollowingstepsbelowtoedittheLocalSecurityPolicyofthecomputeryouwantto define
the ‘logon as a service’ permission:
1. Logontothecomputerwithadministrativeprivileges.
2. OpentheAdministrativeToolsandopentheLocalSecurity Policy
3. ExpandLocalPolicyandclickonUserRightsAssignment
4. Intherightpane,right-clickLogonasaserviceandselectproperties.
5. ClickontheAddUserorGroup…buttontoaddthenewuser.
88|
6. IntheSelectUsersorGroupsdialogue,findtheuseryouwishtoenterandclickOK
7. Click OK in the Log on as a service Properties to save changes.
Aftercompletingthestepsabove,trylogginginagainwiththeaddeduser.
Exercise8:
Modulename:ImplementationofCICDwithJavaandopensourcestack
Configure the Jenkins pipeline to call the build script jobs and configure to run it whenever
there is a change made to an application in the version control system. Make a change to the
backgroundcolorofthelandingpageofthewebapplicationandcheckiftheconfigured pipeline
runs. https://infyspringboard.onwingspan.com/web/en/app/search/learning?
lang=en&q=Configure
%20the%20Jenkins%20pipeline%20to%20call%20the%20build%20script%20jobs%20and
%20configure%20to%20run%20it%20whenever%20there%20is%20a%20change%20made
%20to%20an%20application%20in%20the%20version%20control%20system.%20Make
%20a%20change%20to%20the%20background%20color%20of%20the%20landing%20page
%20of%20the%20web%20application%20and%20check%20if%20the%20configured
%20pipeline%20runs.&f=%7B%7D
--------------------------------------------------------------------------------------------------------------------
Exercise9:
Modulename:ImplementationofCICDwithJavaandopensourcestack
Create a pipeline view of the Jenkins pipeline used in Exercise 8. Configure it with user
defined messages. https://infyspringboard.onwingspan.com/web/en/app/search/learning?
lang=en&q=Create%20a%20pipeline%20view%20of%20the%20Jenkins%20pipeline
%20used%20in%20Exercise
%208.%20Configure%20it%20with%20user%20defined%20messages.&f=%7B%7D
Windows
Tableof Contents
Prerequisites
InstallationstepsusingWindowsMSIinstaller
SilentInstallwith theMSIinstallers
Post-installationsetupwizard
o UnlockingJenkins
o CustomizingJenkinswithplugins
89|
o Creatingthefirstadministratoruser
TroubleshootingWindowsinstallation
o Invalidservicelogoncredentials
The simplest way to install Jenkins on Windows is to use the Jenkins Windows installer. That
program will install Jenkins as a service using a 64 bit JVM chosen by the user. Keep in mind
thatto run Jenkinsasaservice,theaccountthatrunsJenkinsmusthavepermission to login asa service.
Prerequisites
Minimumhardwarerequirements:
256MBofRAM
1GBofdrivespace(although10GBisarecommendedminimumifrunningJenkinsasa Docker
container)
Recommendedhardwareconfigurationforasmallteam:
4 GB+ ofRAM
50 GB+ of drive space
Comprehensivehardwarerecommendations:
Hardware:seetheHardwareRecommendationspage
Software requirements:
Java:seetheJavaRequirementspage
Webbrowser:seetheWebBrowserCompatibilitypage
ForWindowsoperatingsystem:WindowsSupportPolicy
ForLinuxoperatingsystem:LinuxSupportPolicy
Step1:Setupwizard
OnopeningtheWindowsInstaller,anInstallationSetupWizardappears,ClickNexton the
Setup Wizard to start your installation.
90|
Step2:Selectdestinationfolder
SelectthedestinationfoldertostoreyourJenkinsInstallationandclickNextto continue.
91|
Step3:Servicelogoncredentials
WhenInstallingJenkins,itisrecommendedtoinstallandrunJenkinsasanindependent windows
service using a local or domain user as it is much safer than running Jenkins
usingLocalSystem(Winowsequivalentofroot)whichwillgrantJenkinsfullaccessto
d
yourmachineandservices.
To run Jenkins service using a local or domain user, specify the domain user name and
passwordwithwhichyouwanttorunJenkins,clickonTestCredentialstotestyourdomain credentials
and click on Next.
92|
IfyougetInvalidLogonErrorpop-upwhiletryingtotestyourcredentials,followthes
Step4:Portselection
93|
Step5:SelectJavahome directory
The installation process checks for Java on your machine and prefills the dialog with the
Javahomedirectory.IftheneededJavaversionisnotinstalledonyourmachine,youwill be
prompted to install it.
OnceyourJavahomedirectoryhasbeenselected,clickonNexttocontinue.
94|
Step6:Customsetup
SelectotherservicesthatneedtobeinstalledwithJenkinsandclickonNext.
95|
Step7:InstallJenkins
ClickontheInstallbuttontostarttheinstallationofJenkins.
96|
Additionally,clickingontheInstallbuttonwillshowtheprogressbarofinstallation,asshown below:
97|
Step8:FinishJenkinsinstallation
Oncetheinstallationcompletes,clickonFinishtocompletetheinstallation.
JenkinswillbeinstalledasaWindowsService.Youcanvalidatethisbybrowsing the
services section, as shown below:
98|
Seetheupgradestepswhenyouupgradetoanew release.
SilentInstallwiththeMSIinstallers
MSIinstallerscanbeinstalledviaasilentmethod,which can showbasicUI(/qb)ornoUIatall (/qn). The
silent method does notprompt for user input so there are properties thatyou can pass to the
installer to set the specific values.A very basic command line is shown below for a silent install.
msiexec.exe/i"path\to\jenkins.msi"/qn/norestart
Thiswilluseallofthedefaultvaluesforthingsthatwouldnormallybeapromptsuch as:
Installationdirectory
Serviceaccountusername/password
Javainstallationdirectory
TheportforJenkinstolisten on
EachofthesethingscanbeoverriddenbypassingaNAME=VALUEpropertypairforwhatyou want to
override:
99|
PropertyName Description
PathtothedirectorytoinstallJenkins.(Default:C:\Program Files\Jenkins)
INSTALLDIR
PORT TheportJenkinswilllistenon.(Default:8080)
The directory where java.exe can be found. (Default: The first Java
JAVA_HOME runtimefoundintheregistrywithJava11beinghigherprioritythan Java 17)
Theusernamethattheserviceshouldrunas.Theaccountmusthave
SERVICE_USERNAME LogonAsService permissions. (Default: In silent mode, the
LOCALSYSTEM account)
The password for the SERVICE_USERNAME account. This should
SERVICE_PASSWORD onlybeprovidedifSERVICE_USERNAMEisprovided.(Default:In silent
mode, none for LOCALSYSTEM)
Amorecomplexexample,includingthecreationofalogfilefortheinstallationprocessis shown
below:
msiexec.exe/i"path\to\jenkins.msi"/qn/norestartINSTALLDIR="D:\Jenkins"
JAVA_HOME="C:\ProgramFiles\SomeJava"PORT=80/L*v"path\to\logfile.txt"
ThiswouldinstallJenkinsintoD:\Jenkins,usetheJavaruntimefromC:\Program Files\
SomeJava and Jenkins would be listening on port 80.
Post-installationsetupwizard
Afterdownloading,installingandrunningJenkins,thepost-installationsetupwizardbegins.
Thissetupwizardtakesyouthroughafewquick"one-off"stepstounlockJenkins,customizeit with
plugins and create the first administrator user through which you can continue accessing
Jenkins.
UnlockingJenkins
WhenyoufirstaccessanewJenkinsinstance,youareaskedtounlockitusinganautomatically- generated
password.
Step1
Browsetohttp://localhost:8080(orwhicheverportyouconfiguredforJenkinswhen installing
it) and wait until the Unlock Jenkins page appears.
100|
Step2
TheinitialAdministratorpasswordshouldbefoundundertheJenkinsinstallationpath (set at
Step 2 in Jenkins Installation).
FordefaultinstallationlocationtoC:\ProgramFiles\Jenkins,afile
calledinitialAdminPasswordcanbefoundunderC:\ProgramFiles\Jenkins\secrets.
101|
Step3
OpenthehighlightedfileandcopythecontentoftheinitialAdminPasswordfile.
Step4
OntheUnlockJenkinspage,pastethispasswordintotheAdministrator password
field and click Continue.
Notes:
YoucanalsoaccessJenkinslogsinthejenkins.err.logfileinyourJenkins
directory specified during the installation.
TheJenkinslogfileisanotherlocation(intheJenkinshomedirectory)wherethe initial
password can also be
102|
obtained.
This password must be entered in the setup wizard on new Jenkins installations
beforeyoucanaccessJenkins’smainUI.Thispasswordalsoservesasthedefault
administrator account’s password (with username "admin") if you happen to skip
the subsequent user-creation step in the setup wizard.
CustomizingJenkinswithplugins
AfterunlockingJenkins,theCustomizeJenkinspageappears.Hereyoucaninstallanynumber of
useful plugins as part of your initial setup.
Clickoneofthetwooptions shown:
Installsuggestedplugins-toinstalltherecommendedsetofplugins,whicharebasedon most
common use cases.
Selectpluginstoinstall-tochoosewhichsetofpluginstoinitiallyinstall.Whenyou first
access the plugin selection page, the suggested plugins are selected by default.
Ifyouarenotsurewhatpluginsyouneed,chooseInstallsuggestedplugins.Youcaninstall (or
ManageJenkins>ManagePluginspageinJenkins.
ThesetupwizardshowstheprogressionofJenkinsbeingconfiguredandyourchosensetof Jenkins
plugins being installed. This process may take a few minutes.
Creatingthefirstadministrator user
Finally,aftercustomizingJenkinswithplugins,Jenkinsasksyoutocreateyourfirst
administrator user.
4. WhentheCreateFirstAdminUserpageappears,specifythedetailsforyour
administrator user in the respective fields and click Save and Finish.
103|
5. WhentheJenkinsisreadypageappears,clickStartusingJenkins.
Notes:
o ThispagemayindicateJenkinsisalmostready!insteadandifso,clickRestart.
o Ifthepagedoesnotautomaticallyrefreshafteraminute,useyourwebbrowserto refresh
the page manually.
6. Ifrequired,logintoJenkinswiththecredentialsoftheuseryoujustcreatedandyouare ready to
start using Jenkins!
TroubleshootingWindowsinstallation
Invalid service logon credentials
Wheninstallingaservicetorununderadomainuseraccount,theaccountmusthavetherightto logon as a
service. This logon permission applies strictly to the local computer and must be granted in the
Local Security Policy.
PerformthefollowingstepsbelowtoedittheLocalSecurityPolicyofthecomputeryouwantto define
the ‘logon as a service’ permission:
8. Logontothecomputerwithadministrativeprivileges.
9. OpentheAdministrativeToolsandopentheLocalSecurity Policy
104|
10.ExpandLocalPolicyandclickonUserRightsAssignment
11.Intherightpane,right-clickLogonasaserviceandselectproperties.
12.ClickontheAddUserorGroup…buttontoaddthenewuser.
13.IntheSelectUsersorGroupsdialogue,findtheuseryouwishtoenterandclickOK
14.ClickOKintheLogonasaservicePropertiestosave changes.
Aftercompletingthestepsabove,trylogginginagainwiththeadded user.
--------------------------------------------------------------------------------------------------------------------------------
Exercise10 :
Modulename:ImplementationofCICDwithJavaandopensourcestack
IntheconfiguredJenkinspipelinecreatedinExercise8and9,implementqualitygatesfor static
analysis of code.
https://infyspringboard.onwingspan.com/web/en/app/search/learning?lang=en&q=
%20Implementation%20of%20CICD%20with%20Java%20and%20open%20source%20stack
%20In%20the%20configured%20Jenkins%20pipeline%20created%20in%20Exercise
%208%20and
%209,%20implement%20quality%20gates%20for%20static%20analysis%20of%20code.&f
=%7B%7D
Exercise11:
Modulename:ImplementationofCICDwithJavaand opensourcestack
IntheconfiguredJenkinspipelinecreatedinExercise8and9,implementqualitygatesfor static unit
testing.
https://infyspringboard.onwingspan.com/web/en/app/search/learning?
lang=en&q=Implementation%20of%20CICD%20with%20Java%20and%20open%20source
%20stack%20In%20the%20configured%20Jenkins%20pipeline%20created%20in
%20Exercise%208%20and%209
,%20implement%20quality%20gates%20for%20static%20unit%20testing.&f=%7B%7D
Exercise12:
Modulename:Courseend assessment
In the configured Jenkins pipeline created in Exercise 8 and 9, implement quality gates for
code coverage. https://infyspringboard.onwingspan.com/web/en/app/search/learning?
lang=en&q=In%20the
%20configured%20Jenkins%20pipeline%20created%20in%20Exercise%208%20and%209,
%20implement%20quality%20gates%20for%20code%20coverage.&f=%7B%7D
Page
ALIET 105 |
Page
DEVOPS
GIT:-
Gitisadistributedversion-controlsystemfortrackingchangesinsourcecode
during software development. It is designed for coordinating work among
programmers, but it can be used to track changes in any set of files. Its goals
include speed, data integrity, and support for distributed, non-linear
workflows.
Git was created by Linus Torvalds in 2005 for development of the Linux kernel,
with other kernel developers contributing to its initial development.Its current
maintainer since 2005 is Junio Hamano. As with most other distributed version-
control systems, and unlike most client–server systems, every Git directory on
everycomputerisafull-fledgedrepositorywithcompletehistoryandfullversion-
tracking abilities, independent of network access or a central server.
Installgit:-
YoushouldberunningaserverwithanyUbuntu16.04LTSrelease. You
will need to log in to SSH via the root user.
First,asalways,weshouldstartoutbyrunninggeneralOSandpackage
updates. On Ubuntu we’ll do this by running:
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 106 |
Page
>>apt-getupdate
>>apt-getinstallgit-core
>>git--version
InstallingGIT-apt-getinstallgit
Colors–Redcolor=Filesinworkingdirectory
StatusCheck–gitstatus(forcheckingthetrackingoffiles) Commit
Gitinit:-
Totracktheparticularfolderandgitwillonlytakecare aboutthefilesbutnot folders
For checking whether it is installed or not check the hidden files
>>ls–a(or)ls–al
>>gitconfig–-globaluser.name“XXnameXX”
>>gitconfig–-globaluser.email“XXemailIDXX”
>>gitaddfilename(or).[foraddingcompletefiles]
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 107 |
Page
>>gitcommit–m“messageforthattask”
>>gitcommit–am“messageforthetask”
>>gitlog--oneline
>>gitshowcommitid
>>vi.gitignore
*.html
*.jpg
ALIET 108 |
Page
!filename.html
>>“gitadd–ffilename”
>> “gitcheckoutfilename”
GitSERVER:-
DevelopmentoftheGitHubplatformbeganonOctober19,2007.[55][56]
[57] The site was launched in April 2008 by Tom Preston-Werner, Chris
Wanstrath,P.J.HyettandScottChaconafterithadbeenmadeavailablefor a few
months prior as a beta release.[58]
Projects on GitHub can be accessed and manipulated using the standard Git
command-line interface and all of the standard Git commands work with it.
GitHub also allows registered and unregistered users to browse public
repositoriesonthesite.MultipledesktopclientsandGitpluginshavealsobeen
created by GitHub and other third parties that integrate with the platform.
The site provides social networking -like functions such as feeds, followers,
wikis(usingwikisoftwarecalledGollum)andasocialnetworkgraphtodisplay how
developers work on their versions ("forks") of a repository and what fork (and
branch within that fork) is newest.
A user must create an account in order to contribute content to the site, but
public repositories can be browsed and downloaded by anyone. With a
registered user account, users are able to have discussions, manage
repositories, submit contributions to others' repositories, and review changes
to code. GitHub began offering unlimited private repositories at no cost in
January2019(limitedtothreecontributorsperproject).Previously,onlypublic
repositories were free.
Installation:-
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 109 |
Page
>>JAVA8versionneedtobeinstalled
>>Terminalshouldbeupdated
>>Shouldhavegitbucket.warshouldbedownloaded
>>IPAddressshouldbeReservedandshouldfixmanually
>>ChangetoRootuser-sudosu –root
>>InstalltheVimsoftware–apt-getinstallvim
ALIET 110 |
Page
>>apt–getinstallsoftware–properties–common
>>apt-getupdate
>>apt-getinstalldefault-jre
>>apt-getinstalldefault-jdk
>>add-apt-repository–rppa:webupdsteam/java
>>apt-getupdate
>>apt-getinstalloracle-java8-installer
>>java--version
>>DownloadGitbucket.war
>>Gotothepathwerethegutbucket.warfilewassituated
>>Java–jargutbucket.war
>> java–jargutbucket.war--port=8018
>>apt–getinstallgit
UsinglocalGitbucket:-
>>mkdirmyproject–Createadirectory
>>cdmyproject–navigatetodirectory
>>gitinit–initializethe git
>>touchtarun–createafileinmyproject
>>gitstatus
>>gitaddtarun
>>gitcommit–m‘commitmessage’
>>gitlog
>>gibucket–signIn–root/root(username&password)
>>GotosystemAdminstration–Newuser–Createuserwithcredentials–sign out -
sign in with newly created user
>>Newrepository-Createarepository
>>gitremoteaddoriginURL
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 111 |
Page
>>gitpush–uoriginmaster
>>Viewthefilecalled“.gitbucket”(hiddenfolder)
>>Givethecommand“-tree.gitbucket“toviewthefilesintherepository
GitBranches:-
Branching,inversioncontrolandsoftwareconfigurationmanagement,isthe
duplication of an object under version control (such as a source code file or
ALIET 112 |
Page
adirectorytree)sothatmodificationscanoccurinparallel along
multiple branches.
Branchesarealsoknownastrees,streamsorcodelines.Theoriginating
branchissometimescalledtheparentbranch,theupstreambranch(or
>>gitbranch
>>gitbranchnewbranchname
>>gitcheckoutbranchtochange
>>gitmergebranchnametomerge
>>gitcheckoutmaster
>>gitbranch–Dbranchname
>>gitpushorigin--deletebranchname
StashArea:-
>>gitadd.
>>gitstashsavefilename
>>gitstashlist–Toviewthestashedfiles
PlaywithdatainStash Area
>>Copy+paste=Takeacopyfromstashareaanduseitinnormallygitstash apply
stashID
>>Cut+paste=MoveafilefromstashanduseitnormallygitstashpopstashID
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 113 |
Page
>>Delete=RemovefilesfromstashArea
>>gitstashdropstashID
CreatingVersiontags:-
>> gittagversionnumber=Creatingaversiontag
>>gittag=Wrappingthefilesandpushingintoversion
>>gitpush–umyprojectversionnumber=Pushingintogithub
>>gittag–dversionnumber=Removeversionslocally
ALIET 114 |
Page
>>gitpush–umyproject--deleteversionnumber=Deletethereleaseinthegit hub
EmailNotification
>>Whateverhappensinthegithubwillbenotifiedthroughemail
>>Stepstoactivateemailnotification
>>LoginintoGitHub-myproject–Settings–Notifications–Add- Email
Address
BackupandRestore
>>Fortakingthebackupofthefilesofthegitbucket.Itisahiddenfolder.
>>ls–a(Viewhiddenfiles)
>>openthe.gitbucket fil
>>Therewecanseethefileswhichwerepushed
CHEF:-
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 115 |
Page
Chef is a company and the name of a configuration management tool
written in Ruby and Erlang. It uses a pure-Ruby, domain-specific language
(DSL)forwritingsystemconfiguration"recipes".Chefisusedtostreamline the
task of configuring and maintaining a company's servers.
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 116 |
Page
The user writes "recipes" that describe how Chef manages server applications
andutilities(suchasApacheHTTP Server,MySQL,orHadoop)andhowtheyare to be
configured. These recipes (which can be grouped together as a "cookbook" for
easier management) describe a series of resources that should be in a particular
state: packages that should be installed, services that should be running, or files
that should be written. These various resources can be configured to specific
versions of software to run and can ensure that software is installed in the
correct order based on dependencies.
Chefcanruninclient/servermode,orinastandaloneconfigurationnamed
"chef-solo". In client/server mode, the Chef client sends various attributes
about the node to the Chef server. The server uses Elasticsearch to index these
attributesandprovidesanAPIforclientstoquerythisinformation.Chefrecipes
ALIET 117 |
Page
canquerytheseattributesandusetheresultingdatatohelpconfigure the
node.
Chef-serverinstallation:-
>>hostname-f
>>cd~
wget https://opscode-omnibus-
packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef-server_11.0.10-
1.ubuntu.12.04_amd64.deb
>>sudodpkg-ichef-server*
>> sudochef-server-ctlreconfigure
>>https://server_domain_or_IP
>> DefaultUsername:admin
>> DefaultPassword:p@ssw0rd1
>> mkdir-p~/chef-repo/.chef
>>https://server_domain_or_IP
>>#chef-manage-ctlreconfigure
>>#chef-server-ctluser-createstudentstudentstudent
"[email protected]""redhat" -f student.pem
>>#chef-server-ctlorg-createmyorg"pivotalsoft"-astudent-f
myorg-validator.pem
>>#chef-server-ctlrestart(forrestart)
>>#chef-server-ctlstart(forstart)
>>#chef-server-ctlstop(forstop)
chefnodeinstallation:-
>>updatip&hostadd
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 118 |
Page
>> #dpkg-ichef-client.....
>>mkdir-p/etc/chef copy
both .pem files
>>cd/etc/chef
>> vi client.rb
log_level :info
log_location STDOUT
chef_server_url'https://chefserver.pivotal.com/organizations/myorg'
ALIET 119 |
Page
validation_client_name 'myorg-
validator'validation_key '/etc/chef/myorg-
validator.pem'
client_key '/etc/chef/student.pem'
trusted_certs_dir'/etc/chef/trusted_certs'
>>knifesslfetch-shttps://chefserver.pivotal.com
>>knifesslcheck-shttps://chefserver.pivotal.com
>>useraddrishi
>>passwdrishi
>>usermod-aGsudorishi
>>apt-getinstallssh
>>ssh-keygen
Chefworkstationinstallation:-
>>updateipandhostaddress
>>dpkg-ichef-work.......
>>cd/root/chef-repo/.chef
copyboth.pemfilesinto.cheffolder
>>ls
>>vi knife.rb
log_level :info
log_location STDOUT
node_name 'student'
client_key '/root/chef-repo/.chef/student.pem'
120|Page
validation_client_name'myorg-validator'
validation_key '/root/chef-repo/.chef/myorg-validator.pem'
chef_server_url 'https://chefserver.pivotal.com/organizations/myorg
cookbook_path ['/root/chef-repo/cookbooks']
>>knifesslfetch/knifesslfetch-shttps://chefserver.pivotal.com
>>knifesslcheck/knfiesslcheck-shttps://chefserver.pivotal.com
>>knifebootstrap192.168.0.221--ssh-userrishi--sudo--identity- file
~/.ssh/id_rsa --node-name chefnode.pivotal.com
#knifenodelist
Chefcookbooks:-
ALIET
121|Page
Writingcookbooks/recipes
samplecookbooks:-
>>chefgeneratecookbooksample_file
>>vi/chef/cookbook/sample_file/recipes/default.rb
file "/tmp/test.txt" do
owner"root"
group "root"
mode "0644"
content"haiiithisistest
file" action :create
end
>>knifecookbookuploadsample_file
>>knifenoderun_listaddchefnode.pivotal.comsample_file
>>gotochefnodeaddtype"chef-client"
Creates the sysadmin group
andusers:-
users_manage'sysadmin'do
group_id 2300
action[:create]
end
Createsthetestgroupgroup,andusers
users_manage 'testgroup' do group_id
3000
action[:create]
data_bag'test_home_dir'
122|Page
end
action[:create]
data_bag'test_home_dir'
manage_nfs_home_dirsfalse
end
ALIET
123|Page
>>knifecookbookuploadusers
>>knifenoderun_listaddchefnode.pivotal.comsample_file
>>gotochefnodeaddtype"chef-client"
recipeforapacheserver:-
>>chefgeneratecookbookapache
extendApache2::Cookbook::Helpers
service_namelazy{apache_platform_service_name
}supportsrestart:true,status:true,reload:true
action :nothing
end
apache2_install'default_install'
apache2_module 'headers'
apache2_module'ssl'
apache2_default_site'foo'do
default_site_name'my_site'
template_cookbook'my_cookbook'
port '443'
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 124 |
Page
template_source'my_site.conf.erb'
action :enable
end
>>knifecookbookuploadsample_file
>>knifenoderun_listaddchefnode.pivotal.comapache
>>gotochefnodeaddtype"chef-client"
Chefroles:-
>>kniferolebulkdeleteREGE
>>kniferolecreateROLE_NAME(options)
ALIET 125 |
Page
>>kniferolecreaterole1
>>kniferoleeditROLE_NAME
"name": "role1",
"default_attributes":{
},
"json_class":"Chef::Role",
"run_list":["recipe[cookbook_name::recipe_name]",
"role[role_name]"
],
"description":"",
"chef_type": "role",
"override_attributes":{
}
}
>>kniferoleshowROLE_NAME
>>knifecookbookuploadrecipe
>>knifenoderun_listaddchefnode.pivotal.comapache
Touninstall:-
>>chef-server-ctluninstall
>>chef-manage-ctlcleanse
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
126|Page
>>opscode-analytics-ctluninstall
>>opscode-reporting-ctluninstall
>>dpkg-Pchefdk
>>rpm-qa *chef*
>>yumremove<package>
>>dpkg--list|grepchef#ordpkg--statuschef
>>dpkg-Pchef
>>sudorm-rf /opt/chef
>>sudorm-rf /etc/chef
Maven:-
ALIET
127|Page
MavenisabuildautomationtoolusedprimarilyforJavaprojects.Mavencan also
be used to build and manage projects written in C#, Ruby, Scala, and other
languages. The Maven project is hosted by the Apache Software Foundation,
where it was formerly part of the Jakarta Project.
Maven addresses two aspects of building software: how software is built, and
its dependencies. Unlike earlier tools like Apache Ant, it uses conventions for
thebuildprocedure,andonly exceptionsneed tobe writtendown.AnXMLfile
describes the software project being built, its dependencies on other external
modulesandcomponents,thebuildorder,directories,andrequiredplug-ins.It
comes with pre-defined targets for performing certain well-defined tasks such
as compilation of code and its packaging. Maven dynamically
downloads Java libraries and Maven plug-ins from one or more repositories
suchastheMaven2CentralRepository,andstorestheminalocalcache. This
localcacheofdownloadedartifactscanalsobeupdatedwithartifactscreated by
local projects. Public repositories can also be updated.
Mavenisbuiltusingaplugin-basedarchitecturethatallowsittomakeuseof any
application controllable through standard input.
Maveninstallation:-
>>sudoapt-getupdate-y
>>sudoapt-getupgrade-y
>>add-apt-repositoryppa:webupd8team/java
>>apt-getupdate-y
>>apt-getinstalloracle-java8-installer
>>java-version
>>wgethttp://www-eu.apache.org/dist/maven/maven-
3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
>>tar-xvzfapache-maven-3.3.9-bin.tar.gz
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 128 |
Page
>>mvapache-maven-3.3.9maven
>>nano/etc/profile.d/mavenenv.sh
export M2_HOME=/opt/maven
exportPATH=${M2_HOME}/bin:${PATH}
>>chmod+x/etc/profile.d/mavenenv.sh
>>source/etc/profile.d/mavenenv.sh
>>tar-xvfapache-maven-C/opt/
ALIET 129 |
Page
>>vi/etc/profile.d/apache-maven.sh
exportJAVA_HOME=/usr/lib/jvm/java-8-oracle
export M2_HOME=/opt/apache-maven export
MAVEN_HOME=/opt/apache-maven export
PATH=${M2_HOME}/bin:${PATH}
>>apt-getinstallmaven
>>mvn--version
>>mvnarchetype:generate
>>1352
groupid:pivotal
architect:sample
Y
>>treesample
>>mvnvalidate
>>mvncompile
>>mvn test
>>mvnpackage
>>treesample
>>root@ubuntu:/home/student#mvn--
help Options:
-am,--also-make Ifprojectlistisspecified,also
buildprojectsrequiredbythe
list
-amd,--also-make-dependents Ifprojectlistisspecified,also
buildprojectsthatdependon
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
130|Page
projectsonthelist
-B,--batch-mode Runinnon-interactive(batch)
mode
-b,--builder<arg> Theidofthebuildstrategy to
use.
-C,--strict-checksums Failthebuildifchecksumsdon't
match
-c,--lax-checksums
Warnifchecksumsdon'tmatch
-cpu,--check-plugin-updates Ineffective,onlykeptfor
131|Page
ALIET
132|Page
backwardcompatibility
-D,--define<arg> Defineasystemproperty
-e,--errors Produceexecutionerrormessages
-emp,--encrypt-master-password<arg>Encryptmastersecuritypassword
-ep,--encrypt-password<arg> Encryptserverpassword
-f,--file<arg> ForcetheuseofanalternatePOM
file(ordirectorywithpom.xml).
-fae,--fail-at-end Onlyfailthebuildafterwards;
allowallnon-impactedbuildsto
continue
-ff,--fail-fast Stopatfirstfailurein
reactorized builds
-fn,--fail-never NEVERfailthebuild,regardless
of project result
-gs,--global-settings<arg> Alternatepathfortheglobal
settingsfile
-gt,--global-toolchains<arg> Alternatepathfortheglobal
toolchainsfile
-h,--help Displayhelpinformation
-l,--log-file<arg> Logfilewhereallbuildoutput
willgo.
-llr,--legacy-local-repository UseMaven2LegacyLocal
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
133|Page
Repositorybehaviour,ienouse of
_remote.repositories.Canalsobe
activated by using
-Dmaven.legacyLocalRepo=true
-N,--non-recursive Donotrecurseintosub-projects
-npr,--no-plugin-registry Ineffective,onlykeptfor
backwardcompatibility
-npu,--no-plugin-updates Ineffective,onlykeptfor
backwardcompatibility
-nsu,--no-snapshot-updates SuppressSNAPSHOTupdates
-o,--offline Workoffline
-P,--activate-profiles<arg> Comma-delimitedlistofprofiles
ALIET
134|Page
toactivate
-pl,--projects<arg> Comma-delimitedlistofspecified
reactorprojectstobuildinstead of
all projects. A project can be
specifiedby[groupId]:artifactId
or by its relative path.
-q,--quiet Quietoutput-onlyshowerrors
-rf,--resume-from<arg> Resumereactorfromspecified
project
-s,--settings<arg> Alternatepathfortheuser
settingsfile
-t,--toolchains<arg> Alternatepathfortheuser
toolchainsfile
-T,--threads<arg> Threadcount,forinstance2.0C
whereCiscore multiplied
-U,--update-snapshots Forcesacheckformissing
releasesandupdatedsnapshotson
remote repositories
-up,--update-plugins Ineffective,onlykeptfor
backwardcompatibility
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 134 |
Page
-v,--version Displayversioninformation
-V,--show-version Displayversioninformation
WITHOUTstoppingbuild
-X,--debug Produceexecutiondebugoutput
Docker:-
Docker is a tool designed to make it easier to create, deploy, and run
applicationsbyusingcontainers.Containersallowadevelopertopackageup an
ALIET 135 |
Page
application with all of the parts it needs, such as libraries and other
dependencies, and ship it all out as one package. By doing so, thanks to the
container, the developer can rest assured that the application will run on any
other Linux machine regardless of any customized settings that machine might
have that could differ from the machine used for writing and testing the code.
In a way, Docker is a bit like a virtual machine. But unlike a virtual machine,
rather than creating a whole virtual operating system, Docker allows
applicationstousethesameLinuxkernelasthesystemthatthey'rerunningon and
only requires applications be shipped with things not already running on the
host computer. This gives a significant performance boost and reduces the size
of the application.
And importantly, Docker is open source. This means that anyone can
contributetoDockerandextendittomeettheirownneedsiftheyneed
additional features that aren't available out of the box.
>>
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 136 |
Page
InstallJava on
ubuntuServer
>>sudoapt-getupdate-y
>>sudoapt-getupgrade-y
ALIET 137 |
Page
>>add-apt-repositoryppa:webupd8team/java
>>apt-getupdate-y
>>apt-getinstalloracle-java8-installer
>>java-version
>>sudoaptupdate
>> sudo apt-key adv --keyserver
hkp://ha.pool.skskeyservers. net:80 --recv-keys
58118E89F3A912897C070ADBF76221572C52609D
>> sudo apt-add-repository "deb
https://apt.dockerproject.org/repoubuntu-xenialmain"
>>sudoaptupdate
>> sudoaptinstalldocker-engine
>>sudosystemctlstartdocker
>>dockerimages
>>dockerpullubuntu
>>root@ubuntu:/home/student#docker--help Options:
--configstring Locationofclientconfigfiles(default
"/root/.docker")
-D,--debug Enabledebugmode
--help Printusage
-H,--hostlist Daemonsocket(s)toconnectto
-l,--log-levelstringSetthelogginglevel
("debug"|"info"|"warn"|"error"|"fatal")
(default "info")
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
138|Page
--tls UseTLS;impliedby--tlsverify
--tlscacertstringTrustcertssignedonlybythisCA(default
"/root/.docker/ca.pem")
--tlscertstring PathtoTLScertificatefile(default
"/root/.docker/cert.pem")
--tlskeystring PathtoTLSkeyfile(default
"/root/.docker/key.pem")
--tlsverify UseTLSandverifytheremote
-v,--version Printversioninformationandquit
ALIET
139|Page
ManagementCommands:
Commands:
attach Attachlocalstandardinput,output,anderrorstreamstoarunning
container
build BuildanimagefromaDockerfile
commit Createanewimagefromacontainer'schanges
cp Copyfiles/foldersbetweenacontainerandthelocalfilesystem
create Create a new container
diff Inspectchangestofilesordirectoriesonacontainer'sfilesystem
events Get real time events from the server
exec Runacommandinarunningcontainer
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 140 |
Page
export Exportacontainer'sfilesystemasatararchive
history Show the history of an image
images Listimages
import Importthecontentsfromatarballtocreateafilesystemimage info
Display system-wide information
inspect Returnlow-levelinformationonDockerobjects
kill Kill one or more running containers
load LoadanimagefromatararchiveorSTDIN
login Log in to a Docker registry
logout LogoutfromaDockerregistry
ALIET 141 |
Page
logs Fetchthelogsofacontainer
pause Pauseallprocesseswithinoneormorecontainers
port Listportmappingsoraspecificmappingforthecontainer ps
List containers
pull Pullanimageorarepositoryfromaregistry
push Push an image or a repository to a registry
rename Renameacontainer
restart Restartoneormorecontainers
rm Removeoneormorecontainers
rmi Remove one or more images
run Runacommandinanewcontainer
save Saveoneormoreimagestoatararchive(streamedtoSTDOUT by
default)
search SearchtheDockerHubforimages
start Startoneormorestoppedcontainers
stats Displayalivestreamofcontainer(s)resourceusagestatistics
stop Stoponeormorerunningcontainers
tag CreateatagTARGET_IMAGEthatreferstoSOURCE_IMAGE
top Displaytherunningprocessesofacontainer
unpause Unpauseallprocesseswithinoneormorecontainers
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 142 |
Page
update Updateconfigurationofoneormorecontainers
version Show the Docker version information
wait Blockuntiloneormorecontainersstop,thenprinttheirexitcodes
Torun Images:-
>>dockerimages
>>dockerrun-ti--rmubuntu/bin/bash\
>>dockerps
>>dockerps –a
>>dockerrun-tiubuntu/bin/bash
>>dockerps
>>dockerps –a
>>dockerexec-ti<containerid>/bin/bash
>>dockerrun-ti--name“ubuntu18”--hostname ”pivotal”
ubuntu /bin/bash
ALIET 143 |
Page
>> dockerstart<containerid>
>>dockerstop<containerid>
>> dockerrm<containerid>
>>dockerimagerm<imageid)
GitbucketConfigurationonDocker:-
Needtomaintaingitbucket.warfileandDockerfilein
/rootDir.
>> vi Dockerfile
Fromjava:latest
[email protected]
LABEL evn=production
ENVapparea/data/app
Runmkdir-p$apparea
ADD./gitbucket.war$apparea
WORKDIR$apparea
CMD["java","-jar","gitbucket.war"]
:wq!
>>dockerbuild–tpivotal/git.(tobuildDockerfile)
>>dockerimages
>>dockerrun-d-p80:8080pivotal/git(toportforwarding)
>>ifconfig
OpenFirefoxandgive192.168.0.151:80tolaunchgitbucket server
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
144|Page
JenkinsConfigurationonDocker:-
Needtomaintaingitbucket.warfileandDockerfilein
/rootDir.
>>viDockerfile
Fromjava:latest
[email protected]
LABEL evn=production
ENVapparea/data/appRun
mkdir -p $apparea ADD
./jenkins.war$apparea
ALIET
145|Page
WORKDIR$apparea
CMD["java","-jar","jenkins.war"]
:wq!
>>dockerbuild–tpivotal/git.(tobuildDockerfile)
>>dockerimages
>>dockerrun-d-p80:8080pivotal/jenkins(toportforwarding)
>>ifconfig
OpenFirefoxandgive192.168.0.151:80tolaunchgitbucket server
Apachetomcatserver:-
Downloadapache-tomcatappfrominternet
#tar -xvf apache-tomcat -C /opt/ #cd
/opt/apache-tomcat/bin
#./startup.sh
#firefox &
http://192.168.149.159:8080
setuserPath--------------
#vi /opt/apache-tomcat/conf/tomcat-
users.xml<rolerolename="manager-gui"/>
<userusername="student"password="redhat"roles="manager-gui"/>
</tomcat-users>
:wq!
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
146|Page
http://192.168.149.159:8080
ALIET
147|Page
openmanagerappanddeploy.warfiles
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
148|Page
ex:http://192.168.159.149:8080/sampleweb/
InstallApacheTomcat8:-
>>apt-getupdate
>>apt-getinstalldefault-jdk
>>groupaddtomcat
>>useradd-s/bin/false-gtomcat-d/opt/tomcattomcat
>>cd/tmp
>>curl-Ohttp://apache.mirrors.ionfish.org/tomcat/tomcat-
8/v8.5.5/bin/apache-tomcat-8.5.5.tar.gz
>>mkdir/opt/tomcat
>>tarxzvfapache-tomcat-8*tar.gz-C/opt/tomcat--strip-components=1
>>/opt/tomcat
>>chgrp-Rtomcat/opt/tomcat
>>chmod-Rg+r conf
>>chmodg+xconf
ALIET
149|Page
>>chown-Rtomcatwebapps/work/temp/logs/
>>update-java-alternatives-l
>>/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre
>>nano/etc/systemd/system/tomcat.service
[Unit]
Description=ApacheTomcatWebApplicationContainer
After=network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M-Xmx1024M-server-XX:
+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true
-Djava.security.egd=file:/dev/./urandom'
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
150|Page
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
>>systemctldaemon-reload
>>systemctlstarttomcat
ALIET
151|Page
>>systemctlstatustomcat
>>ufwallow8080
>>http://server_domain_or_IP:8080
>>systemctlenabletomcat
>>nano/opt/tomcat/conf/tomcat-users.xml
<tomcat-users...>
<userusername="admin"password="password"roles="manager-gui,admin-
gui"/>
</tomcat-users>
>>nano/opt/tomcat/webapps/manager/META-INF/context.xml
>>nano/opt/tomcat/webapps/host-manager/META-INF/context.xml
>>systemctlrestarttomcat
>>http://server_domain_or_IP:8080
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 152 |
Page
http://server_domain_or_IP:8080/manager/html
ALIET 153 |
Page
ALIET
154|Page
UploadingGitbucketandJenkins:-
>>gotoTomcatmanager
>>clickondeployoption
>>contextpath/gitbucket
>>warorDirectoryURL/opt/gitbucket.war
>>deploy
openGitbucketfromApplications
Jenkins:-
>>gotoTomcatmanager
>>clickondeployoption
>>contextpath/jenkins
>>warorDirectoryURL/opt/jenkins.war
ALIET
155|Page
>>deploy
openGitbucketfromApplications
Jenkins:-
Jenkinsisaself-contained,opensourceautomationserverwhichcanbeusedto
automate all sorts of tasks related to building, testing, and delivering or
deploying software.
Jenkinscanbeinstalledthroughnativesystempackages,Docker,orevenrun standalone by
any machine with a Java Runtime Environment (JRE) installed.
In Continuous Integration after a code commit, the software is built and tested
immediately.Inalargeprojectwithmanydevelopers,commitsaremademany times
during a day. With each commit code is built and tested. If the test is passed,
build is tested for deployment. If deployment is a success, the code is pushed to
production. This commit, build, test, and deploy is a continuous process and
hence the name continuous integration/deployment.
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 156 |
Page
JenkinsPlugins:-
Bydefault,Jenkinscomeswithalimitedsetoffeatures.Ifyouwanttointegrate your
Jenkins installation with version control tools like Git, then you need to
ALIET 157 |
Page
installpluginsrelatedtoGit.Infact,forintegrationwithtoolslikeMaven you
need to install respective plugins in your Jenkins.
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 158 |
Page
Jenkinsinstallationandconfiguration:-
ConfiguretomcatserverandMaven
>>DownloadJenkins.warandgitbucket.warfiles
>>DeployJenkins.warandgitbucket.wartoTomcatserver
>>Openjekinsconsoleandgitbucketconsolethroughfirefox
JenkinsPluginmanagement:-
>>ManageJenkinsManagepluginsAvailable
>>typeyourrequiredpackagename
>>installwithoutrestart.
CompileMavencode:-
>>GotoJenkinsDashboard
>>Newitemitemname
>>SelectMavenprojectok
ALIET 159 |
Page
>>
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
160|Page
DescriptionGitBucketUrlSourcecodemanagement
>> Gitbucketurl
>>Deleteworkspacebeforebuildstarts
>>BuildPom.xmllocationgoalcommand<compile>
>>save.
ALIET
161|Page
ALIET
162|Page
TestMavencode(CB):-
>>GotoJenkinsDashboard
>>Newitem
>>itemname
ALIET
163|Page
>>SelectMavenproject>>ok
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
164|Page
ALIET
165|Page
IntegrateMavencodeinJenkins:-
>>GotoJenkinsDashboard
>>Comment
>>giturl
>>BuildwheneveraSNAPSHOTdependencyisbuilt
>>Deleteworkspacebeforebuildstarts
>>Setrootpompath
>>setbranchespath
>>applyok
>>clickonbuild icon
ALIET
166|Page
ALIET
167|Page
ALIET
168|Page
ALIET
169|Page
PackageMavencode(CB):-
>>GotoJenkinsDashboard
>>Newitem>>itemname
>>SelectMavenproject>>ok
>>Description
>>giturl
>> BuildwheneveraSNAPSHOTdependencyisbuilt
>>Deleteworkspacebeforebuildstarts
>>Setrootpompath
>>Goalpackage
>>setbranches>>path>>apply>>save>>build now.
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
170 |Page
ALIET
171|Page
AutomationwithPieplineView:-
1ststep
>>GotoMaven_compileconfiguration
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
172|Page
>>Buildtriggers
>>Buildafterotherprojectsarebuilt
>>Maven_integration
>>Apply>>save. 2nd
step
>>GotoMaven_testconfiguration
>>Buildtriggers
>>Buildafterotherprojectsarebuilt
>>Maven_compile
>>Apply>>save. 3rd
step
>> GotoMaven_Packageconfiguration
>>Buildtriggers
>>Buildafterotherprojectsarebuilt
>>Maven_test
ALIET
173|Page
>>Apply >>save
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
174 |Page
ALIET
175|Page
PipelineInstallation:-
1stStep
>>ManageJenkins
>>Manageplugins
>>Available <typebuildpipelinepackagename>
>>installwithout restart.
2nd step
>>JenkinsDashboard
>>Newview
>>Name
>>buildpipelineview
>>apply>>save. 3rd
Step
>>ViewconfigureUpstream/downstreamconfig
>>Select>>Maven_integration>>Apply>> ok.
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
176|Page
ALIET
177|Page
FullyAutomationinJenkins:-
1stStep
>>GotoJenkinsuserconfigure
>>AddnewTokenand copy
>>ApplySave.
2nd step
>>GotoGitbucket
>>AccountSettings
>>Servicehooks Addpayrollurl(Jenkinsurl)
>>PasttheToken>>tickonPush>>save. 3rd
step
>>GotoJenkins
>>Maven_integaration
>>Configure
>>BuildTriggers
>>BuildwhenachangeispushedtoGitbucket>>apply>>save. 4th
step
>>GotoTerminalPushnewcodetoGitbucketserver.
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
178|Page
ALIET
179|Page
ContinuesDeploy:-
1ststep
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 180 |
Page
>>GotoJenkinsDashboard
>>ManageJenkins
>>ManagePlugins>>Available>>Deploytocontainer
>>installwithoutrestart>>ok.
2nd step
>>GotoJenkinsDashboard
>>Maven_PackageConfigure
>>Post-buildActions
>>Deploywar/eartocontainer>>war/earfiles=**/*.war
>> Contextpath=/sampleweb>>credentials
>> Tomcat Url Apply Save.
3rd Step
>>GotoTerminalpushsomenewcodetoGitbucketthanseethechanges in
firefox.
ALIET 181 |
Page
JenkinsBackupandRestore:-
1ststep
>>GotoJenkinsDashboard
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
182|Page
>>ManageJenkins
>>ManagePlugins>>Available
>> Backup Plugin >>install without restart >> ok.
2nd step
>>GotoJenkinsDashboard
>>ManageJenkins
>>Backupmanager
>>Setup>>Backupdirectory>>Format>>save.3rd step
>>GotoJenkinsDashboard
>>ManageJenkins
>>Backupmanager
>> BackupHudsonconfiguration>>Ok. 4th
step
>>GotoJenkinsDashboard
>>ManageJenkins
>>Backupmanager
>>RestoreHudsonconfiguration>>LaunchRestore.
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
183|Page
Ansible:-
AnsibleisaradicallysimpleITautomationsystem.Ithandlesconfiguration
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 184 |
Page
management, application deployment, cloud provisioning, ad-hoc task
execution, network automation, and multi-node orchestration. Ansible makes
complexchangeslikezero-downtimerollingupdateswithloadbalancerseasy.
ALIET 185 |
Page
Minimalinnature.Managementsystemsshouldnotimposeadditional
dependencies on the environment.[16]
Consistent.WithAnsibleoneshouldbeabletocreateconsistent
environments.
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 186 |
Page
Secure.Ansibledoesnotdeployagentstonodes.
OnlyOpenSSHandPythonarerequiredonthemanagednodes.[16][12]
Highlyreliable.Whencarefullywritten,anAnsibleplaybookcan
beidempotent,topreventunexpectedside-effectsonthemanagedsystems.
[18]Itisentirelypossibletohaveapoorlywrittenplaybookthatis not
idempotent.
Minimallearningrequired.Playbooksuseaneasyanddescriptive
language based on YAML and Jinja templates.
AnsibleInstallation:-
ConfigureinSystem1,System2andSystem3:-
ALIET 187 |
Page
>>setipaddressandhostaddress
>>installssh
>>installepel-releasepackages
>>installyumpackages
>> sudo yum localinstall --nogpgcheck
https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
>> sudo yum localinstall --nogpgcheck
https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-
release-7.noarch.rpm
>> sudo yum localinstall --nogpgcheck
http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-
7-11.noarch.rpm
>> sudo yum localinstall --nogpgcheck
http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
>>sudorpm--importhttps://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-
7.0-3.el7.elrepo.noarch.rpm
Ansibleservertalkstomanagednodesusing ssh
Defaultlocationofinventory:/etc/ansible/hosts
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 188 |
Page
addhoststo/etc/ansible/hosts
andconfigurepasswordlessauthentication
Generatesshkeysandsetuppasswordlessauthenticationbetweenserver and
clients
ALIET 189 |
Page
performjobseitherusingansiblecommnadlineorplaybooks.
Ansiblecommandline:-
>>ansibleall-m ping
>>ansibleall-a"touch/tmp/hello"
>>ansiblewebservers-mping
Ansibleplaybooks:-
playbookforfilecopying
---
- hosts: all
become_user:root
tasks:
-name:Copyfilewithownerandpermissions copy:
src:/root/playfile
dest: /tmp
owner:root
group: root
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
190|Page
mode:'0644'
>>ansible-playbookapache.yml--check
>>ansible-playbookfilename
Webpalybook:-
- hosts: all
become_user:root
tasks:
ALIET
191|Page
- name:1.InstallLatestVersionofHTTP/Apache
yum: name=httpd state=present
- name:2.starthttpdservice
service:name=httpdstate=startedenabled=yes
- name:3.copythestandardindex.htmlfile
copy:src=/tmp/index.htmldest=/var/www/html/index.htmlmode=0664
- name:4.Addapacheiptablerule
command:/sbin/iptables-IINPUT1-ptcp--dporthttp-jACCEPT-m
comment --commnet "Apache on port 80"
- name:5.Saveiptablerule
command: iptables-save
>>ansible-playbookapache.yml--check
>>ansible-playbookfilename
usersplaybook:-
---
- hosts:all
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D., 192 |
Page
become_user:root
tasks:
#thistaskcreatesgroups
- name:addagroup
group:
name={{item}}
ALIET 193 |
Page
state=present
with_items:
- demogrp
- demogrp1
tags:add_new_grp
#thistaskcreatesusers
- name:addauser
user:
name={{ item }}
state=present
password="redhat"
shell=/bin/bash
with_items:
- demouser1
- demouser2
- demouser3
tags:add_new_user
# this tasks is to delete the
users-name:deleteseveral
users user:
name={{item}}
state=absent
with_items:
- demouser1tags:
remove_user
#thistaskistodeletethegroups
- name:deletegroups
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
194|Page
group:
name={{item}}
state=absent
with_items:
- demogrp
- demogrp1
tags:remove_group
ALIET
195|Page
>>ansible-playbookapache.yml--check
>>ansible-playbookuser.yml--list-tags
>>ansible-playbookuser.ymo--tagsadd_net_user
- name:PatchWindowssystemsagainstMeltdownandSpectre
hosts: "{{ target_hosts | default('all') }}"
vars:
reboot_after_update:no
registry_keys:
- path:HKLM:\SYSTEM\CurrentControlSet\Control\Session
Manager\Memory Management
name:FeatureSettingsOverride
data: 0
type:dword
- path:HKLM:\SYSTEM\CurrentControlSet\Control\Session
Manager\Memory Management
name:FeatureSettingsOverrideMask
data: 3
type:dword
Dr.ChilakalapudiMeherBabu,M.Tech.,Ph.D.,
196|Page
#https://support.microsoft.com/en-
us/help/4072699 - path:
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\QualityCompat
name: cadca5fe-87d3-4b96-b7fb-a231484277cc
type:dword
data:'0x00000000'
tasks:
-name:Installsecurityupdates
win_updates:
category_names:
ALIET
197|Page
-SecurityUpdates
notify:rebootwindowssystem
name:"{{item.name}}"
data:"{{item.data}}"
handlers: