Local Drupal development with Varying Vagrant Vagrants (VVV)

What is VVV?

I have been using Varying Vagrant Vagrants (VVV) for some time now as my development environment for WordPress projects. If you haven’t used VVV, I encourage you to try it out, it makes a lot of things easier in terms of setting up your local server. VVV’s primary use is for the development of WordPress itself but the Auto Site Setup feature allows you to use VVV for developing your own WordPress projects.

This guide assumes familiarity with VVV and the Auto Site Setup feature, so please check out the VVV documentation before proceeding.

Can I use VVV for Drupal development?

This past month, I’ve had to work on a couple of Drupal projects and I ended up using the WordPress VVV environment for them. The auto site setup is very similar to what you would normally do with WordPress projects with a couple of tweaks which I’ll go through below.

Different vvv-nginx.conf file

In your vvv-nginx.conf, instead of including /etc/nginx/nginx-wp-common.conf; which has WordPress centric configurations, use the above which is a stripped down version of /etc/nginx/nginx-wp-common.conf;.

Install Drush

VVV comes pre-configured with WP-CLI. If you’re developing with Drupal, you are probably going to want to use Drush. Instead of messing with the VVV box, you can install Drush just for your Drupal project. Create a composer.json* file for your project with the  following lines:

And so that you can easily set up Drush again for your next Drupal project, we’re going to use a Makefile to handle the installation:

With the Makefile in place, cd into your project folder and run make install-drush. This will install drush within your project.

Using drush

Now that you’ve got Drush installed, let’s add another Makefile target that will make it easy to use.

We’re now ready to use Drush. From your local machine, try make vvv-drush args='cc all' (replace cc all with the Drush command you’d like to run.

With these two tweaks in place, you’re good to go for using VVV for developing your Drupal project.

* Composer is a dependency manager for PHP.