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

Continuous Deployment in 3 hours

Continuous Deployment in 3 hours

Mike van Riel

October 11, 2013
Tweet

More Decks by Mike van Riel

Other Decks in Technology

Transcript

  1. About me • Lead Developer of phpDocumentor • Software Composer

    at Ingewikkeld • Foster father of 2 happy dogs • 11 years of experience with PHP
  2. 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
  3. Analysis tools • PHPUnit • Behat • PhpDocumentor • PHP_CodeSniffer

    • PHP_Depend • PHP_PMD • phploc • phpcpd
  4. Build and deployment tools • Phing • Ant • Make

    • Capistrano • Webistrano • Deployinator • Maven
  5. 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
  6. Goal • Think before you start • Determine your process

    and workflow • Does your current flow match with Continuous Deployment
  7. Think about the following • Versioning your application • Versioning

    your environment • Version numbering • Which tools to use • How to react on a build failure
  8. 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
  9. Goal • Determine how to start automating your build and

    deployment process • Review your deployment strategy • Automate your deployment process using phing
  10. Stages • Commit stage – Pull changes – Clean workspace

    – Initialize workspace – Run unit tests • Deploy stage – Upload your application – Switch symlink
  11. 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`
  12. Goal • Update jenkins and add phing plugin • Setup

    a job in Jenkins • Add deployment as a post-build action • Execute our first automated build and deployment
  13. Update Jenkins $ wget ­q ­O ­ http://pkg.jenkins­ci.org/debian­stable/jenkins­ci.org.ke y |

    sudo apt­key add ­ Add to /etc/apt/sources/list: deb http://pkg.jenkins­ci.org/debian­stable binary/ And run: $ sudo apt­get update $ sudo apt­get install jenkins
  14. Install phing plugin $ java ­jar jenkins­cli.jar ­s http://localhost:8080 install­plugin

    checkstyle cloverphp dry htmlpublisher jdepend plot pmd violations xunit git clone­workspace­scm build­pipeline­plugin $ java ­jar /vagrant/puppet/manifests/jenkins­cli.jar ­s http://localhost:8080 install­plugin phing credentials
  15. 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
  16. Goal • Add a new view for our project •

    Add a new deploy job • Persist workspace between jobs • Try out our new process
  17. 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
  18. 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
  19. UAT Stage • May run longer than 5 minutes •

    Can trigger a deployment to staging for exploratory testing • Automate!
  20. Goal • Use the pipeline plugin to create a new

    view with your process • Walk through your process