26th February 2015

View from the dev team - February 2015

John Ennew
Technical Director

The fourth Wednesday of the month is Coder Lounge for the Deeson development team. Here we work on our own community projects or delve deep into a technology or problems which interest us.

Local development with Vagrant

We decided to update our development environments at coder lounge this week by investigating some vagrant based solutions. Vagrant allows the creation of lightweight, reproducible, and portable development environments. These are virtual machines which run on our laptops and contain all the tools that a developer needs to do their job.

Our previous local development setup included Acquia's Dev Desktop 2 tool. This bundle provides a developer with the apache webserver and MySQL which are the basics needed to run a website locally. However, there are many other tools and technoogies needed to run a modern website and the developers had to install their own versions of these tools as and when they needed them. This has lead to an eccelctic mix of differing development environments and standards.

The benefits of a vagrant system is that if we agree on a standard recipe it can be checked into version control and we would all have exactly the same setup. This would make diagnosing issues easier, especially across platforms. Also with new developers, installing the vargrant image would give them everything they needed to get started out of the box without needing to learn how to install each and every tool.

VDD

Not wanting to reinvent the wheel we had a look at some recipes which exist on the internet already. A popular choice is VDD which stands for Vagrant Drupal Development.  We forked the github repository so we could make our own customisations but still be down stream of the main version for updates. Out of the box, VDD contans:

  • An Ubuntu operating system
  • Apache 2
  • PHP 5.4 and APC
  • Drush with aliases
  • MySQL with a DB automatically created and configured per development site
  • MailCatcher (for catching any emails sent from the development system so they can be inspected)
  • XDebug with remote inline debugging already enabled

We decided to extend this to add the following additional utilties in our own version of VDD using check cookbooks.

  • Use NFS for share folder mounting because we are all Apple Mac based and it is much faster than network mounts
  • nginx for SSL termination. A self signed SSL certificate is created per development site automatically and sites are available via HTTPS
  • Varnish caching layer with the best practice FourKitchens VCL file for Drupal already applied with modifications to allow XDebug to still remotely connect to our PHPStorm instances
  • memcached
  • Apache solr with a core per site
  • A default settings.inc file created per site with basic best practice configuration included
  • PimpMyLogs tool for inspecting log files from the web browser
  • Grunt, SASS and compass installed and configured as per our best practice workflow
  • MongoDB preinstalled with the PHP extension
  • XHProf for performance checking
  • dnsmasq so that all local sites are immediatley accessible in the web browser without needing to edit the /etc/hosts file

We then noticed that VDD is using a 32 bit version of the Ubuntu 12.04 Precise operating system. Since most server systems we use are now using version 14.04 trusty we decided that we'd make a new branch to get this working. We also thought it best to use a 64 bit version as well.

Our partical version of VDD is available for download here: https://github.com/teamdeeson/vdd.  The 8.x-1.x branch is the 32 bit version of Ubuntu 12.04, same as VDD proper. The trust64 branch uses the newer 14.04 trusty version of Ubuntu.