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.
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.
- A `Vagrantfile` is created in the project with any virtual machine hardware settings, shared folders, and local networking settings
- A Vagrant Box is created by creating and configuring a virtual machine with all necessary software (web servers, databases, language dependencies, etc)
- 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:
- `git clone` the project repository
- 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
- 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
- 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
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.