In this session we will explore the full continuous delivery cycle from check-in to production using set of popular tools. During the session the attendees will be introduced to a set of tools and practices that enable continuous delivery from the technical point of view.
2. 2 copyright 2015 Trainologic LTD
⢠Continuous Delivery (CD) is a hot topic these days.
⢠Considered as a silver bullet for DevOps teams.
⢠In this session weâll:
⢠Describe the Deployment Pipeline.
⢠Overview the tools.
⢠Describe best-practices.
Continuous Delivery
2
From Zero to Continuous Delivery
3. 3 copyright 2015 Trainologic LTD
⢠The goals:
⢠Find bugs earlier
⢠Improve time-to-market
⢠Reduce manual work
⢠Dashboard (Monitoring)
Continuous Delivery
3
From Zero to Continuous Delivery
4. 4 copyright 2015 Trainologic LTD
The Pipeline
4
From Zero to Continuous Delivery
Code
Committed
CI
Integration
Test
Deploy to
Staging
UAT
Deploy to
Prod
5. 5 copyright 2015 Trainologic LTD
⢠The developers are responsible for writing Unit and
Integration tests (and the code of-course).
⢠And they commit their changes into the SCM.
⢠The SCM is a crucial tool in the process!
⢠(Branches, Labels, Diffs)
It All Starts FromâŚ
5
From Zero to Continuous Delivery
6. 6 copyright 2015 Trainologic LTD
⢠Only hand-written code and configuration files should
reside in your SCM.
⢠Never store anything that is binary or generated there!
⢠Try to choose a tool which provides hooks that can
notify external applications on commits.
Important Practices (SCM)
6
From Zero to Continuous Delivery
7. 7 copyright 2015 Trainologic LTD
⢠A good Continuous Integration
(CI) process stands at the
heart of a good CD pipeline.
⢠Your CI tool should start its
work (job) when it was
notified by the SCM over a
commit. (polling is also an
option).
The Beast (CI)
7
From Zero to Continuous Delivery
8. 8 copyright 2015 Trainologic LTD
CI
8
From Zero to Continuous Delivery
9. 9 copyright 2015 Trainologic LTD
⢠Your CI Tool should (in first phase):
⢠Compile your code and tests (if needed).
⢠Run Unit tests
⢠Run Static Code Analysis.
⢠Package
⢠Run Integration Tests
⢠Deploy to Binary Repository.
The âclassicâ CI Role
9
From Zero to Continuous Delivery
10. 1
0
copyright 2015 Trainologic LTD
⢠Often, youâll want to have several CI machines.
⢠For running resource intensive tests (load, security,
gui).
⢠Can be also used to parallelize tests.
Several CI Machines
10
From Zero to Continuous Delivery
11. 1
1
copyright 2015 Trainologic LTD
⢠Never, ever, run the build with tests disabled!
⢠Failure of build should notify the committing developers.
⢠Build should be fast! (unit-tests).
⢠Build results should be visible to everyone.
Important Practices (CI)
11
From Zero to Continuous Delivery
12. 1
2
copyright 2015 Trainologic LTD
⢠Very important to minimize the technical debt!
⢠There are many tools in the market: FindBugs, Sonar,
PMD, CheckStyle.
⢠It is important to take the time and adjust the rules of
these tools.
⢠It is important to minimize the noise (false positives) as
it will result in ignoring the reports.
⢠Fail the build if code quality is poor!
Code Quality
12
From Zero to Continuous Delivery
14. 1
4
copyright 2015 Trainologic LTD
⢠Integration tests are very important.
⢠Keep the tests self-contained:
⢠Deploy the artifact to the container
⢠Initialize the DB
⢠Test
⢠Undeploy and clear after youâre done.
Integration Tests
14
From Zero to Continuous Delivery
15. 1
5
copyright 2015 Trainologic LTD
⢠Holds the âartifactsâ of the build.
⢠Everything should be either in the SCM (hand-written
files) or in the binary repository (build artifacts).
⢠Everything should be versioned.
The Binary Repository
15
From Zero to Continuous Delivery
16. 1
6
copyright 2015 Trainologic LTD
⢠Never, ever, allow for overriding release artifacts.
⢠Only the CI (automated) user should be allowed to
deploy a release artifact.
⢠Every artifact has to be linked to a SCM label!
⢠Make it HA (without it everything is down).
Important Practices (Repository)
16
From Zero to Continuous Delivery
17. 1
7
copyright 2015 Trainologic LTD
⢠When moving towards CD, your CI process should also
start the distribution into the staging machines.
⢠CM tool is a must.
⢠Especially for cluster environments.
⢠Deployables should only be taken from the binary
repository!
CI and CD
17
From Zero to Continuous Delivery
18. 1
8
copyright 2015 Trainologic LTD
⢠The âenablerâ of the CD.
⢠Main concern: sync the environments with the master
configuration!
The CM Tool
18
From Zero to Continuous Delivery
19. 1
9
copyright 2015 Trainologic LTD
⢠Responsible mainly for:
⢠Orchestration
⢠Configuration Synchronization
⢠Deployments
CM Tools
19
From Zero to Continuous Delivery
20. 2
0
copyright 2015 Trainologic LTD
Puppet â Deploy Web App
20
From Zero to Continuous Delivery
tomcat::war { 'sample.war':
catalina_base => '/opt/apache-tomcat/tomcat8',
war_source => '/opt/apps/bankapp.war',
}
21. 2
1
copyright 2015 Trainologic LTD
⢠The Staging environment must be the same as the
production one.
⢠Everything that can be tested automatically should be in
the process.
⢠What about manual tests?
Staging
21
From Zero to Continuous Delivery
22. 2
2
copyright 2015 Trainologic LTD
⢠User Acceptance Tests are an important part of a good
CD.
⢠Especially in a complex product.
UAT
22
From Zero to Continuous Delivery
23. 2
3
copyright 2015 Trainologic LTD
⢠UAT is usually done by SME (Subject Matter Experts).
⢠Gather as much automated feedback as possible.
⢠Manual feedback should be gathered using a user-
friendly tool.
UAT
23
From Zero to Continuous Delivery
24. 2
4
copyright 2015 Trainologic LTD
⢠In order to avoid multiple branches, you should use
feature toggles.
⢠âJust âifâs in your codeâ.
⢠Allowing for developers to even commit unfinished code.
⢠Can be a simple boolean, or even an enum or list.
⢠Now we can do a real âdaily commitâ.
Feature Toggles
24
From Zero to Continuous Delivery
26. 2
6
copyright 2015 Trainologic LTD
⢠You should monitor:
⢠System Resources (CPU, Memory, Paging,âŚ)
⢠Container Resources (e.g.: Docker)
⢠Technology specifics (e.g.: GC)
⢠KPIs
⢠Logs
⢠Save aggregated output for baseline comparison.
Monitor
26
From Zero to Continuous Delivery
27. 2
7
copyright 2015 Trainologic LTD
⢠Log monitoring is crucial.
⢠Not only for the application.
⢠Also for DBs, Mail Servers and Application Containers.
⢠There are tools that enable real-time log monitoring.
⢠E.g.:
⢠Logstash+ElasticSearch+Kibana+Graphite
Logging
27
From Zero to Continuous Delivery
28. 2
8
copyright 2015 Trainologic LTD
⢠You can add a CD dashboard to Jenkins:
Dashboard
28
From Zero to Continuous Delivery
29. 2
9
copyright 2015 Trainologic LTD
⢠Well, CD not necessarily the last step.
⢠Now that we have a trustable-deployable artifact, we
can optionally do continuous deployment.
⢠Again, weâll use the CM tools to deploy to the production
machines.
⢠Keep in mind to monitor everything and rollback on
need!
The End (is near?)
29
From Zero to Continuous Delivery
30. 3
0
copyright 2015 Trainologic LTD
⢠CD is important.
⢠But it must be done right.
⢠Not only tools (which are important).
⢠But mainly tests (unit, integration, regression, load,
performance, security, acceptance,âŚ).
⢠Invest in Developers and DevOps culture!
END
30
From Zero to Continuous Delivery