This last year has seen a lot of improvements to the toolsets that local developers have access to when developing Drupal projects. As Drupal as a framework has grown and new technologies like Twig and Symfony2 added to the CMS a new workflow has emerged as the preferred method. Today we will be going over using DrupalVM as your local development environment and the benefits it has. With the new tools Composer and Drupal console the complexity of developing locally has increased a bit, and sometimes even more issues if you are building on multiple types of frameworks for client projects.
In the past developers were limited by the local environments they could get working. XAMPP was simple to setup, but also behaved differently sometimes from a production server, VirtualBox/Vagrant/Docker work but they all used excessive resources and in the case for Macs, Docker had a critical issue with its caching file never shrinking and eventually swallowing up your hard drive space. Even Acquia Dev Desktop comes with its own challenges. All of it was a bit of a nightmare to deal with.
A New day in Local Development
There has been a huge amount of work done to create new development environments for Drupal (That is also functional for other platforms). Most of these environments have been broken into two main types - Docker and Vagrant. These tools are simply just different approaches to virtual server management. While the details of what they do are not important for this article, the big difference is that Docker uses containers while Vagrant uses the Virtual machine method.
The more recent environment solutions have been Docker-based, some of these include Docksal, Kalabox, and Lando. We chose to work with DrupalVM, which is built on Vagrant and Ansible and notably recently added support for Docker also. An interesting fun fact, Pantheon is built on containers while Aquia is a VM based server solution.
Configuration Management
Some of the biggest pain points in dealing with Drupal can be its configuration management. DrupalVM comes with some of the easiest configuration and plugin options available to get your environment just right. DrupalVM comes preinstalled with the basic Drupal toolset, Drush, Memcache, and xDebug. It also enables you to do modern development with Node.js, Selenium and also has profiling tools Blackfire and Tideways. All of these great tools can be added simply by uncommenting them in your config file and re-provisioning your server.
Aside from these plugins, there is virtually no limit to what can be configured in the environment via the YAML files. You can change versions of PHP, web servers (Apache or Nginx), store in Mysql or Postgres, and build your projects using composer. Additionally, if your a PHPStorm dev, it already has vagrant built in and turning on xDebug is just one button click.
Read The Manual
Documentation can be the biggest pain point when starting to use a new project. The documentation for DrupalVM answers all of the basic needs for getting things up and running with DrupalVM. From turning on SOLR and switching from MySQL to MariaDB the documentation has been crafted and is well written and easy to follow.
When you find yourself at a loss in the documents this is when we are lucky that DrupalVM is a Github based OpenSource project. Since the whole project lives on Github there are many issues in the queue we can search and find answers to our questions with. The response time from the community in the issue queue is quite fast currently so collaborating and working through challenges is faster than some of the other solutions available.
How to start
If all of this sounds good so far, then you are probably wondering how to install DrupalVM? Luckily you can use the Quickstart guide and can get things up within 15 to 30 minutes depending on your internet connection. The process boils down to three simple steps:
- Install Virtualbox and Vagrant
- Clone the DrupalVM project to your computer
- Open terminal and from the project directory just run vagrant up
That is all it takes, and now your up and running. In a future blog post, I will be going over some improvements and how you can use automation to streamline your DrupalVM installation for projects.