mindflakes

Jun 22, 2013 - 3 minute read

My current vagrant setup

I firmly believe that Vagrant is the quickest way from nothing to a running and preconfigured development environment on any machine and especially Macs. For me, the ‘works on my machine’ problem is the biggest reason I run Vagrant. Day-to-day though, Vagrant is probably the easiest to use UI for Virtualbox. If my work actually had money to give me for the VMWare plugin, I believe it would be a better UI for VMWare Fusion as well.

The Basics

This is enough to get started with Vagrant and to reap the rewards.

  1. Virtualbox
  2. Vagrant

That’s great and all, but these are the basics. At the very least, you’ll be able to bring up some boxes that don’t require special plugins up.

Frills

You don’t need these but I do! I usually build my Vagrant boxes with Opscode Chef, a configuration management system. For reference, a Chef cookbook is a series of statements about how a machine should be setup.

Most of these frills are plugins. To build the boxes I make, you’ll usually have to install or use these.

  1. Berkshelf is a dependency resolution manager for Chef. I use Berkshelf as a gem along with the corresponding vagrant plugin. With this, when I run berks cookbook <name>, I can make a Virtual Machine that can be created and destroyed quickly from scratch for whatever purpose. I could do vagrant init but berks cookbook has it beat by creating a directory structure that’s pretty much a Chef cookbook. Even if I don’t intend to redistribute said cookbook, the VM made is perfectly fine for tryout purposes.
  2. I like using the Opscode Bento boxes. They are minimal and they have already been uploaded to S3 on Opscode’s dime. In a Vagrantfile, you can set the box URL for a Vagrant basebox to be downloaded. These boxes are great.
  3. You can’t use the Opscode Bento boxes without the Vagrant Omnibus plugin. Those boxes do not include Chef so you must install Chef at runtime.
  4. Just so you don’t get warnings about the Virtualbox additions being out of date, there’s a Vagrant plugin to automatically update the guest additions if needed. This one is really optional and it’s use just surpresses that warning you get if you bring up a vagrant box with old guest additions.

The Future

In the future, I’ll like to be able to test my boxes to make sure they stay working as the things they pull from the internet change. For this, there’s Test Kitchen.

Unfortunately, it’s still really cutting edge. However, there are guard plugins and this Youtube Video and blog post. That video is very much a must see for anybody who appreciates TDD.

Full integration testing on your own laptop is very attractive to me. I keep mine plugged in and I find it disturbing that the rest of the cores on this MacBook Pro just lie cool.

And also, maybe if I get some cash, I might drop some money on the VMWare plugin and VMWare Fusion. If I want to simulate multiple servers at a time and heavier loads, it would make that much faster.