What are "Continuous Deploying", "Continuous Delivery", and "Continuous Integration"? Is it possibile to integrate
WordPress in a continuous development process? And how?
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
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
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
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
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
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
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.
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
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
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
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.
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.
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?
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
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)
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.
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
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.
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.
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.
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
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.