Using DrupalVM for Drupal Development

DrupalVM featured image

Using DrupalVM for Drupal Development

Over the past couple years, there has been a lot of improvements in developer tools and workflows for building new Drupal projects. As Drupal has grown over the past few years, we have seen added frameworks such as Twig and Symfony, workflow related tools like Composer and Drupal Console, and even new virtual environments. With added tools came increased complexity in development environments, and sometimes, even more issues if you’re building on more than on type of framework for client projects.

In the past, we as developers were usually stuck in-between a rock and a hard place when it came to development environments. Either you had the pre-built software that might not have everything you need depending on your clients and hosting options, like Acquia Dev Desktop, MAMP, XAMPP, etc. Or you would have to build your own local server using script management like Homebrew or Macports, and then search the internet to cobble together the right Nginx configuration for Drupal, asking yourself “where are my MariaDB databases?", and dealing with mismatched versions of PHP running at the same time.
What. a. nightmare.

New development

Luckily, there’s been a lot of work put into new development environments for Drupal (that we can also use with other PHP-based content management systems). Most of these development environments have been split into two types - Docker and Vagrant. These tools are simply just different approaches to virtual server management. While the details aren’t really important right now, the main difference is that Docker takes the container approach while Vagrant takes the virtual machine approach (you can read more about container vs. virtual machines).
Some of the more recent development environment solutions have been Docker-based (such as Docksal and Kalabox / Lando), we have chosen to work with DrupalVM, built on Vagrant and Ansible (which now includes support for Docker!).
Fun fact! Two of the main Drupal hosting companies LevelTen works with use these two different technologies: Acquia is a VM based server solution while Pantheon is built on containers.
Config Management
DrupalVM has some of the easiest configuration and plugin options at your development disposal per environment. Not only does DrupalVM come preinstalled with the basic Drupal tools like Drush, Memcache, and Xdebug, but we can also enable modern development tools such as Node.js, Selenium (Behat), and advanced profiling tools like Blackfire and Tideways. All of these can be included simply by uncommenting them in your config and re-provisioning your server.
Aside from plugins, there’s virtually no reasonable limits to what we can configure in our environment per the configuration YAML file. You can switch between versions of PHP, serve from Apache or Nginx, store in Postgres or MySQL, build our projects using Composer, and update php.ini settings in a breeze.
Bonus: If you use PHPStorm as your main development IDE, it already supports Vagrant and getting Xdebug running is as simple as hitting a button.


For me, one of the greatest benefits of DrupalVM is the documentation behind the project. Maintained by Jeff Geerling (geerlingguy), the project documentations answers almost all of your basic needs for getting up and running with DrupalVM, from enabling Solr to switching out MySQL with MariaDB, the documentation is verbose and well-written.
For those times when the docs just aren’t enough, this is when we’re thankful for open source and GitHub. Since the whole project is hosted on GitHub, there are many open and closed issues we can search through to find the answer to a problem that might have been fixed. In addition, if we do have a problem, GitHub makes submitting new issues easy to submit and collaborate on solutions.

Getting Started

Of course, what kind of blog post would this be if we didn’t tell you how to install DrupalVM? Luckily for us, there’s a Quickstart Guide and we don’t have to write this all out. But for the sake of brief knowledge, it’s really three basic steps:
1. Install Vagrant and VirtualBox.
2. Download or clone the DrupalVM project to your computer.
3. In your terminal, cd into the project directory and run vagrant up.
That’s it! After using MAMP for years as an easy-to-manage development environment, it left a lot to desire for added functionality and mucking up my dotFiles switching between PHP CLI versions. DrupalVM can technically support any PHP based CMS site, so if you’re coming from Drupal 7 or WordPress and have never seen YAML before, now’s a great time to learn it and apply those skills in managing your configuration files.
In a future blog post, we will talk about some improvements and automation you can use to streamline your DrupalVM installation.
(If you’re a WordPress developer and have used Local Flywheel or Trellis, let us know your thoughts as well!)

Related Posts

Managing your DrupalVM Environment: Vagrant Plugins and SED Scripts

Kyle Taylor
Read more

Drupal Development Using Features

Michael Kasberg
Read more

Drupal 8 Module Development, Part 2: Forms

Ian Whitcomb
Read more

My Top 5 Favorite Drupal Development Workflow Tricks

Kyle Taylor
Read more

Drupal 8 Module Development, Part 3: Plugins

Ian Whitcomb
Read more

Drupal 8 Module Development, Part 1: Getting Started

Ian Whitcomb
Read more