Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The road to continuous deployment

The road to continuous deployment

Deploying code changes continuously to your production environment has many benefits. New features get to your users much faster which enables very short and quick iterations on them. And due to the small change sets you tend to encounter less bugs and regressions. In this talk I’ll present what Continuous Deployment means, and what you have to do, step-by-step, to make it work successfully for your project. We will cover topics like trunk based development, feature flags, partial roll outs, continuous integration, deployment automation and application monitoring.

Bastian Hofmann

October 31, 2015
Tweet

More Decks by Bastian Hofmann

Other Decks in Programming

Transcript

  1. A few words
    about me

    View full-size slide

  2. http://speakerdeck.com/u/bastianhofmann

    View full-size slide

  3. How many
    releases?

    View full-size slide

  4. Continuous
    Integration?

    View full-size slide

  5. Continuous
    Deployment?

    View full-size slide

  6. Feature flags?

    View full-size slide

  7. Central log
    management?

    View full-size slide

  8. If not, you will after
    the talk.

    View full-size slide

  9. Continuous
    Deployment

    View full-size slide

  10. Deploying code
    changes to
    production
    continuously

    View full-size slide

  11. Classic approach

    View full-size slide

  12. http://en.wikipedia.org/wiki/File:Waterfall_model.svg

    View full-size slide

  13. http://en.wikipedia.org/wiki/File:Scrum_process.svg

    View full-size slide

  14. Going further

    View full-size slide

  15. Continuous
    Deployment

    View full-size slide

  16. Smaller change sets

    View full-size slide

  17. Finding the bug

    View full-size slide

  18. Shortest „time to
    bugfix“ possible

    View full-size slide

  19. Better performance

    View full-size slide

  20. Better conversion

    View full-size slide

  21. Faster iterations

    View full-size slide

  22. Awesome, I’m sold

    View full-size slide

  23. How can I
    introduce it?

    View full-size slide

  24. The whole team
    has to live it

    View full-size slide

  25. Not only doing
    more releases!

    View full-size slide

  26. Step by step

    View full-size slide

  27. is very
    important

    View full-size slide

  28. does not scale

    View full-size slide

  29. Automated Tests

    View full-size slide

  30. Integration Tests

    View full-size slide

  31. Acceptance Tests

    View full-size slide

  32. Regression Tests

    View full-size slide

  33. Continuous
    Integration

    View full-size slide

  34. Jenkins
    http://jenkins-ci.org/

    View full-size slide

  35. Development
    process

    View full-size slide

  36. The problem with
    Feature Branches

    View full-size slide

  37. -> Big changes

    View full-size slide

  38. Trunk/master based
    development

    View full-size slide

  39. Every commit gets
    integrated

    View full-size slide

  40. Every commit gets
    deployed

    View full-size slide

  41. No commits that
    are not stable

    View full-size slide

  42. Frequent release
    branches with
    cherry pics

    View full-size slide

  43. http://paulhammant.com/2013/03/04/facebook-tbd/

    View full-size slide

  44. http://paulhammant.com/2013/05/06/googles-scaled-trunk-based-development/

    View full-size slide

  45. http://paulhammant.com/2013/03/04/facebook-tbd/

    View full-size slide

  46. But there is stuff that
    takes longer then
    an hour to develop

    View full-size slide

  47. Feature Flags/
    Toggles

    View full-size slide

  48. Release !==
    Deployment

    View full-size slide

  49. public function hasAccess(
    $accountId, array $roleNames
    ) {
    return featureFlag()->isActive(
    FeatureFlag::TEST_ONE
    );
    }

    View full-size slide

  50. Partial rollout

    View full-size slide

  51. Experiments (A/B Testing)

    View full-size slide

  52. other also possible:
    goal early
    integration

    View full-size slide

  53. Finally: Getting your
    code live

    View full-size slide

  54. Automatic builds

    View full-size slide

  55. Static caches

    View full-size slide

  56. Custom scripts

    View full-size slide

  57. Hook it into Jenkins

    View full-size slide

  58. Automatic
    deployment

    View full-size slide

  59. One-click-
    deployment

    View full-size slide

  60. Fast deployment

    View full-size slide

  61. Fast rollbacks

    View full-size slide

  62. http://www.ansible.com/

    View full-size slide

  63. http://capistranorb.com/

    View full-size slide

  64. Etsy Deploynator
    http://codeascraft.com/2010/05/20/quantum-of-deployment/

    View full-size slide

  65. Custom scripts

    View full-size slide

  66. Zero downtime

    View full-size slide

  67. Minimize the
    amount of time you
    have two different
    versions online in
    parallel

    View full-size slide

  68. LB
    Green
    Blue
    Deploy new version

    View full-size slide

  69. Attention: Path
    changes

    View full-size slide

  70. Cache warmup

    View full-size slide

  71. Asset invalidation

    View full-size slide

  72. https://www.npmjs.org/package/grunt-cache-invalidate
    https://www.npmjs.org/package/gulp-rev
    https://www.npmjs.org/package/grunt-static-ctrl

    View full-size slide

  73. Let’s deploy
    something

    View full-size slide

  74. Staging System(s)

    View full-size slide

  75. Central
    DEV
    Production
    Near
    Production
    Integration

    View full-size slide

  76. Build/Test/Release
    pipeline

    View full-size slide

  77. Keep it fast

    View full-size slide

  78. Allow manual
    shortcuts

    View full-size slide

  79. Schema migrations

    View full-size slide

  80. Non BC breaking

    View full-size slide

  81. Only safe
    operations

    View full-size slide

  82. Migration in steps

    View full-size slide

  83. No software is bug
    free

    View full-size slide

  84. Finding bugs as
    early as possible

    View full-size slide

  85. Detecting errors

    View full-size slide

  86. Central log
    management

    View full-size slide

  87. Logstash,
    Elasticsearch,
    Kibana

    View full-size slide

  88. Detecting regressions

    View full-size slide

  89. Plotting everything

    View full-size slide

  90. Finding the cause

    View full-size slide

  91. Anomaly detection

    View full-size slide

  92. Invest in quality

    View full-size slide

  93. Invest in
    performance

    View full-size slide

  94. Invest in your
    processes

    View full-size slide

  95. Invest in agility

    View full-size slide

  96. Continuous
    Deployment

    View full-size slide

  97. http://twitter.com/BastianHofmann
    http://lanyrd.com/people/BastianHofmann
    http://speakerdeck.com/u/bastianhofmann
    [email protected]

    View full-size slide