Ryan Burnette

My Boilerplate Vagrantfile

A few months back I finally hit a point where maintaining my local development environment was taking up too significant a portion of the day. Tweaking things to make the environment suitable for one project would break something for another. This was leading to switching between projects becoming somewhat of a nightmare. The time expense of switching between projects had become too great.

Enter Vagrant. Vagrant is a command-line management tool for a virtual provided. In my case I’m using Vagrant to provision instances of virtual machines in VirtualBox on my Mac OS workstation.

Vagrant lets me develop in an Ubuntu-based environment that closely matches the staging and production environments. Especially true in Rails, this is helpful to avoid surprises that pop up when switching from Mac OS on development to Linux on staging and production.

It’s great for team projects where development environments and platforms really vary. One person is on a Mac, another on a PC, but they’re brought to a common development setup trough Vagrant.

When I start a project I curl -L http://bit.ly/rbVagrantfile > Vagrantfile to grab my Vagrantfile boilerplate. It has some helpful snippets that I’ve picked up along the way and is tailored to be quick to implement.

Note that my boilerplate is specific to Mac OS.

<%= gist “ryanbunrette”, “10671268” %>