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

I deploy on Fridays (and maybe you should too) (ConFoo 2019)

I deploy on Fridays (and maybe you should too) (ConFoo 2019)

Have you ever heard someone say “Don’t deploy on Friday”? I used to say that too!
Join me as I'll tell you about my experience. Using examples from my work on multiple real world projects, I’ll discuss resilience and operability, deployment strategies, pipelines and continuous testing. Discover the details of trunk based development, feature toggles, pair programming and other best practices and gain the confidence to deploy any day of the week!

Michiel Rook

March 13, 2019
Tweet

More Decks by Michiel Rook

Other Decks in Programming

Transcript

  1. I DEPLOY ON

    FRIDAYS

    (AND MAYBE YOU SHOULD TOO)
    MICHIEL ROOK

    @MICHIELTCS

    View full-size slide

  2. @michieltcs
    DEPLOYING

    View full-size slide

  3. @michieltcs
    ON A FRIDAY

    View full-size slide

  4. @michieltcs
    DEPLOYING?

    View full-size slide

  5. @michieltcs
    ON A

    FRIDAY??

    View full-size slide

  6. @michieltcs
    BUT WHY?

    View full-size slide

  7. @michieltcs
    TRADITION

    View full-size slide

  8. @michieltcs
    RISK

    View full-size slide

  9. @michieltcs
    CONTROL

    View full-size slide

  10. @michieltcs
    CONFIDENCE
    & TRUST

    View full-size slide

  11. @michieltcs
    TIME TO REPAIR / RECOVER

    View full-size slide

  12. @michieltcs
    ON-CALL

    View full-size slide

  13. @michieltcs
    SO

    View full-size slide

  14. @michieltcs
    DON'T DEPLOY ON A FRIDAY!

    View full-size slide

  15. @michieltcs
    I USED TO SAY THAT TOO

    View full-size slide

  16. @michieltcs
    I LIKE MY WEEKENDS

    View full-size slide

  17. @michieltcs
    AND MY EVENINGS

    View full-size slide

  18. @michieltcs
    WHAT ABOUT BUGS?

    View full-size slide

  19. @michieltcs
    WHAT ABOUT 3 PM?

    View full-size slide

  20. @michieltcs
    WHAT ABOUT THURSDAY?

    View full-size slide

  21. @michieltcs
    FRIDAY IS 20%

    OF THE WEEK

    View full-size slide

  22. @michieltcs
    IMPROVE!

    View full-size slide

  23. @michieltcs
    IF IT HURTS

    DO IT MORE OFTEN

    View full-size slide

  24. @michieltcs
    FAILURE IS NOT

    THE OPPOSITE OF SUCCESS

    View full-size slide

  25. SUCCESS CONSISTS
    OF GOING FROM
    FAILURE TO
    FAILURE WITHOUT
    LOSS OF
    ENTHUSIASM.
    Winston Churchill

    View full-size slide

  26. @michieltcs
    BIG STEPS

    View full-size slide

  27. @michieltcs
    FAIL BIG

    View full-size slide

  28. @michieltcs
    SMALL STEPS

    View full-size slide

  29. @michieltcs
    FAIL SMALL

    View full-size slide

  30. @michieltcs
    MAKE IT EFFORTLESS

    View full-size slide

  31. @michieltcs
    REDUCE RISK

    View full-size slide

  32. @michieltcs
    $ = REALIZED VALUE

    CREDITS TO @FGOULDING

    View full-size slide

  33. @michieltcs
    CONTINUOUS EVERYTHING

    View full-size slide

  34. @michieltcs
    DELIVERING VALUE
    TO USERS

    View full-size slide

  35. @michieltcs
    SAFELY & QUICKLY

    View full-size slide

  36. @michieltcs
    IN A SUSTAINABLE
    WAY

    View full-size slide

  37. @michieltcs
    DEV BUILD / TEST ACCEPTANCE PRODUCTION
    CONTINUOUS DELIVERY

    View full-size slide

  38. @michieltcs
    CODE IS ALWAYS

    IN A RELEASABLE STATE

    View full-size slide

  39. @michieltcs
    DEV BUILD / TEST ACCEPTANCE PRODUCTION
    CONTINUOUS DEPLOYMENT

    View full-size slide

  40. @michieltcs
    HIGH VS. LOW PERFORMING TEAMS
    Source: Accelerate - The Science Of DevOps

    View full-size slide

  41. @michieltcs
    SO

    View full-size slide

  42. @michieltcs
    IF YOU CAN DEPLOY

    ON FRIDAY

    View full-size slide

  43. @michieltcs
    AT 5 PM

    View full-size slide

  44. @michieltcs
    YOU CAN DEPLOY

    ANY TIME

    View full-size slide

  45. @michieltcs
    BUT OUR CODE IS
    OLD

    View full-size slide

  46. @michieltcs
    BUT OUR CODE IS
    NOT UNDER TEST

    View full-size slide

  47. @michieltcs
    BUT OUR CODE IS
    IMPOSSIBLE TO CHANGE

    View full-size slide

  48. @michieltcs
    DEALING WITH "LEGACY"

    View full-size slide

  49. @michieltcs
    STRANGLER PATTERN

    View full-size slide

  50. @michieltcs
    ORIGINAL
    MONOLITH
    DB
    @michieltcs

    View full-size slide

  51. @michieltcs
    ORIGINAL
    MONOLITH
    PROXY
    SERVICE
    ORIGINAL
    MONOLITH
    DB
    DB
    DB
    @michieltcs

    View full-size slide

  52. @michieltcs
    ORIGINAL
    MONOLITH
    PROXY
    SERVICE
    ORIGINAL
    MONOLITH
    ORIGINAL
    MONOLITH
    SERVICE SERVICE
    SERVICE
    PROXY
    DB
    DB
    DB
    DB
    DB DB
    @michieltcs

    View full-size slide

  53. @michieltcs
    BRANCH BY ABSTRACTION

    View full-size slide

  54. @michieltcs
    CLIENT
    OLD
    MODULE
    CLIENT
    CLIENT
    @michieltcs

    View full-size slide

  55. @michieltcs
    CLIENT
    ABSTRACTION
    LAYER
    OLD
    MODULE
    CLIENT
    CLIENT
    @michieltcs

    View full-size slide

  56. @michieltcs
    CLIENT
    ABSTRACTION
    LAYER
    OLD
    MODULE
    CLIENT
    CLIENT
    @michieltcs

    View full-size slide

  57. @michieltcs
    CLIENT ABSTRACTION
    LAYER
    OLD
    MODULE
    CLIENT
    CLIENT ABSTRACTION
    LAYER
    NEW
    MODULE
    @michieltcs

    View full-size slide

  58. @michieltcs
    CLIENT ABSTRACTION
    LAYER
    OLD
    MODULE
    CLIENT
    CLIENT ABSTRACTION
    LAYER
    NEW
    MODULE
    @michieltcs

    View full-size slide

  59. @michieltcs
    CLIENT
    ABSTRACTION
    LAYER
    CLIENT
    CLIENT
    NEW
    MODULE
    @michieltcs

    View full-size slide

  60. @michieltcs
    CLIENT
    NEW
    MODULE
    CLIENT
    CLIENT
    @michieltcs

    View full-size slide

  61. @michieltcs
    ON BRANCHES

    View full-size slide

  62. @michieltcs
    CONFLICTS

    View full-size slide

  63. @michieltcs
    "This pull request affects 31 files...

    could be a lot of conflicts if we don't merge it soon"

    View full-size slide

  64. @michieltcs
    CONTINUOUS INTEGRATION

    View full-size slide

  65. @michieltcs
    INTEGRATE TO MASTER

    AT LEAST DAILY

    View full-size slide

  66. @michieltcs
    DELAYING INTEGRATION

    View full-size slide

  67. @michieltcs
    BRANCHING STRATEGIES

    View full-size slide

  68. @michieltcs
    BRANCHING STRATEGIES
    1. DON'T BRANCH

    View full-size slide

  69. @michieltcs
    BRANCHING STRATEGIES
    1. DON'T BRANCH
    2. DON'T BRANCH

    View full-size slide

  70. @michieltcs
    BRANCHING STRATEGIES
    1. DON'T BRANCH
    2. DON'T BRANCH
    3. DON'T BRANCH

    View full-size slide

  71. @michieltcs
    TRUNK

    BASED DEVELOPMENT

    View full-size slide

  72. @michieltcs
    ONLY COMMIT TO MASTER

    View full-size slide

  73. @michieltcs
    MERGING FEATURES?

    View full-size slide

  74. @michieltcs
    DECOUPLE

    DEPLOYMENTS FROM
    RELEASES

    View full-size slide

  75. @michieltcs
    FEATURE TOGGLES

    View full-size slide

  76. @michieltcs
    @michieltcs

    View full-size slide

  77. @michieltcs
    FEATURE TOGGLE DEBT

    View full-size slide

  78. @michieltcs
    SHORT LIVED

    FEATURE BRANCHES?

    View full-size slide

  79. @michieltcs
    PULL REQUESTS?

    View full-size slide

  80. @michieltcs
    CODE REVIEWS ARE USEFUL

    View full-size slide

  81. @michieltcs
    BUT: FLOW DELAY

    View full-size slide

  82. PAIR PROGRAMMING

    View full-size slide

  83. @michieltcs
    CONTINUOUS INLINE

    CODE REVIEW

    View full-size slide

  84. MOB PROGRAMMING

    View full-size slide

  85. @michieltcs
    PIPELINES

    View full-size slide

  86. @michieltcs
    AUTOMATION

    View full-size slide

  87. @michieltcs
    AUTOMATION

    AUTOMATION

    View full-size slide

  88. @michieltcs
    AUTOMATION

    AUTOMATION

    AUTOMATION

    View full-size slide

  89. @michieltcs
    COMPILE
    CHECKOUT TEST PACKAGE

    View full-size slide

  90. @michieltcs
    DEPLOY ACC VERIFY ACC DEPLOY PROD VERIFY PROD

    View full-size slide

  91. @michieltcs
    CONTINUOUS EVERYTHING

    View full-size slide

  92. @michieltcs
    CONTINUOUS TESTING

    View full-size slide

  93. @michieltcs
    CONTINUOUS TESTING
    UNIT TESTS
    ACCEPTANCE TESTS
    E2E

    TESTS
    Cost Speed
    INTEGRATION TESTS

    View full-size slide

  94. @michieltcs
    CONTINUOUS TESTING
    UNIT TESTS
    ACCEPTANCE TESTS
    E2E

    TESTS
    Cost Speed
    Exploratory

    testing & user

    feedback
    Monitoring

    & alerting
    INTEGRATION TESTS

    View full-size slide

  95. @michieltcs
    GOOD ENOUGH

    View full-size slide

  96. @michieltcs
    NO TEST SUITE
    DETECTS EVERY ISSUE

    View full-size slide

  97. @michieltcs
    PIPELINE SPEED = KEY

    View full-size slide

  98. @michieltcs
    DEPLOYMENTS

    View full-size slide

  99. @michieltcs
    ROLLING UPDATE

    View full-size slide

  100. @michieltcs
    LOAD BALANCER
    ROLLING UPDATE
    SERVICE V1.0 SERVICE V1.0
    SERVICE V1.0
    @michieltcs

    View full-size slide

  101. @michieltcs
    LOAD BALANCER
    ROLLING UPDATE
    SERVICE V1.0 SERVICE V1.0
    SERVICE V1.0
    SERVICE V1.1
    @michieltcs

    View full-size slide

  102. @michieltcs
    LOAD BALANCER
    ROLLING UPDATE
    SERVICE V1.0 SERVICE V1.1
    SERVICE V1.0
    SERVICE V1.0
    @michieltcs

    View full-size slide

  103. @michieltcs
    LOAD BALANCER
    ROLLING UPDATE
    SERVICE V1.0 SERVICE V1.1
    SERVICE V1.0
    SERVICE V1.1
    @michieltcs

    View full-size slide

  104. @michieltcs
    LOAD BALANCER
    ROLLING UPDATE
    SERVICE V1.0 SERVICE V1.1
    SERVICE V1.1
    SERVICE V1.0
    @michieltcs

    View full-size slide

  105. @michieltcs
    LOAD BALANCER
    ROLLING UPDATE
    SERVICE V1.0 SERVICE V1.1
    SERVICE V1.1
    SERVICE V1.1
    @michieltcs

    View full-size slide

  106. @michieltcs
    LOAD BALANCER
    ROLLING UPDATE
    SERVICE V1.1 SERVICE V1.1
    SERVICE V1.1
    SERVICE V1.0
    @michieltcs

    View full-size slide

  107. @michieltcs
    LOAD BALANCER
    ROLLING UPDATE
    SERVICE V1.1 SERVICE V1.1
    SERVICE V1.1
    @michieltcs

    View full-size slide

  108. @michieltcs
    pipeline {

    stages {

    stage('Run tests') {

    sh "gradle check"

    }


    stage('Build docker image') {

    sh "docker build -t jobservice:${env.BUILD_NUMBER} ."

    sh "docker push jobservice:${env.BUILD_NUMBER}"

    }


    stage('Deploy staging') {

    sh "ansible-playbook -e BUILD=${env.BUILD_NUMBER}

    -i staging deploy.yml"

    }


    stage('Deploy production') {

    sh "ansible-playbook -e BUILD=${env.BUILD_NUMBER}

    -i prod deploy.yml"

    }

    }

    PIPELINE AS CODE
    image: registry.local/runner:latest


    stages:

    - test

    - images

    - deploy


    phpunit:

    stage: test

    script:

    - bin/phpunit


    images:

    stage: images

    script:

    - make images publish

    only:

    - master


    deploy:

    stage: deploy

    script:

    - make deploy

    only:

    - master

    View full-size slide

  109. @michieltcs
    BUILD PIPELINE
    @michieltcs

    View full-size slide

  110. @michieltcs
    FEEDBACK!

    View full-size slide

  111. @michieltcs
    DEPLOYING

    View full-size slide

  112. @michieltcs
    ON A FRIDAY

    View full-size slide

  113. @michieltcs
    YOU CAN DO IT TOO!

    View full-size slide

  114. @michieltcs
    THANK YOU FOR LISTENING!
    @michieltcs / [email protected]
    www.michielrook.nl

    View full-size slide