Varying Vagrant Vagrants, a tool for creating WordPress development environments, hit the big 2.0 recently, with the addition of a feature that many WordPress developers have been asking for: a YAML-based configuration system that makes it easier to tweak your development environment.
VVV solves a common problem in WordPress development and web development more generally: the creation of isolated and configurable development environments specific to individual projects. In the past, it was time consuming and complex to create a new WordPress installation, alongside all WordPress’ dependencies, for every new project. VVV makes creating custom WordPress development environments for plugin, theme, and WordPress Core development a matter of typing a couple of commands.
VVV is based on Vagrant, an open source tool developed at HashiCorp. Vagrant is a wrapper around virtualization tools. It streamlines the process of setting up and managing virtual machines, allowing developers to spend more time coding and less time fiddling with their tools and environment.
Vagrant also makes it easier to develop collaboratively: if everyone on a development team is using a standard environment, there’s less scope for the “but it worked on my laptop” problem to hinder development.
With the addition of YAML-based configuration, it’s straightforward to create custom development environments that suit the requirements of each project. YAML is a human-readable data format that no developer will have any trouble modifying. The YAML config is introduced alongside a more modular repository system, so developers can use the configuration file to choose exactly the utilities they need for their projects.
An obvious benefit here is that developers can indicate which version of WordPress they want to develop for. It’s always best to use the most recent, but if you need to develop against an earlier version, VVV makes building a development environment based on that version a snap.
The new custom site repository covers the basic types of development environment, including a single site, a subdomain multisite, and a subdirectory multisite, all of which can be controlled by options in the new configuration file.
Vagrant or Docker?
In some ways, Vagrant and Docker solve similar problems, but the scope of each tool and the underlying technology are different. Vagrant uses virtual machines which run on any operating system and is intended to be used to create development environments. Docker uses containers, which require a Linux virtual machine to be running on non-Linux operating systems, are much lighter than virtual machines, and are intended to be used in production as well as development.
Which should you choose? For a deeper consideration of the differences, take a look at this StackOverflow post, which includes comments from the creators of both Docker and Vagrant, but my take on it is this: Vagrant is best if you want to quickly create virtual machine development environments and you aren’t using Docker in production. If you’re using Docker in production, or have some other reason to prefer containers to virtual machines, then Docker’s a good choice.