Cross Team Development with Vagrant

Blog / Business Thoughts and Ideas / Cross Team Development with Vagrant
12/11/2015 | switchbox

Here at Switchbox, we have two development teams, focusing on different languages and technologies. On one side, we have a .NET team focusing on Microsoft technologies – Windows, SQL Server, and C#/ASP.NET. On the other, we have an open-source team primarily working with Linux, MySql, and Ruby on Rails. All of our developers are great at what they do – but not all .NET developers understand the inner workings of Nginx, Apache, or Linux system administration nor do our open source folks know the Windows Server and IIS landscape.

The good thing about web development is, in the end, we speak the same language on the browser. HTML, CSS, JavaScript. No matter if the project is written in ASP.NET, Ruby on Rails or PHP it all boils down to the same core technologies. The problem is, if a .NET developer, wanted to help on a Ruby on Rails project, there are quite a few fundamental concepts that he/she would need to understand before they could be productive. In addition, many of the open source technologies rely heavily on Linux libraries, and have poor compatibility with Windows.

We wanted to address this problem so we can foster better collaboration between our teams at Switchbox that are technically diverse. Fortunately, a solution to this problem exists – Vagrant. Vagrant is a small layer that runs between a Virtual Machine software package (commonly VirtualBox) that facilitates the ease of configuring, distributing, and working with a ‘headless’ virtual machine. At the end of the day, the goal with using a Vagrant environment is this:

A developer, new to a project, can `git clone a-repository`, run `vagrant up` and immediately have a dedicated development box, running a precisely pre-configured virtual machine, while still using their familiar operating system and tools. The developer doesn’t need to understand how to install and configure any software on a foreign operating system or leave the environment they are comfortable working in.

This is accomplished by a few relatively simple steps –

Vagrant Box Configuration

A box with all of the needed dependencies is created by someone who is familiar with how the development environment should run and all the needed software.

  1. A `Vagrantfile` is created in the project with any virtual machine hardware settings, shared folders, and local networking settings
  2. A Vagrant Box is created by creating and configuring a virtual machine with all necessary software (web servers, databases, language dependencies, etc)
  3. The Box is placed on a web server for download

Using the Vagrant Box

A developer entering a project would do the following to be up and working quickly:

  1. `git clone` the project repository
  2. Run the `vagrant up` command, which will read the instructions in the `Vagrantfile` and download the virtual machine image that was uploaded previously to the developers local computer
  3. The developer can then start editing files with whatever tools they enjoy on their machine – all changes are synced with the virtual machine running in the background through a mapped shared drive become the local computer and virtual machine
  4. The developer can access and view their changes via the network IP address configured in the `Vagrantfile` – they are working on the files locally, but running the files through the virtual machine via shared networking

The Results

Utilizing Vagrant at Switchbox has allowed for a greater ability for teams to work together – specifically we have seen great results in front-end collaboration and testing between our teams. As ASP.NET vNext approaches release status and full Linux support we look forward to providing ASP.NET base boxes alongside of our Rails and WordPress options.