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

Continuously Deploying WordPress

Continuously Deploying WordPress

What are "Continuous Deploying", "Continuous Delivery", and "Continuous Integration"? Is it possibile to integrate
WordPress in a continuous development process? And how?

Giuseppe Mazzapica

April 08, 2017
Tweet

More Decks by Giuseppe Mazzapica

Other Decks in Programming

Transcript

  1. Biggest German WordPress Agency WordPress.com Featured Service Partner Gold Certified

    WooCommerce Expert @gmazzap github.com/gmazzap https://gmazzap.me PHP developer since 2005, first met WordPress in 2006. Moderator at wordpress.stackexchange.com Since 2016 WordPress Engineer at: Giuseppe Mazzapica Continuously Deploying WordPress Continuously Deploying WordPress
  2. What is ? Continuous Deployment It is a set of

    pratices to automate the process that goes from the writing of source code to its release in production. Premise of continuous deployment is continuous integration. Continuously Deploying WordPress
  3. Continuous deployment and continuous delivery share the set of practices

    and tools, but continuous deployment implies the automation of the transition from development cycle to release cycle, whereas that transition is not automated for continuous delivery. Continuously Deploying WordPress
  4. Key Concepts Continuous Integration Continuous Delivery Continuous Deployment Development Cycle

    Release Cycle “You’re doing continuous delivery when: Your software is deployable throughout its lifecycle Your team prioritizes keeping the software deployable over working on new features Anybody can get fast, automated feedback on the production readiness of their systems any time somebody makes a change to them You can perform push-button deployments of any version of the software to any environment on demand Martin Fowler Continuously Deploying WordPress
  5. Continuous Development Source Code Code Review Tests Unit, Integration Version

    Control Build Continuous Integration Continuous Delivery Continuous Deployment Code Deployment Tests Platform Tests Acceptance Maintenance Monitoring to Stage Environment to Production Environment Environment Configuration Stage, Production Release Cycle Development Cycle Continuously Deploying WordPress
  6. Continuous Integration All custom code lives under version control. Development

    team clones, edits and updates code repository frequently. At every update, unit tests are started automatically and the QA team is notificated so they can start code review. Continuously Deploying WordPress
  7. Continuously Deploying WordPress Version Control: Tools Mercurial Perforce Git Subversion

    git-scm.com subversion.apache.org mercurial-scm.org perforce.com
  8. Continuously Deploying WordPress Continuous Integration: Tools Hudson Circle CI Bitbucket

    Pipelines Jenkins Travis CI jenkins.io travis-ci.org hudson-ci.org circleci.com bitbucket.org Gitlab CI about.gitlab.com/gitlab-ci
  9. Continuously Deploying WordPress Code Review: Tools Gerrit GitHub Gitlab Phabricator

    Codacy Crucible codacy.com atlassian.com/software/crucible gerritcodereview.com github.com gitlab.com phacility.com/phabricator
  10. Continuously Deploying WordPress Testing: Tools JavaScript Jest Codeception Behat Atoum

    PHPUnit phpspec PHP phpunit.de phpspec.net codeception.com behat.org Mocha mochajs.org Jasmine jasmine.github.io Cucumber.js cucumber.io atoum.org facebook.github.io/jest Tape github.com/substack/tape
  11. Continuously Deploying WordPress Continuous Delivery & Deployment Development happens in

    continuous integration At the end of development cycle code is automatically released in a production-like environment (stage), and other tests are automatically started Configuration of the servers is automated, reproducible, scalable, and under version control. It is also manages different environments.
  12. Continuously Deploying WordPress Continuous Delivery & Deployment When release cycle

    ends successfully on stage (acceptance and user acceptance test pass) the code is released in production with the same routine that occurred for the stage environement. Release in production may happen: automatically, that’s continuous deployment manually (push-the-button), that’s continuous delivery
  13. Continuously Deploying WordPress Key Concepts Automation Scalability, Reproducibility, Maintainability Quality

    Control Automated tests at every step If any test fails, the cycle stops and starts over The closer the production environement, the more tests are “black box” Dev/Prod Parity All environments share same setup and technologies Code is environment agnostic Continuous Monitoring
  14. Continuously Deploying WordPress new features bugfixes improvements quality controls convenience

    estimations usability tests performance monitoring errors monitoring feedback analysis e g a t S / t s e T quality assurance feature management feature planning Continuous development, ensuring the code is environment agnostic, allows for different focuses for different environments being carefree about the existence of problems related to each specific environment g n i r o t i n o m Development Production
  15. Continuously Deploying WordPress Configuration Management: Tools Puppet Chef SaltStack Ansible

    Dockerdocker.com ansible.com puppet.com chef.io saltstack.com CFEnginecfengine.com Forge forge.laravel.com Services Vagrant vagrantup.com Other Digital Oceandigitalocean.com VPS Hosting + API Linode linode.com AWS aws.amazon.com
  16. Continuously Deploying WordPress Code Deployment: Tools Envoy BLDR Robo Fabric

    Deployer Capistranocapistranorb.com deployer.org laravel.com/docs/envoy robo.li fabfile.org bldr.io
  17. Continuously Deploying WordPress Code Deployment: Services Envoyer envoyer.io AWS CodeDeploy

    aws.amazon.com/codedeploy DeployHQ Deploybot Codeship deployhq.com deploybot.com codeship.com
  18. Continuously Deploying WordPress Debugging, Profiling: Tools Blackfire Z-Ray Tideways Valgrind

    XDebug xdebug.org valgrind.org blackfire.io zend.com/en/products/server/z-ray tideways.io
  19. Continuously Deploying WordPress Greylog Cube NewRelic Rollbar Monolog Loggly Logging,

    Monitoring Tools Logstash Dynatrace DataDog Logmatic Sentry Grafana elastic.co graylog.org square.github.io/cube loggly.com rollbar.com bit.ly/mono-log newrelic.com dynatrace.com datadoghq.com logmatic.io grafana.com sentry.io
  20. Continuously Deploying WordPress Continuous development is not a toolset, but

    more a mindset that aims at integrating different skills available across company teams, sharing decisions and responsibilities. Application code is not a separate element, but it is part of an integrated process, which always evolves, and whose reason to be is the research of business value maximization.
  21. Continuously Deploying WordPress Continuous development is both a set of

    practices and a company attitude. It is a modular process that can be integrated step by step in existent company processes.
  22. Continuously Deploying WordPress Within continuous development, WordPress is just another

    tool. Specifically, it is a tool for writing website or web application code. So the question is: is it possible to integrate WordPress in a continuous development process? If so, how?
  23. Continuously Deploying WordPress Continuous Development Source Code Code Review Tests

    Unit, Integration Version Control Build Continuous Integration Continuous Delivery Continuous Deployment Code Deployment Tests Platform Tests Acceptance Maintenance Monitoring to Stage Environment to Production Environment Environment Configuration Stage, Production Release Cycle Development Cycle
  24. Continuously Deploying WordPress Code Review Tests Unit, Integration Version Control

    Build Code Deployment Tests Platform Tests Acceptance Maintenance Monitoring to Stage Environment Environment Configuration Stage, Production Source Code Continuous Development WordPress Core Custom Themes Custom Plugins 3rd Party Plugins Continuous Integration Continuous Delivery Continuous Deployment Release Cycle Development Cycle
  25. Continuously Deploying WordPress Integrating WordPress into a continuous development context

    does not affect the rest of the process, it is only needed to take into account that the codebase will be made by different elements: WordPress core 3rd-party code (themes, plugins) Custom code (themes, plugins)
  26. Continuously Deploying WordPress Continuous development dictates to keep code under

    version control, but also to automate each step of the development cycle. The most effective solution to obtain both things is to keep custom code under version control and to treat 3rd-party code (including WordPress) as an external dependency.
  27. Continuously Deploying WordPress Real world projects, more often than not,

    have a complex “dependency tree”, which is impossible to maintain without a dependency management tool In the PHP world, where also WordPress lives in, the only (as of today) possible solution is Composer getcomposer.org
  28. Continuously Deploying WordPress WordPress requires configuration based on PHP files,

    which is an obstacle to environment agnostic code. Different projects which integrate WordPress and Composer also allow to manage different environments, but aiming for cross-environment parity, different environments should be configured via environment variables.
  29. Continuously Deploying WordPress WP Starter wecodemore.github.io/wpstarter and roots.io/bedrock Bedrock are

    two libraries which ease the integration of Composer and WordPress, allowing WordPress configuration via environment variables.
  30. Continuously Deploying WordPress Using Composer and environment variables means to

    put in practice the current best practices about deployment of PHP code, paving the way for the usage in WordPress context of tools designed for "generic" PHP applications.
  31. Continuously Deploying WordPress The last important missing "piece" is WP

    CLI Allowing the execution of WordPress-specific tasks (i.e., creating a user, or activating a plugin) from the command line is a key component towards complete WordPress deployment automation. wp-cli.org
  32. Continuously Deploying WordPress When integrated with Composer, environemt variables, and

    WP CLI (maybe with the help of libraries like Bedrock or WP Starter), WordPress stands like any other application, PHP or otherwise, perfectly integrable in a process of continuous development.