Most people in the WordPress world probably get started off with MAMP or WAMP. The issue with that is that they can be extremely brittle, for one thing. You’re also tied to the versions of the software that MAMP pre-includes. They might upgrade to newer versions, such as PHP 5.6, but the problem is that your local MAMP install is vastly different from your shared host, or your VPS, or your dedicated server. You can’t really get any more different than those two environments — your host machine with MAMP, and a remote server with whatever else is on there. That big gap is what can cause problems when you actually deploy. Or something goes wrong on your production server and you can’t replicate it on your local machine, or vice versa. Scott Walkinshaw on Ep0 of Roots Radio

We have a project called Trellis that sets up a WordPress LEMP stack. Trellis uses Vagrant to create a local development virtual environment.

To get started, all you need to do is make some quick edits to the local development configuration file and then run vagrant up .

Using Trellis can be as simple as:

Clone git repository vagrant up Good to go

It’s really that easy. Clone a project, type one command, and be up and running with an environment that matches exactly what other developers on your team have.

Where Trellis differs from, and improves upon, other development setups is that it’s also designed to create your staging and production environments too (which is optional). This means it will match your staging/production servers to your development VM.

If you have to pass off a project to someone else, it’s way easier just to say “here is a repository, it contains all of the configuration necessary to get a vagrant virtual machine up and running with one command” Austin Pray on Ep0 of Roots Radio

What about VVV?

VVV could possibly be a good solution for you if you’re doing work on WordPress core. If you’re thinking about using VVV as your development environment for any other situation — don’t!

The primary goal of Varying Vagrant Vagrants (VVV) is to provide an approachable development environment that matches a typical production environment.

Sounds good, right? It’s not. The problem is there’s no "typical" production environment. Just using Apache, PHP, and MySQL does not mean you’ve matched a production environment. Every production environment is different down to the minor version numbers of software packages.

Instead of using a server configuration system such as Ansible, Puppet, or Chef, VVV uses a Bash script that’s almost 1,000 lines to provision a server. This script has been made for development purposes so there’s no way it can match up with your production server. Unless, of course, you use VVV to provision it but they discourage such usage.

There was even pull request to VVV years ago by Mark Jaquith to "use a proper provisioner" that got rejected.

Trellis uses Ansible, and we’re serious about development and production parity.

How do I get started?

Our Modern WordPress Example project is a great way to see everything working.

You might be thinking, "this is too complicated", or "this is overkill for what I need". This is usually what a lot of reactions to Trellis sound like at first. Don’t forget that we use these tools for a reason — to make your job as a web developer easier!

Resources