Using Vagrant for WordPress Development

Vagrant and WordPress Icons.

Creating WordPress Plugins and Themes is a fairly easy process. However, creating a new WP site on a local machine can be fairly tedious. Add to this the individual quirks of servers, and the setup differences between local and production environments and and you start to appreciate the benefits of a real sand-boxed solution.

The general idea of using Vagrant is the same as the idea and justification for using Virtualbox, or VMWare to run a development server on your local machine.

What is Vagrant?

Vagrant helps to build and automate virtual machines. Where it really shines is through its ability to provision, or configure the software that the server uses through simple configuration files.

Vagrant uses base boxes, common virtual servers as its building blocks for more specific virtual machines. If you are curious about all the different ways that people are using Vagrant, checkout a couple of good introductory articles:

Vagrant and WordPress

Because Vagrant can be used to quickly turn a basic virtual server into a specialized WordPress installation, we can use it to easily share the specific settings for our development machine with other developers, as well as mimic the properties of the production server.

Luckily, there are a couple of very good Vagrant projects that have already been setup with WordPress.

Varying Vagrant Vagrants

Jeremy Felt has a good article outlining why he has started to use Vagrant for WordPress Development. Development is still progressing quickly, so to see the work that is currently being applied to the Vagrant Boxes running WordPress, checkout 10up’s Varying Vagrant Vagrants (VVV) repo on Github. The code from these guys is really well documented, and the README.md file has a number of good jumping off points for more learning.

In my mind, there is only one real drawback with VVV — its complexity. Even though the code is well documented, there still is a lot going on. There certainly is a lot of power under the hood, but for smaller, simpler tasks, like a quick test of a new plugin or theme, I found myself wanting a simple, LAMP stack with only one site to choose from.

Vagrantpress

And then I found Vagrantpress. This is a much simpler setup – just a LAMP stack with GIT and WordPress.

Both of these projects are good for different reasons. In general, VVV is large and powerful — almost too much — but really the right tool for most jobs. But there is something powerful in Vagrantpress’ simplicity.

At the end of the day, both projects should be watched. Active development means that both will change and improve, making collabrative development much faster and much easier.