I deploy on Fridays (and maybe you should too)

I deploy on Fridays (and maybe you should too)

Have you ever heard yourself or someone else say “Don’t deploy on Friday”? Perhaps it’s your company’s policy?

I used to have a “Fear of Fridays” too! Join me as I tell you about my experiences and how I improved.
Learn about build pipelines, automated testing, continuous deployment and monitoring. Discover the details of trunk based development, feature toggles, pair programming and other best practices, and gain the confidence to deploy multiple times per day, any day of the week!

2f4800411154a8c66dde489448a044d2?s=128

Michiel Rook

June 30, 2017
Tweet

Transcript

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

    ROOK - @MICHIELTCS
  2. ▸ Developer, consultant, trainer, speaker ▸ @michieltcs

  3. DEPLOYING

  4. ON A FRIDAY

  5. DEPLOYING?

  6. ON A
 FRIDAY??

  7. None
  8. None
  9. None
  10. BUT WHY?

  11. RISK

  12. CONTROL

  13. CONFIDENCE

  14. TRUST

  15. TIME TO REPAIR

  16. TIME TO RECOVER

  17. ON-CALL STRESS

  18. OVERTIME

  19. DON'T DEPLOY ON A FRIDAY

  20. I USED TO SAY THAT TOO

  21. I LIKE MY WEEKENDS

  22. AND MY EVENINGS

  23. WHAT ABOUT BUGS?

  24. WHAT ABOUT 3 PM?

  25. WHAT ABOUT THURSDAY?

  26. IMPROVE!

  27. IF IT HURTS
 DO IT MORE OFTEN

  28. FRIDAY IS 20%
 OF THE WEEK

  29. SMALL STEPS

  30. AUTOMATION

  31. AUTOMATION
 AUTOMATION

  32. AUTOMATION
 AUTOMATION
 AUTOMATION

  33. CONTINUOUS EVERYTHING

  34. CONTINUOUS INTEGRATION

  35. DEV BUILD / TEST CONTINUOUS INTEGRATION @michieltcs

  36. INTEGRATE AT LEAST
 DAILY

  37. CONTINUOUS DELIVERY

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

  39. CONTINUOUS DEPLOYMENT

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

  41. CHANGES IN IT PERFORMANCE OF HIGH PERFORMERS Source: 2017 State

    Of DevOps report @michieltcs
  42. Source: 2017 State Of DevOps report @michieltcs

  43. TRUNK
 BASED DEVELOPMENT

  44. ONLY COMMIT TO MASTER

  45. SHORT LIVED
 FEATURE BRANCHES?

  46. NO BRANCHES

  47. CONFLICTS

  48. None
  49. "This pull request affects 31 files... could be a lot

    of conflicts if we don't merge it soon"
  50. CODE REVIEWS

  51. PAIR PROGRAMMING

  52. CONTINUOUS INLINE
 CODE REVIEW

  53. FEATURE TOGGLES

  54. DECOUPLE
 DEPLOYMENTS FROM RELEASES

  55. @michieltcs

  56. $conditions = [new OperatorCondition('userId', new LessThan(100))];
 $manager->add(new Toggle('frontPageToggle', $conditions)); $context

    = new Context();
 $context->set('userId', 50);
 
 if ($manager->active('frontPageToggle', $context)) {
 // do stuff
 } @michieltcs
  57. DEALING WITH LEGACY

  58. EXPAND - CONTRACT

  59. CLIENT EXISTING API @michieltcs CLIENT CLIENT

  60. CLIENT EXISTING API @michieltcs CLIENT CLIENT NEW
 API

  61. CLIENT EXISTING API @michieltcs CLIENT CLIENT NEW
 API

  62. CLIENT EXISTING API @michieltcs CLIENT CLIENT NEW
 API

  63. CLIENT EXISTING API @michieltcs CLIENT CLIENT NEW
 API

  64. CLIENT @michieltcs CLIENT CLIENT NEW
 API

  65. STRANGLER PATTERN

  66. ORIGINAL MONOLITH DB @michieltcs

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

  68. ORIGINAL MONOLITH PROXY SERVICE ORIGINAL MONOLITH ORIGINAL MONOLITH SERVICE SERVICE

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

  70. CLIENT OLD MODULE @michieltcs CLIENT CLIENT

  71. CLIENT ABSTRACTION LAYER OLD MODULE @michieltcs CLIENT CLIENT

  72. CLIENT ABSTRACTION LAYER OLD MODULE @michieltcs CLIENT CLIENT

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

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

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

  76. CLIENT NEW MODULE @michieltcs CLIENT CLIENT

  77. CONTINUOUS TESTING

  78. POTENTIAL TESTING LAYERS UNIT TESTS INTEGRATION
 TESTS ACCEPTANCE
 TESTS UI

    TESTS @michieltcs
  79. POTENTIAL TESTING LAYERS UNIT TESTS INTEGRATION
 TESTS ACCEPTANCE UI TESTS

    public function testJobCannotBeFound() {
 $jobRepository = $this->prophesize(JobRepository::class);
 $jobRepository->getById(EXPECTED_JOB_ID)
 ->shouldBeCalled()
 ->willReturn(false);
 
 $jobService = new JobService($jobRepository->reveal());
 
 $this->assertFalse($jobService->getById(EXPECTED_JOB_ID));
 } @michieltcs
  80. POTENTIAL TESTING LAYERS UNIT TESTS INTEGRATION
 TESTS ACCEPTANCE
 TESTS UI

    TESTS public function testFindJob() {
 $expectedJob = $this->loadFixture('active_job.yml');
 $actualJob = $this->repository->getById($expectedJob->getId());
 
 self::assertInstanceOf(Job::class, $actualJob);
 self::assertEquals($expectedJob->getId(), $actualJob->getId());
 } @michieltcs
  81. POTENTIAL TESTING LAYERS UNIT TESTS INTEGRATION
 TESTS ACCEPTANCE
 TESTS UI

    TESTS Scenario: Link to related job
 Given a job exists
 And there are related jobs available
 When that job is viewed
 Then a list of related jobs is shown
 And each related job links to the detail page of the related job @michieltcs
  82. POTENTIAL TESTING LAYERS UNIT TESTS INTEGRATION
 TESTS ACCEPTANCE
 TESTS UI

    TESTS @michieltcs
  83. CONTINUOUS TESTING UNIT TESTS ACCEPTANCE TESTS UI
 TESTS Cost Speed

    Exploratory
 testing Monitoring @michieltcs INTEGRATION TESTS
  84. GOOD ENOUGH

  85. NO TEST SUITE DETECTS EVERY ISSUE

  86. PIPELINE SPEED = KEY

  87. DEPLOYMENTS

  88. LOAD BALANCER SERVICE V1.0 SERVICE V1.1 CANARY 100% 0% SERVICE

    V1.0 SERVICE V1.1 SERVICE V1.0 SERVICE V1.1 @michieltcs
  89. LOAD BALANCER SERVICE V1.0 SERVICE V1.1 CANARY 99% 1% SERVICE

    V1.0 SERVICE V1.1 SERVICE V1.0 SERVICE V1.1 @michieltcs
  90. LOAD BALANCER SERVICE V1.0 SERVICE V1.1 CANARY 50% 50% SERVICE

    V1.0 SERVICE V1.1 SERVICE V1.0 SERVICE V1.1 @michieltcs
  91. LOAD BALANCER SERVICE V1.0 SERVICE V1.1 CANARY 0% 100% SERVICE

    V1.0 SERVICE V1.1 SERVICE V1.0 SERVICE V1.1 @michieltcs
  92. LOAD BALANCER SERVICE V1.0 SERVICE V1.1 CANARY 0% 100% SERVICE

    V1.0 SERVICE V1.1 SERVICE V1.0 SERVICE V1.1 @michieltcs
  93. LOAD BALANCER SET A SET B BLUE-GREEN 100% 0% SERVICE

    V1.0 SERVICE V1.0 @michieltcs
  94. LOAD BALANCER SET A SET B BLUE-GREEN 100% 0% SERVICE

    V1.0 SERVICE V1.0 SERVICE V1.1 SERVICE V1.1 @michieltcs
  95. LOAD BALANCER SET A SET B BLUE-GREEN 0% 100% SERVICE

    V1.0 SERVICE V1.0 SERVICE V1.1 SERVICE V1.1 @michieltcs
  96. LOAD BALANCER SET A SET B BLUE-GREEN 0% 100% SERVICE

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

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

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

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

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

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

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

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

    @michieltcs
  105. PIPELINES

  106. PIPELINE AS CODE node {
 stage('Run tests') {
 sh "phpunit"


    sh "behat"
 }
 
 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"
 }
 } @michieltcs
  107. BUILD PIPELINE @michieltcs

  108. FEEDBACK

  109. None
  110. None
  111. Reduce cycle times. React faster to the market and test

    product ideas. Make things! We make Agile, DevOps and Continuous Delivery accessible! Hands-on, results- oriented approach to get you where you need to be. Modern infrastructure and pipelines in minutes.
  112. THANK YOU! @michieltcs / mrook@fourscouts.nl www.michielrook.nl https://joind.in/talk/e9e5e