Boosting teamwork with Vagrant

Boosting teamwork with Vagrant

In September I was fortunate to be able to give a talk at DjangoCon US, the largest annual conference about the Django web framework. The topic of the talk was on Vagrant, a free open-source tool facilitating the manipulation of virtualized environments, and how it may benefit the development of Django applications. This talk was aimed at Django developers of all levels who were interested in getting an overview of the great possibilities Vagrant offers to support teamwork and quality assurance. In this article, I provide the same overview of the issues and solutions as addressed in the talk, albeit in broader terms that should be compelling to all kinds of web development teams, regardless of their framework or programming language of choice.


Common issues for web development teams

Over the last couple of years, a number of things have contributed to making the lives of developers easier, in particular the emergence of cloud computing, of both backend and frontend testing frameworks, and of distributed version control systems such as Git. However, the web stack specifications have also become more complex in order to provide the features that are now commonly expected by web users and to respond to ever increasing levels of traffic on modern web sites and applications. Indeed, it is now often necessary to use components such as RabbitMQ, Hadoop, Solr or Redis, just to name a few. As a result, web teams nowadays tend to be recurrently confronted with two types of issues:

  • Code sometimes unexpectedly breaks in production whereas it worked on development machines prior to being deployed. This type of unanticipated problems is often due to the inconsistencies that exist between the team members’ platforms, and to the inconsistencies between the development and production environments. Indeed, many web developers nowadays use Mac and Windows computers as their primary development platform, whereas the vast majority of websites eventually get deployed to Linux machines.
  • On-boarding new developers tends to be difficult and time-consuming. This is true especially if the person that you are on-boarding does not have much experience with systems administration, for example a frontend developer or a designer. If you are well organized, you might have long wiki pages describing every step required to manually install all of the technical requirements for your project. However, keeping those wiki pages up to date is hard, tedious and uninteresting, and so is having to manually execute all the required steps every single time a new person joins your team. What’s more, the web developers who work on Mac or Windows platforms often have to go through extra pain as the installation of certain software, such as MySQL or PostgreSQL for example, are generally much more difficult on their platforms than it is on Linux platforms. The net result is that developers end up having to spend a lot of time administering their systems, whereas they would rather spend this time writing code and building features.

Vagrant to the rescue

The issues described above would not occur in an ideal world where all developers of a same team worked on the same, pre-built platform: there would be no need to manually install anything and the working environment would automatically be assembled so that developers may solely focus on their development tasks. In that ideal world, the development and production platforms would also closely match so that no more bad surprise would occur when new code got pushed live. The good news is that this world already exists — and it’s called virtualization.

Virtualization is nothing new, really. It has been around for a long time. However, in the last couple of years it has become much more approachable and useful to developers, especially thanks to a project called Vagrant. Essentially, Vagrant is a developer-friendly interface for managing virtual machines (VM). Currently the only VM manager supported by Vagrant is VirtualBox, but there are plans for it to support VMWare in the future as well. In a nutshell, with Vagrant the workflow for a given developer is as follows:

Boosting teamwork with Vagrant

The developer interacts with Vagrant by running a few simple commands. The main command is ‘vagrant up’ (1) for booting the VM up, that is the equivalent of pressing the ‘on’ button of a physical computer. The developer also has to provide a configuration file named ‘Vagrantfile’ (1), which contains some basic directives to specify the characteristics of the VM that needs to be built. Then Vagrant will talk to VirtualBox (2) and instruct it to actually create the VM (3). Vagrant will also talk to some provisioners (4), which are responsible for provisioning the VM, that is, installing and configuring all the software required for running the project’s application (5). Once the VM has been created, booted and provisioned, the developer may directly access the VM (6), …