Continuous Delivery Michael Neale @michaelneale cloudbees.com Tuesday, 26 November 13
May 10, 2015
Continuous DeliveryMichael [email protected]
Tuesday, 26 November 13
Continuous Delivery?
Tuesday, 26 November 13
Definitions
Continuous Deployment:
FTP php files to production server.
Done.
Tuesday, 26 November 13
Definitions
Continuous Deployment:
Change in SCM -> Build/Test -> Deploy (deploy to prod, or staging?)
Tuesday, 26 November 13
Definitions
Continuous Delivery:
Change in SCM -> Build/Test -> Be able to deploy at will (keep it clean, ready to deploy)
Typically always deployed to a staging environment
Tuesday, 26 November 13
Definitions
Continuous Integration:
Change in SCM -> Build/Test -> Feedback cycle
CD requires “CI”
Tuesday, 26 November 13
CD - commit to deploy
Target server
Tuesday, 26 November 13
Benefits
Quicker turn aroundHappier usersLess risk per deploymentIdeally deploy “as is” at (almost) any timeFits with “agile” approaches nicely
Lots more - bing it!
Tuesday, 26 November 13
Necessity
Risk of deployment proportional to time since last deployment
We are all deploying services now, not so much apps in a box (other than app store!) - world has changed.
Tuesday, 26 November 13
Continuous Integration
Jenkins-ci.org
Also have to mention Atlassian Bamboo!
Tuesday, 26 November 13
Requirements for CD
Deep SCM integration - commit hooksReliable Production-CI service (not under someones desk)Automated DeploymentMultiple deploy target environmentsEasy rollback
Tuesday, 26 November 13
CloudBees is:
Tuesday, 26 November 13
CI serverApp service repos
Tuesday, 26 November 13
Fiddly
Fiddly to setup by hand - all the hooks, triggers, scripts, automation...
so we came up with “ClickStarts”
Set up all the moving parts
Tuesday, 26 November 13
CD quick start - automated
Clone from template to private repoSetup commit hooksSetup buildIssue initial build & run testsSetup runtime container Deploy
All one click, ideally
Tuesday, 26 November 13
Tedium Lots of one off steps to get going with CD
You won’t ever remember how to setup commit hooks each time you need to
Tuesday, 26 November 13
Tuesday, 26 November 13
AppsForge/source repos
Jenkins
Build slave pools
open source/template repos
on commit
Tuesday, 26 November 13
Dog food eating
Tuesday, 26 November 13
Tuesday, 26 November 13
CD - dogfoodSome projects are direct to production on tests pass
Some are direct to “staging” until merged into master branch (git branches to control deployment is common)
Easily, and often, roll back.
Tuesday, 26 November 13
Tuesday, 26 November 13
ExamplePlay Framework:
“Seed project”
Clone into actual project - setup build steps - setup unit/e2e tests - prepare/deploy into a container - setup commit hook
Tuesday, 26 November 13
https://github.com/../play2-clickstart
git.cloudbees.com/your/app
you.ci.cloudbees.com
yourapp.com
shallow clone
Your code
Tuesday, 26 November 13
But wait, it isn’t that easyMore complex workflowsWarming up environmentsSafe fall-backMonolithic appsDatabase updates
Some solutions...
Tuesday, 26 November 13
Complex workflows
Tuesday, 26 November 13
Jenkins pipeline plugin
https://wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Plugin
Tuesday, 26 November 13
Warming up environmentsAnd “fail safe” fall back.
BOTH solved by blue-green deployment.
http://martinfowler.com/bliki/BlueGreenDeployment.html
Tuesday, 26 November 13
Tuesday, 26 November 13
Blue Green2 clones of production environment
Always deploy to “blue”When ready - flip switch (router) from green to blue.
If bad - flip back - no redeployments, no other changes
Tuesday, 26 November 13
Blue GreenNeed to be both production grade environments!
Safer deployment
Can warm up “blue” before flipping switch (prime caches, run final smoke testing)
Deploying to prod is NOT deploying - just changing what you call production!
Tuesday, 26 November 13
Blue Greenhttp://developer-blog.cloudbees.com/2013/08/blue-
green-deployments-with-jenkins-and.html
Tuesday, 26 November 13
Blue GreenCan shut down “blue” if needed, to safe resources
Large customers already doing this
Large web companies all do this
Tuesday, 26 November 13
Blue GreenWarming up: as simple as a curl script in a loop**
** Works quite well
Tuesday, 26 November 13
Monolithic appsSolution: avoid if you can!
Microservices (a whole other topic I love to talk about)
CD then applies to each service, individually. Each service has radically different release cadences.
Releases are massively low risk.
Tuesday, 26 November 13
micro-service debugging
Tuesday, 26 November 13
Monolithic appsStill can do CD
Good test suite?
Isolate “risky” changes - more frequent low risk deploys.
Risk of deploy is proportional to the time between deploys
Tuesday, 26 November 13
DatabasesOption 1: Snapshot and then deploy (for rollback)
Option 2: Separate out “destructive” deploys (schema change, data change) from CD deploys - not one size fits all
Daily deploys: DB/data scheme doesn’t change daily (I hope!)
Tuesday, 26 November 13
Thank you
Michael Nealehttps://twitter.com/michaelnealehttps://developer.cloudbees.com
Tuesday, 26 November 13