Continuous Delivery
with OpenShift
Docker Meetup 31.5.2016
Thomas Philipona
CTO
Agenda
1. OpenShift v3
2. CI / CD
3. Key Concepts
4. OpenShift CI /CD
Pipeline with Jenkins
OpenShift v3
1
OpenShift v3
“next generation PaaS” OpenShift v3 by Red Hat
V3 new implementation based on « de facto » standard technologies
Based on reliable open source concepts
Docker Kubernetes
OpenShift v3
Container Platform as a Service (PaaS)
Multinode platform, Docker container runtime
Docker build platform
Docker registry
One platform runs it all!
Fancy CLI und GUI (self-service)
Container security enabled
Workflows
● Docker build
● Prebuilt image
● Custom builder
● Source To Image
Workflow: Source To Image (S2I)
Git ?
s2i builder image
eg. openshift/ruby-22-centos7
code
code
My App
1.push code to git
2.trigger webhook
3.clone repo
4.evaluate builder
5.assemble image
6.push to registry and deploy
1
2
3
4
5
MyApplicationMyApplicationMyApp
6
Ruby, Java, PHP, NodeJs, ...
CI / CD
2
Continuous Integration
● SCM
● compile and test
● software integration
● reporting
● deployment to test
environment
● extension of CI
● one artifact on all
environments
● fully automated
deployment with a single
click
● prod release with a single
click
● each release is deployed to
production
● rolling deployments
necessary
● blue - green deployments
Continuous Delivery Continuous Deployment
If It Hurts, Do It More Frequently,
and Bring the Pain Forward
Source: Jez Humble, David Farley, Continuous Delivery, Pearson Education, Inc. 2011
CI / CD Workflow Overview
Git
code
Compile, Unit-tests
Integration Tests, Package
Deploy to Dev
Acceptance Tests
Deploy to UAT env
Manual Tests
Deploy to Prod
Key Concepts
3
Maven / Artefactrepository
Maven versioning doesn't work well with continuous delivery
Each commit is a potential release candidate
SNAPSHOT versions do not exist
Maven release plugin is integrated into the Maven lifecycle. All or
nothing
mvn release:prepare mvn release:perform→
Many releases artifactrepository clean up→
Rolling Updates
OpenShift supports rolling updates.
The application notifies the platform when it’s ready for requests.
The routing layer then forwards requests to the new containers.
Automated Database Migration
DB Migrationscripts are part of the deployed application and
executed during startup.
$ php bin/console doctrine:schema:update
$ rake db:migrate
Automated Database Migration
Database knows the current schema version
During application startup / deployment lifecycle hook, the DB
migration is executed
Rolling update
DB must be backward compatible
Concepts: Automated Database Migration
V41 V42 V43
dropColumn
dropColumn
dropTable
dropTable
MyApplicationMyApplicationApp
DB
Concepts: Automated Database Migration
App.v41 App.v42
... oldColumn newColumn ...
guild42 guild42
DB Trigger
OpenShift CI /CD Pipeline with
Jenkins
4
Java Maven Example (1)
Git
code
Jenkins
code
Artefact Repo
artefact
checkout build release deploy
Jenkins
code
Jenkins
artefact
cfg
+ Unit test
+ Integration test
+ Code analyse
Workflow: deploy
1.Jenkins build
mvn clean install
trigger build on OSE
2.custom build
download artefact
build docker image
3.deploy container
Jenkins
artifact
1
2
MyApplicationMyApplicationMyApp
Custom builder
image
3
My App
cfg
Java Maven Example (2)
acceptance tests
Jenkins
test
Jenkins
artefact
cfg
deploy to UAT manual test
Jenkins
artefact
cfg
deploy to Prod
Jenkins Pipeline Plugin
Build jobs written as Groovy scripts.
Build job script is next to source code in git repository
Jenkins provides the environment
● Git / Artifactory / OpenShift Accounts
https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin
Example Build Script
// Stage Checkout
stage 'Checkout'
git url: 'https://gitlab.puzzle.ch/tphilipona/appuio-javaee-
example.git'
// Stage Build
stage 'Build'
sh "${mvnHome}/bin/mvn clean install"
Stage View
Conclusion
5
Key Factors: Automation and Fast Feedback
Customer,
PO
Dev Production
DeploymentIdea, Feature, Bug
Fast, qualified Feedback
Resources
https://docs.openshift.com
Q & A
01.6.2016 in BE
15.6.2016 in ZH
Free APPUiO
OpenShift Techlab
Thank You!

Puzzle ITC Talk @Docker CH meetup CI CD_with_Openshift_0.2

  • 1.
    Continuous Delivery with OpenShift DockerMeetup 31.5.2016 Thomas Philipona CTO
  • 2.
    Agenda 1. OpenShift v3 2.CI / CD 3. Key Concepts 4. OpenShift CI /CD Pipeline with Jenkins
  • 3.
  • 4.
    OpenShift v3 “next generationPaaS” OpenShift v3 by Red Hat V3 new implementation based on « de facto » standard technologies
  • 5.
    Based on reliableopen source concepts Docker Kubernetes
  • 6.
    OpenShift v3 Container Platformas a Service (PaaS) Multinode platform, Docker container runtime Docker build platform Docker registry One platform runs it all! Fancy CLI und GUI (self-service) Container security enabled
  • 7.
    Workflows ● Docker build ●Prebuilt image ● Custom builder ● Source To Image
  • 8.
    Workflow: Source ToImage (S2I) Git ? s2i builder image eg. openshift/ruby-22-centos7 code code My App 1.push code to git 2.trigger webhook 3.clone repo 4.evaluate builder 5.assemble image 6.push to registry and deploy 1 2 3 4 5 MyApplicationMyApplicationMyApp 6 Ruby, Java, PHP, NodeJs, ...
  • 9.
  • 10.
    Continuous Integration ● SCM ●compile and test ● software integration ● reporting ● deployment to test environment ● extension of CI ● one artifact on all environments ● fully automated deployment with a single click ● prod release with a single click ● each release is deployed to production ● rolling deployments necessary ● blue - green deployments Continuous Delivery Continuous Deployment
  • 11.
    If It Hurts,Do It More Frequently, and Bring the Pain Forward Source: Jez Humble, David Farley, Continuous Delivery, Pearson Education, Inc. 2011
  • 12.
    CI / CDWorkflow Overview Git code Compile, Unit-tests Integration Tests, Package Deploy to Dev Acceptance Tests Deploy to UAT env Manual Tests Deploy to Prod
  • 13.
  • 14.
    Maven / Artefactrepository Mavenversioning doesn't work well with continuous delivery Each commit is a potential release candidate SNAPSHOT versions do not exist Maven release plugin is integrated into the Maven lifecycle. All or nothing mvn release:prepare mvn release:perform→ Many releases artifactrepository clean up→
  • 15.
    Rolling Updates OpenShift supportsrolling updates. The application notifies the platform when it’s ready for requests. The routing layer then forwards requests to the new containers.
  • 16.
    Automated Database Migration DBMigrationscripts are part of the deployed application and executed during startup. $ php bin/console doctrine:schema:update $ rake db:migrate
  • 17.
    Automated Database Migration Databaseknows the current schema version During application startup / deployment lifecycle hook, the DB migration is executed Rolling update DB must be backward compatible
  • 18.
    Concepts: Automated DatabaseMigration V41 V42 V43 dropColumn dropColumn dropTable dropTable MyApplicationMyApplicationApp DB
  • 19.
    Concepts: Automated DatabaseMigration App.v41 App.v42 ... oldColumn newColumn ... guild42 guild42 DB Trigger
  • 20.
    OpenShift CI /CDPipeline with Jenkins 4
  • 21.
    Java Maven Example(1) Git code Jenkins code Artefact Repo artefact checkout build release deploy Jenkins code Jenkins artefact cfg + Unit test + Integration test + Code analyse
  • 22.
    Workflow: deploy 1.Jenkins build mvnclean install trigger build on OSE 2.custom build download artefact build docker image 3.deploy container Jenkins artifact 1 2 MyApplicationMyApplicationMyApp Custom builder image 3 My App cfg
  • 23.
    Java Maven Example(2) acceptance tests Jenkins test Jenkins artefact cfg deploy to UAT manual test Jenkins artefact cfg deploy to Prod
  • 24.
    Jenkins Pipeline Plugin Buildjobs written as Groovy scripts. Build job script is next to source code in git repository Jenkins provides the environment ● Git / Artifactory / OpenShift Accounts https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin
  • 25.
    Example Build Script //Stage Checkout stage 'Checkout' git url: 'https://gitlab.puzzle.ch/tphilipona/appuio-javaee- example.git' // Stage Build stage 'Build' sh "${mvnHome}/bin/mvn clean install"
  • 26.
  • 27.
  • 28.
    Key Factors: Automationand Fast Feedback Customer, PO Dev Production DeploymentIdea, Feature, Bug Fast, qualified Feedback
  • 29.
  • 30.
    Q & A 01.6.2016in BE 15.6.2016 in ZH Free APPUiO OpenShift Techlab
  • 31.