Upload
josh-cummings
View
289
Download
0
Embed Size (px)
Citation preview
WordPress Development
Environments
Josh Cummingsjoshcummingsdesign.com
@jcummingsdesign
Objectives
• What is a development environment?
• What tools exist for creating and configuring a
WordPress development environment?
• What tools exist to help us deploy our code?
Humble Beginnings
Workflow
What is a development
environment?
A collection of procedures and tools
for writing, testing, debugging, and
deploying your code.
What tools do we need
to run WordPress?
LAMP Stack
• Linux
• Apache
• MySQL
• PHP
LEMP Stack
• Linux
• Nginx
• MariaDB
• PHP
The WordPress Stack
Local
Development
Staging
Production
Command Line Tools
• Versioning (Git / SVN)
• WP-CLI
• Task Runners (Gulp / Grunt)
• Dependency Managers (Composer / npm / Bower)
Text Editors / IDEs
• PhpStorm
• Sublime Text
• Atom
Database Clients
• Sequel Pro
• Navicat
What tools exist to help us set
up our local development
environment?
–Terry Pratchett
“If you don't know where you are, then you don't
know where you're going, and if you don't know
where you're going, you're probably going wrong.”
Things to Consider
• Will I be working on a team?
• Will I be developing a theme or plugin, or working on
WordPress core?
• How do I plan on deploying my code?
The “works on mine” issue.
The 3 Month Test
Find the right
tools for the job.
AMP
• XAMPP
• MAMP
• WAMP
MAMP
• Simple to setup
• Little to no configuration needed
MAMP - Pros
• Brittle, tied to specific versions
• Less parity, more coupled
MAMP - Cons
DesktopServer
DesktopServer
• Cross-platform
• Easy to setup
• Blueprints will save you time
• Direct Deploy makes deploying easy
Native Stack
Linux / Mac
• Create an image for your team that has all of the
necessary configuration for your stack
• Leverage scripting for creating new projects and
deploying your code
• Create a custom build of WordPress that you keep in
a git repository which uses composer to track your
plugin dependencies
Linux / Mac
• https://github.com/kiriaze/mac-dev-env
• https://gist.github.com/joshcummingsdesign/0f291b3
f73f1e3113227
• https://wpackagist.org/
Native Stack - Pros
• Lightweight
• Quickly create new projects
• Works really well when your remote servers always
run a similar configuration
• Fast deploys that you can automate
Native Stack - Cons
• More dependencies to manage
• Harder to hand your code over to another developer
unless they have the same build
Virtual Machine
(VM)
Virtual Box
VM - Pros
• Easily create a configure a new server
• Reproduce any environment
• Completely destructible
• Completely decoupled
• Passes the 6 month & “works on mine” tests
VM - Cons
• More overhead
Vagrant
• Cross-platform
• Create a single file for your project to describe the
type of machine you want (provisioning file)
• One command to spin up an environment
• One command to deploy an environment
VVV
• Varying Vagrant Vagrants
• Focused on WordPress development.
• Ideal for developing themes and plugins as well as
for contributing to WordPress core.
VVV
• https://github.com/Varying-Vagrant-Vagrants/VVV
• https://make.wordpress.org/core/handbook/
Trellis
• Developed by the Roots team
• Vagrant LEMP stack for WordPress with modern
development in mind
• Uses the power of Ansible to provision servers and
deploy with a single command
Containers
Docker
Docker containers wrap up a piece of software in a complete
filesystem that contains everything it needs to run: code,
runtime, system tools, system libraries – anything you can
install on a server. This guarantees that it will always run the
same, regardless of the environment it is running in.
Docker
• Docker file
• Builds docker image
• Image sits on top of your machine
• Self-contained processes (microservices)
• Docker Hub
Docker
ContainersVM
Docker
• Modular
• VM-like features with less overhead
• Deploy very quickly because it only updates the new
information (like Git)
Docker for WordPress
• Define the project (YAML)
• Curl WordPress tarball
• Create a wp-config.php
• Run docker-compose up
• Codeship for deployment
Continuous Delivery
• Codeship
• Wercker
• Jenkins
The Future