Tooling: Vagrant powered Drupal dev VM

A couple years ago I was gladly surprised by the Quickstart project, a prebuilt development environment for Drupal; after finding it extremely useful for speeding up my workflow I was sold on the idea of doing my dev work on a dedicated VM. Fast forward to now and I've been using Vagrant + Puppet for almost a year; after lots of iteration and little adjustments here and there I found myself having a very reliable env for my daily needs; also, I switched to a fully CLI-based workflow, which I've enjoyed so much. I think it's good enough to share with the community, so let's do just that.

A basic LAMP environment isn't too hard to set up, especially on popular Linux distributions; what's more, there are various options to choose from if all you want is just a pre-packaged LAMP webserver. For basic site building tasks any of the discussed options should do quite well, but when you start diving deeper in Drupal development, you'll find needing lots of extra bells and whistles (APC, XDebug, XHProf, etc).

It is at this very moment that you realize your best path to high productivity is setting up an environment that provides you with all those tools in a way that doesn't get you troubleshooting issues often. Add to that the fact that you may end up needing to work on separate projects, that differ in some environment tweaks or package versions; you'll easily conclude setting such env directly on top of the OS you run natively is not a good idea.

To answer needs like that one we can use Vagrant, which coupled with a good provisioning system (currently I use puppet) will let us see our dev envs not as difficult-to-tame beasts, but as stable and free-to-play with tools. This is why this workflow has become so prevalent for doing web development.

Once I got my first attempt at a Vagrant based development environment rewarded with a working VM (leveraging fm-vagrant + doing some tweaks), I didn't look back. I haven't stopped since then in my quest to get a VM that I feel comfortable with, while also letting me re-create my dev sites with a single run of the provisioner (yeah, I got auto-import functionality baked into it). After some clean up to make it generic for usage by others, I am publishing it in a github repository.

Let's just enumerate the most important tools and functionality that I've implemented so far:

  • OS: Ubuntu 12.04
  • Apache 2, Mysql 5, PHP 5
  • XDebug, XHProf, APC, Memcache
  • PHPMyAdmin with auto-login
  • Zsh, git and vim (with Vdebug, among other useful plugins); including some dot files for further customization (see hidden files on import-sites directory).
  • Import functionality for existing sites (check import-sites/README).
  • Drush 5.9.0
  • Auto-detection and usage of proxy (if properly set in your CLI env vars).

I plan on adding some other packages (most notably, Varnish) and, if possible, include the very useful quickstart-create/quickstart-destroy set of custom drush commands (found on Quickstart). Also, I'm considering to add an optional module to provision a desktop environment along with some useful GUI tools.

Hope you enjoy it!