Greg's Blog

helping me remember what I figure out

Two Cool Use Cases for Vagrant

| Comments

I have been using Vagrant on and off for a couple of years now to set up dev environments. Admittedly Docker has recently been my prefered way for setting up such environments. Last week I came across two other uses cases for Vagrant that I wanted to share.

We were tasked with setting up Jenkins on a server and while we were waiting for the environment to be made available, Stuart went ahead and built a box using the same target OS to work through and document the steps needed to install Jenkins. Once done, we just ran vagrant destroy and vagrant up to quickly repeat and validate that the steps we had jotted down were correct and that we had everything we needed. Such a quick and easy to prepare and validate an install. As a result installing Jenkins on the target environment only took me about 20 minutes.

The other use I came across was, when working with a Bluemix buildpack. I was setting up a Nginx based reverse proxy for our app, but I wanted to upgrade the Nginx version. Reading through the documentation for the buildpack, I saw probably the coolest use yet for Vagrant. Simply run vagrant up and it spins up two instance of Ubuntu (Lucid and Trusty), patches itself, builds the Nginx binaries and moves them to a distribution folder once done. To upgrade Nginx was a doddle as a result: simply update the target version (and the PCRE version), run vagrant up and a few minutes later you have two new sets of binaries that can be pushed to Bluemix with the community buildpack. Be sure to also check out the tests!

So there you have it, Vagrant is not only great for solo devs and dev teams as a sandboxed dev environment, but you can try out installations and build binaries with a few simple commands.