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

Setting up a Continuous Delivery environment in...

Mike van Riel
November 18, 2013

Setting up a Continuous Delivery environment in 3 hours #zceu

The workshop slides for the talk 'Setting up a Continuous Delivery environment in 3 hours' at ZendCon Europe 2013

Mike van Riel

November 18, 2013
Tweet

More Decks by Mike van Riel

Other Decks in Technology

Transcript

  1. https://joind.in/9283 About me • I am Mike van Riel •

    Lead Developer for phpDocumentor • Software Composer at Ingewikkeld
  2. https://joind.in/9283 About me • I am Mike van Riel •

    Lead Developer for phpDocumentor • Software Composer at Ingewikkeld • Foster father of two cute dogs
  3. https://joind.in/9283 Config flags • Toggles features on and off •

    Allows a team to continuously integrate • Can be used for Canary testing • Provides a rollback in case of flawed functionality
  4. https://joind.in/9283 Analysis tools • PHPUnit • Behat • phpDocumentor •

    PHP_CodeSniffer • PHP_Depend • PHP_PMD • phploc • phpcpd
  5. https://joind.in/9283 Build and deployment tools • Phing • Ant •

    Make • Capistrano • Webistrano • Deployinator • Maven
  6. https://joind.in/9283 Environment • Ubuntu 12.04 • Apache • MySQL •

    PHP 5.3 • XDebug • One vhost – dev.www.blog.com • Packages – Git – Augeas-tools – Libaugeas-dev – Libaugeas-ruby – Jenkins
  7. https://joind.in/9283 Goal • Think before you start • Determine your

    process and workflow • Does your current flow match with Continuous Deployment
  8. https://joind.in/9283 Think about the following • Versioning your application •

    Versioning your environment • Version numbering • Which tools to use • How to react on a build failure
  9. https://joind.in/9283 Versioning • Master / trunk should always be deployable

    • Any change in master / trunk should result in a release candidate • Release branches, develop mainlines and other constructs do not play a role with Continuous Deployment – There are exceptions
  10. https://joind.in/9283 Goal • Determine how to start automating your build

    and deployment process • Review your deployment strategy • Automate your deployment process using phing
  11. https://joind.in/9283 Stages • Commit stage – Pull changes – Clean

    workspace – Initialize workspace – Run unit tests • Deploy stage – Upload your application – Switch symlink
  12. https://joind.in/9283 Deployment strategy • Have a symlink representing your current

    release • Upload your new release to a separate folder • Integrate configuration in the new folder • Create symlink of the new release • Move the symlink of the new release over the current using `mv -Tf`
  13. https://joind.in/9283 Goal • Setup a job in Jenkins • Add

    deployment as a post-build action • Execute our first automated build and deployment
  14. https://joind.in/9283 Goal • Add a new staging environment to puppet

    • Change our deployment action to deploy to staging instead of production – using the changes of last exercise
  15. https://joind.in/9283 Goal • Add a new view for our project

    • Add a new deploy job • Persist workspace between jobs • Try out our new process
  16. https://joind.in/9283 Adding a new Deploy job • Add a new

    job `blog-deploy` • Configure `blog` job to archive the build • Configure `blog-deploy` job to use the archived build
  17. https://joind.in/9283 Goal • Create a Behat test • Alter our

    build file and add a UAT stage • Add a new UAT job • Persist workspace between jobs • Automatically trigger UAT job after `blog` job • Move deployment to staging from `blog` to UAT job • Test our new process
  18. https://joind.in/9283 UAT Stage • May run longer than 5 minutes

    • Can trigger a deployment to staging for exploratory testing • Automate!
  19. https://joind.in/9283 Goal • Use the pipeline plugin to create a

    new view with your process • Walk through your process
  20. https://joind.in/9283 About me • I am Mike van Riel •

    Lead Developer for phpDocumentor • Software Composer at Ingewikkeld
  21. https://joind.in/9283 About me • I am Mike van Riel •

    Lead Developer for phpDocumentor • Software Composer at Ingewikkeld • Foster father of two cute dogs
  22. https://joind.in/9283 Config flags • Toggles features on and off •

    Allows a team to continuously integrate • Can be used for Canary testing • Provides a rollback in case of flawed functionality
  23. https://joind.in/9283 Analysis tools • PHPUnit • Behat • phpDocumentor •

    PHP_CodeSniffer • PHP_Depend • PHP_PMD • phploc • phpcpd
  24. https://joind.in/9283 Build and deployment tools • Phing • Ant •

    Make • Capistrano • Webistrano • Deployinator • Maven
  25. https://joind.in/9283 Environment • Ubuntu 12.04 • Apache • MySQL •

    PHP 5.3 • XDebug • One vhost – dev.www.blog.com • Packages – Git – Augeas-tools – Libaugeas-dev – Libaugeas-ruby – Jenkins
  26. https://joind.in/9283 The Project - Blog • URL: http://dev.www.blog.com/index.php/blog/ • Jenkins:

    http://dev.www.blog.com:8080 • Path: /vagrant/app • Git: file:///vagrant/app
  27. https://joind.in/9283 Goal • Think before you start • Determine your

    process and workflow • Does your current flow match with Continuous Deployment
  28. https://joind.in/9283 Think about the following • Versioning your application •

    Versioning your environment • Version numbering • Which tools to use • How to react on a build failure
  29. https://joind.in/9283 Versioning • Master/trunk should always be deployable • Any

    change in master / trunk should result in a release candidate • Release branches, develop mainlines and other constructs do not play a role with Continuous Deployment – There are exceptions
  30. https://joind.in/9283 Goal • Determine how to start automating your build

    and deployment process • Review your deployment strategy • Automate your deployment process using phing
  31. https://joind.in/9283 Stages • Commit stage – Pull changes – Clean

    workspace – Initialize workspace – Run unit tests • Deploy stage – Upload your application – Switch symlink
  32. https://joind.in/9283 Deployment strategy • Have a symlink representing your current

    release • Upload your new release to a separate folder • Integrate configuration in the new folder • Create symlink of the new release • Move the symlink of the new release over the current using `mv -Tf`
  33. https://joind.in/9283 Goal • Setup a job in Jenkins • Add

    deployment as a post-build action • Execute our first automated build and deployment
  34. https://joind.in/9283 Goal • Add a new staging environment to puppet

    • Change our deployment action to deploy to staging instead of production – using the changes of last exercise
  35. https://joind.in/9283 Goal • Add a new view for our project

    • Add a new deploy job • Persist workspace between jobs • Try out our new process
  36. https://joind.in/9283 Adding a new Deploy job • Add a new

    job `blog-deploy` • Configure `blog` job to archive the build • Configure `blog-deploy` job to use the archived build
  37. https://joind.in/9283 Goal • Create a Behat test • Alter our

    build file and add a UAT stage • Add a new UAT job • Persist workspace between jobs • Automatically trigger UAT job after `blog` job • Move deployment to staging from `blog` to UAT job • Test our new process
  38. https://joind.in/9283 UAT Stage • May run longer than 5 minutes

    • Can trigger a deployment to staging for exploratory testing • Automate!
  39. https://joind.in/9283 Goal • Use the pipeline plugin to create a

    new view with your process • Walk through your process