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

DEVOPS For PHP Developers

Jeremy Quinton
February 19, 2015

DEVOPS For PHP Developers

Talk on Devops given at London PHP Conference

Jeremy Quinton

February 19, 2015
Tweet

More Decks by Jeremy Quinton

Other Decks in Technology

Transcript

  1. DEVOPS
    for PHP Developers
    https://www.flickr.com/photos/inedito/2963474098
    PHP UK Conference London 2015
    - Jeremy Quinton

    View full-size slide

  2. • Working on the web with PHP since 2003
    • Some operations work
    • Open Source Enthusiast
    • Big Fan of DEVOPS cultural and professional movement
    About

    View full-size slide

  3. Ideology
    The set of ideas and beliefs of a group…
    http://www.merriam-webster.com/dictionary/ideology

    View full-size slide

  4. Complaints and Confusion
    https://www.flickr.com/photos/jkfjellestad/15524719680

    View full-size slide

  5. Ideas or set of Ideals
    (New and Old)
    Which has lead to a
    common set of practices
    and patterns
    DEVOPS (at a high level)
    Goal of my talk today is to share some of these ideas, practices and
    patterns

    View full-size slide

  6. Common DEVOPS definition - CAMS
    Damon Edwards and John Willis
    • Culture
    • Automation
    • Measurement
    • Sharing

    View full-size slide

  7. The 2014 State of DEVOPS Report
    The largest and most comprehensive DEVOPS study to date
    https://www.flickr.com/photos/80497449@N04/10012162166
    The first scientific study of the relationship between
    Organisational performance, IT performance, DEVOPS practices.

    View full-size slide

  8. The state of DEVOPS 2014
    - http://puppetlabs.com/sites/default/files/2014-state-of-devops-report.pdf
    • Strong IT performance is a competitive advantage
    • Strong correlation between DEVOPS practices and IT performance

    View full-size slide

  9. http://en.wikipedia.org/wiki/Gene_Kim
    http://en.wikipedia.org/wiki/Gene_Kim#mediaviewer/File:Gene_Kim.jpg
    Gene Kim
    “The best just keep getting
    better and accelerating
    away from the herd.”
    Author of the Phoenix project
    A Novel About IT, DevOps, and Helping Your Business Win

    View full-size slide

  10. “DEVOPS means [caring] about your job enough to not pass
    the buck. DEVOPS means [caring] about your job enough to
    want to learn all the parts and not just your little world.
    !
    Developers need to understand infrastructure. Operations
    people need to understand code. People need to work with
    each other and not just occupy space next to each other.” –-
    John E. Vincent
    !
    https://twitter.com/lusis

    View full-size slide

  11. Developer Mindset
    • How are we going to deploy our code?
    • How are we going to monitor the application in a production environment?
    • Is this code going to work in a multi node environment? 

    e.g. sessions, caching etc
    • Software is a thing that exists after it has been written

    View full-size slide

  12. Break down the silos. But why?
    https://www.flickr.com/photos/docsearls/5500714140

    View full-size slide

  13. Development
    Developers
    QA
    Testers
    Operations
    Sys Admins
    Network
    Engineers
    DBA
    Development teams strive for change Operations teams strive for stability
    misalignment leads to
    conflict
    Measured on things like features Measured on things like uptime

    View full-size slide

  14. • Ideally no isolated silos exist in the software delivery process.
    Breaking Down the Silos

    View full-size slide

  15. IF WE COULD JUST CREATE A DEVOPS TEAM
    THAT WOULD BE GREAT

    View full-size slide

  16. • DEVOPS proposes, instead, strategies to create better
    collaboration between functional silos or doing away with
    functional silos altogether and creating cross functional teams.
    better
    • DEVOPS movement addresses the dysfunction that
    results from organisations composed of functional silos.
    Breaking Down the Silos
    • DEVOPS proposes shared responsibilities and incentives
    across teams.

    View full-size slide

  17. DEVOPS is Cultural shift
    https://www.flickr.com/photos/philliecasablanca/3344142642

    View full-size slide

  18. “Organisational culture is the behaviour of humans within an organisation
    and the meaning that people attach to those behaviours.”
    DEVOPS is Cultural shift

    View full-size slide

  19. - http://puppetlabs.com/sites/default/files/2014-state-of-devops-report.pdf
    The state of DEVOPS 2014
    Typology of Organisational Culture (Westrum, 2004)
    Pathological
    Power-oriented
    Bureaucratic
    Rule-oriented
    Generative
    Performance-oriented

    View full-size slide

  20. Pathological - Power-oriented

    View full-size slide

  21. Bureaucratic Rule-oriented
    https://www.flickr.com/photos/unsureshot/268754069

    View full-size slide

  22. Generative - Performance-oriented
    https://www.flickr.com/photos/gfreeman23/8732672635

    View full-size slide

  23. DEVOPS identifies that organisational culture is important
    and that this culture is crucial to whether or not DEVOPS will
    succeed within any given organisation.
    Takeaway

    View full-size slide

  24. Increasing collaboration between dev and ops
    “What is remarkable is that even though agile actively seeks
    collaboration from all its stakeholders, most agile projects did
    not extend themselves toward the operations people.”
    !
    !
    - Patrick Debois.

    View full-size slide

  25. Agile Development Team Waterfall Operations Team
    Increasing collaboration between dev and ops
    Scrumfall

    View full-size slide

  26. Change your definition of done
    “At the end of each sprint, we must have working and shippable code…”
    !
    “demonstrated in an environment that resembles production”

    View full-size slide

  27. Practices
    • Make environments available early in the development process.
    https://www.vagrantup.com
    Development environments made easy.
    Create and configure lightweight, reproducible,
    and portable development environments.
    Build, Ship and Run Any App, Anywhere
    !
    Docker - An open platform for distributed
    applications for developers and sysadmins.
    OR

    View full-size slide

  28. Chef
    Puppet
    Ansible
    Salt
    Configuration management tools (Infrastructure as code)
    • These tools enable more transparency at the infrastructure level.
    • Also get developers and operations people collaborating early in the software delivery process
    Amazon
    Rackspace
    Digital Ocean
    Cloud providers
    Practices
    • Make sure devs and ops build code and environments at the same time.

    View full-size slide

  29. Packer is a tool for creating identical machine images for multiple
    platforms from a single source configuration.
    Packer https://www.packer.io
    • Create a common dev,qa, production environment creation
    process.
    Practices

    View full-size slide

  30. • Collaboration between development and operations starts
    long before the deployment of software and well afterwards.
    Practices
    • Get Operations and Developers sitting together.

    View full-size slide

  31. Cycle Time
    • How long does it take you to go from code committed to
    getting that code running in production?
    • Asked in another way if you had a critical bug fix and it was
    one line of code how long does it take you to get that to
    production.

    View full-size slide

  32. “What businesses really want of us as software developers is
    that we allow them to have an idea, get the idea into the hands
    of our users, figure out if the idea works, and react to the
    understanding that we can gain from this experiment.”
    Cycle Time
    https://leanpub.com/buildqualityin

    View full-size slide

  33. “High performing organisations deploy code 30 times more
    often, and 8000 times faster than their peers, deploying
    multiple times a day, versus an average of once a month.”
    Key Finding - DEVOPS 2013 Report
    “Have 50% fewer failures
    and restore service 12 times faster than their peers.”
    https://puppetlabs.com/wp-content/uploads/2013/03/2013-state-of-devops-report.pdf

    View full-size slide

  34. Some problems dev and ops teams face
    • Cycle time is measured in weeks or months.
    release
    • Problems with deployment.
    • Various bottle necks.
    Key goals of DEVOPS is to increase flow, reduce cycle time,

    shorten the feedback loop.

    View full-size slide

  35. Continuous Delivery
    Read this Book

    View full-size slide

  36. Continuous Delivery
    Design practice used in software development to automate and improve the
    process of software delivery.
    Techniques such as automated testing, continuous integration and
    continuous deployment
    Allow software to be developed to a high standard and easily packaged
    and deployed to environments, resulting in the ability to rapidly, reliably
    and repeatedly push out enhancements and bug fixes to customers at low
    risk and with minimal manual overhead.
    http://en.wikipedia.org/wiki/Continuous_delivery

    View full-size slide

  37. Key Goals of Continuous Delivery
    • Software is always in a releasable state throughout its lifecycle.
    • The only way to categorically prove software is production ready is to
    deploy it production.

    View full-size slide

  38. Devops for developers - Michael Heuttermann
    Available functionality
    Time
    Big releases
    Small releases

    View full-size slide

  39. Benefits of deploying more frequently
    • Smaller changes make it easier to identify problems
    • Risk of deployment is reduced
    • The process of fixing problems becomes optimised
    Devops for developers - Michael Heuttermann

    View full-size slide

  40. Deployment becomes a non event

    View full-size slide

  41. Continuous Integration
    • Create quality at the source - helps build trust
    • Fix broken builds immediately - don’t block other developers
    • Keep your builds fast - get feedback sooner

    View full-size slide

  42. Automated Acceptance Testing
    https://www.flickr.com/photos/wynandvanpoortvliet/3562677155

    View full-size slide

  43. Automated acceptance testing
    “Automated testing turns fear into boredom” - Eran messeri google.
    • Automated acceptance testing of functional and non functional
    requirements.
    • RSpec tests for your servers configured by Puppet, Chef or
    anything else.
    https://github.com/serverspec/serverspec

    View full-size slide

  44. A deployment pipeline is automated implementation of your
    applications build, deploy, test and release process.
    Deployment pipeline

    View full-size slide

  45. Deployment pipeline
    Delivery Team Version Control
    Check in
    Feedback
    Build & unit tests
    Trigger
    Automated
    Acceptance Tests
    Trigger
    Feedback
    Release
    Approval

    View full-size slide

  46. • Collaboration
    • Feedback
    • Teams can deploy and release any version of their software to
    any environment at will through a fully automated process.
    Key objectives of Deployment pipeline
    - Continuous Delivery: Reliable Software Releases Through Build, Test, and Deployment Automation by Jez Humble and David Farley

    View full-size slide

  47. Tools available to build deployment pipelines
    Travis CI
    Jenkins
    Testing tools
    PHPunit
    phpspec
    Behat
    BAMBOO
    Code Standard Quality Tools
    Continous Integration Servers
    Phing
    Build Tools PHP CodeSniffer - https://github.com/squizlabs/PHP_CodeSniffer
    PHP Mess detector http://phpmd.org/
    PHPLoc - https://github.com/sebastianbergmann/phploc
    PHPCI
    Codeception
    PHP Documentor -http://www.phpdoc.org/

    View full-size slide

  48. Automated Deployments
    Think of deployment as a two step process
    • Select environment where we want our software to go.
    • Push a button to release the software to that environment.
    Tools
    Capistrano
    Rocketeer
    Deployer
    - Continuous Delivery: Reliable Software Releases Through Build, Test, and Deployment Automation by Jez Humble and David Farley

    View full-size slide

  49. Monitoring
    • If you are releasing often you want fast feedback.
    • Adding monitoring to the definition of done for new software features.

    View full-size slide

  50. Measurement
    • You can’t improve what you can’t measure.
    • Measurements are shared not only between developers and ops people 

    but with the entire organisation.

    View full-size slide

  51. Tools
    Statsd
    Logstash + ElasticSearch + Kibana
    Log files from production
    - Measurement and monitoring
    Collectd
    Graphite
    Grafana
    Cacti
    Monitoring and Altering
    Nagios Sensu
    Ganglia
    Sentry
    Graylog
    Application Metrics
    Splunk

    View full-size slide

  52. Sharing with operations
    https://www.flickr.com/photos/clappstar/2773208127
    Sharing

    View full-size slide

  53. Sharing - Pain
    • Developers take more ownership and responsibility for their code.
    • Developers on call for production issues.

    View full-size slide

  54. Blameless post mortems
    Blameless Post Mortems

    View full-size slide

  55. Everything is in source control
    https://twitter.com/jclermont/status/557202948703666177

    View full-size slide

  56. • Code and scripts for building the application.
    Things that should be in version control for your application
    • Code and scripts for testing the application.
    • Code and scripts for deploying the application.
    • Code and scripts for building environments for the application.

    View full-size slide

  57. Summary
    • Why we need DEVOPS
    • Breaking down Silos
    • Organisational culture
    • Increasing Collaboration between Developers and Operations
    • Cycle Time and Continuous Delivery
    • Measurement and monitoring
    • Sharing

    View full-size slide

  58. Patrick Debois
    https://twitter.com/patrickdebois/status/539073067738468352

    View full-size slide

  59. Feedback
    https://joind.in/talk/view/13368

    View full-size slide

  60. Good DEVOPS Resources
    https://leanpub.com/buildqualityin
    Attend a DEVOPS day conference http://www.devopsdays.org/
    http://foodfightshow.org/
    Podcasts
    http://devopscafe.org/
    http://amzn.to/1vD8gUi http://amzn.to/1zMaAc7 http://amzn.to/1AiZMpy
    http://amzn.to/1brnEZI

    View full-size slide