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!

2f4800411154a8c66dde489448a044d2?s=128

Michiel Rook

March 13, 2019
Tweet

Transcript

  1. I DEPLOY ON
 FRIDAYS
 (AND MAYBE YOU SHOULD TOO) MICHIEL

    ROOK
 @MICHIELTCS
  2. @michieltcs DEPLOYING

  3. @michieltcs ON A FRIDAY

  4. @michieltcs DEPLOYING?

  5. @michieltcs ON A
 FRIDAY??

  6. None
  7. None
  8. None
  9. None
  10. @michieltcs

  11. @michieltcs BUT WHY?

  12. @michieltcs TRADITION

  13. @michieltcs RISK

  14. @michieltcs CONTROL

  15. @michieltcs CONFIDENCE & TRUST

  16. @michieltcs TIME TO REPAIR / RECOVER

  17. @michieltcs ON-CALL

  18. @michieltcs SO

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

  20. @michieltcs I USED TO SAY THAT TOO

  21. @michieltcs I LIKE MY WEEKENDS

  22. @michieltcs AND MY EVENINGS

  23. @michieltcs WHAT ABOUT BUGS?

  24. @michieltcs WHAT ABOUT 3 PM?

  25. @michieltcs WHAT ABOUT THURSDAY?

  26. @michieltcs FRIDAY IS 20%
 OF THE WEEK

  27. @michieltcs IMPROVE!

  28. @michieltcs IF IT HURTS
 DO IT MORE OFTEN

  29. @michieltcs FAILURE IS NOT
 THE OPPOSITE OF SUCCESS

  30. SUCCESS CONSISTS OF GOING FROM FAILURE TO FAILURE WITHOUT LOSS

    OF ENTHUSIASM. Winston Churchill
  31. @michieltcs BIG STEPS

  32. @michieltcs FAIL BIG

  33. @michieltcs SMALL STEPS

  34. @michieltcs FAIL SMALL

  35. @michieltcs MAKE IT EFFORTLESS

  36. @michieltcs REDUCE RISK

  37. @michieltcs $ = REALIZED VALUE
 CREDITS TO @FGOULDING

  38. @michieltcs CONTINUOUS EVERYTHING

  39. @michieltcs DELIVERING VALUE TO USERS

  40. @michieltcs SAFELY & QUICKLY

  41. @michieltcs IN A SUSTAINABLE WAY

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

  43. @michieltcs CODE IS ALWAYS
 IN A RELEASABLE STATE

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

  45. @michieltcs HIGH VS. LOW PERFORMING TEAMS Source: Accelerate - The

    Science Of DevOps
  46. @michieltcs SO

  47. @michieltcs IF YOU CAN DEPLOY
 ON FRIDAY

  48. @michieltcs AT 5 PM

  49. @michieltcs YOU CAN DEPLOY
 ANY TIME

  50. @michieltcs BUT OUR CODE IS OLD

  51. @michieltcs BUT OUR CODE IS NOT UNDER TEST

  52. @michieltcs BUT OUR CODE IS IMPOSSIBLE TO CHANGE

  53. @michieltcs DEALING WITH "LEGACY"

  54. @michieltcs STRANGLER PATTERN

  55. @michieltcs ORIGINAL MONOLITH DB @michieltcs

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

    @michieltcs
  57. @michieltcs ORIGINAL MONOLITH PROXY SERVICE ORIGINAL MONOLITH ORIGINAL MONOLITH SERVICE

    SERVICE SERVICE PROXY DB DB DB DB DB DB @michieltcs
  58. @michieltcs BRANCH BY ABSTRACTION

  59. @michieltcs CLIENT OLD MODULE CLIENT CLIENT @michieltcs

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

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

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

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

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

  65. @michieltcs CLIENT NEW MODULE CLIENT CLIENT @michieltcs

  66. @michieltcs ON BRANCHES

  67. @michieltcs CONFLICTS

  68. @michieltcs "This pull request affects 31 files...
 could be a

    lot of conflicts if we don't merge it soon"
  69. @michieltcs

  70. @michieltcs CONTINUOUS INTEGRATION

  71. @michieltcs INTEGRATE TO MASTER
 AT LEAST DAILY

  72. @michieltcs DELAYING INTEGRATION

  73. @michieltcs BRANCHING STRATEGIES

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

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

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

    DON'T BRANCH
  77. @michieltcs

  78. @michieltcs TRUNK
 BASED DEVELOPMENT

  79. @michieltcs ONLY COMMIT TO MASTER

  80. @michieltcs MERGING FEATURES?

  81. @michieltcs DECOUPLE
 DEPLOYMENTS FROM RELEASES

  82. @michieltcs FEATURE TOGGLES

  83. @michieltcs

  84. @michieltcs @michieltcs

  85. @michieltcs FEATURE TOGGLE DEBT

  86. @michieltcs SHORT LIVED
 FEATURE BRANCHES?

  87. @michieltcs PULL REQUESTS?

  88. @michieltcs CODE REVIEWS ARE USEFUL

  89. @michieltcs BUT: FLOW DELAY

  90. PAIR PROGRAMMING

  91. @michieltcs CONTINUOUS INLINE
 CODE REVIEW

  92. MOB PROGRAMMING

  93. @michieltcs PIPELINES

  94. @michieltcs AUTOMATION

  95. @michieltcs AUTOMATION
 AUTOMATION

  96. @michieltcs AUTOMATION
 AUTOMATION
 AUTOMATION

  97. @michieltcs COMPILE CHECKOUT TEST PACKAGE

  98. @michieltcs DEPLOY ACC VERIFY ACC DEPLOY PROD VERIFY PROD

  99. @michieltcs CONTINUOUS EVERYTHING

  100. @michieltcs CONTINUOUS TESTING

  101. @michieltcs CONTINUOUS TESTING UNIT TESTS ACCEPTANCE TESTS E2E
 TESTS Cost

    Speed INTEGRATION TESTS
  102. @michieltcs CONTINUOUS TESTING UNIT TESTS ACCEPTANCE TESTS E2E
 TESTS Cost

    Speed Exploratory
 testing & user
 feedback Monitoring
 & alerting INTEGRATION TESTS
  103. @michieltcs GOOD ENOUGH

  104. @michieltcs NO TEST SUITE DETECTS EVERY ISSUE

  105. @michieltcs PIPELINE SPEED = KEY

  106. @michieltcs DEPLOYMENTS

  107. @michieltcs ROLLING UPDATE

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

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

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

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

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

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

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

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

    V1.1 @michieltcs
  116. @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
  117. @michieltcs BUILD PIPELINE @michieltcs

  118. @michieltcs FEEDBACK!

  119. @michieltcs DEPLOYING

  120. @michieltcs ON A FRIDAY

  121. @michieltcs YOU CAN DO IT TOO!

  122. @michieltcs THANK YOU FOR LISTENING! @michieltcs / michiel@michielrook.nl www.michielrook.nl