The latest expert opinions, articles, and guides for the Java professional.

Pragmatic DevOps: Reproducing Yourself with Vagrant and Chef

Ah, DevOps, the biggest WTF buzzword among the innovators in software development and deployment today. It’s as hot a topic as agile was a decade ago, but just like agile, no one was able to really lock down a good enough definition, or figure out the context in which the definition of Agile actually existed (at first).

Like agile, DevOps focuses on simple concepts–such as automation, reusability and iterative improvement–in its foundation. Here at Zeroturnaround, we like to think of ourselves as a “DevOps company”; our products JRebel and LiveRebel are the fruits of our hard work, research and vision aimed at the entire software creation pipeline, from Dev to QA to Staging and Ops (and back again). If software is eating the world, then ZT wants to help eat the world faster!

This post provides an introductory look at why should you care about DevOps, what can we use to make it easy to get started and covered by hands-on guides. First we need to look at Virtualization and Provisioning.

Virtualization & Provisioning

DevOps can get philosophical, and there is a lot of discussion about how the community of DevOps fans itself as the main driver for the movement. But for getting actual work done, it’s often about making a new environment available (virtualization) or taking an environment and making sure it has everything needed (provisioning). As we plan to cover this topic more, we start by taking a look at Chef as a provisioning tool, and Vagrant to handle virtualization.


Chef open source provisioning tool

Chef is an open source tool made by Opscode, and was designed to turn provisioning into an automated process. It operates using cookbooks, i.e. self-contained scenarios such as “installing and configuring MySQL”. Environments are assigned cookbooks and Chef makes sure that everything is available and up to date, thus providing us the automation and reusability part of the DevOps recipe (pun intended).


Vagrant virtual environment

Vagrant was created by Mitchell Hashimoto and John Bender and is now under the umbrella of HashiCorp, launched in November 2012 to take “Vagrant to the next level.” Using Vagrant, setting up and controlling environments is actually a pleasure. Point it to a base box and run vagrant upcongratulations, you now have a virtual machine ready to go. If you need more than is contained in the base box, then provisioning is natively supported with Chef, and Vagrant is not limited to your own machine: Amazon EC2 boxes are supported and controlled just as easily as VMware or VirtualBox.

Vagrant and Chef help you set up development environments easily

Grrrr, setting up a new development environment: it’s annoying at best, and easily eats up a day. It can even break you, if two weeks into development you realize that all the anomalies you’ve had are due to an incompatible tool version. Doh!

But imagine a parallel universe, with Vagrant and Chef at our fingertips. One developer sets up a Vagrant box with necessary provisioning. For everyone else? Just vagrant up and ready to write code. If someone introduces a change, you can just add it once and everyone is up to date. Virtualization also gives us separate environments for projects, so it’s easy to work with one environment running Java 5 and with everything else running Java 7.

Vagrant and Chef enable reproducible operations

With regards to operations, automated setup is definitely the most visible win here, as it saves time and avoids human errors. Vagrant and Chef have more to them. Let’s take a pragmatic approach and look at common scenarios for most Ops teams…

So let’s say that you’ve set up all the nodes and now someone finds out that an important package was forgotten. You could go and fix every node, or, improve the Chef cookbook and let it reprovision. The latter is an important point–you don’t have to get everything right the first time. You can continuously improve the process to have everything evolving along with your needs.

Or consider this: service abruptly goes down and no one knows why. What’s worse, it only occurs in production. Most would start praying to the gods (the old and the new) by now, but not us! Developers just clone a Vagrant repository and after vagrant up we have a full-blown production environment for debugging. And why limit ourselves to post-analysis? Virtualization is equally useful for experimenting with provisioning and node set-up beforehand.

Vagrant and Chef help you scale your business

News flash: Development and Operations are going to affect the business side of things. In many cases, dedicated hardware has been replaced with a few nodes provisioned on the cloud, flexibly adding and tearing down new nodes as the load demands. Services are also offered on-demand, and modern users have become less tolerant towards delays because you need to set up extra nodes or bootstrap on-demand service. They only see a slow service.

Yes, Chef and Vagrant can help you here by having automated, tested and easy-to-improve processes in place, letting you react automatically to ever-changing business requirements.

Next up: Bootstrapping Vagrant & Chef

DevOps all boils down to common sense–automation, reusability and iterative improvement. Instead of development only, developers also now look at operations, and sysadmins, release engineers and other operations folks should get to know development better too. But there is something happening here…the vast communities of developers out there seem to greatly outweigh the tiny pockets of operations focused professionals, so it seems as though the first steps to get the ball rolling need to come from the Developers.

Looking at DevOps pragmatically, we can see that the very same ideas that make development successful are equally useful and beneficial in operations: automation, reusability and iterative improvement in operations boosts productivity and quality throughout the company. And it’s easy to get started as we have great tools for both virtualization and provisioning, Vagrant and Chef, ready to use.

Feel free to leave you comments below (yes, we’ve heard about Chef’s poor documentation!), and get ready for upcoming posts on Bootstrapping Vagrant and Chef, and later on we’ll show you how to actually provision the environment, step by step.


Responses (5)

  1. Avatar  


    March 30, 2013 @ 11:12 am

    Besides Chef, there is also Puppet. There seem to be 2 sides in DevOps, The Chef lovers and the Puppet lovers.

    Personally I tried Puppet, much better documentation :-D. I don’t know how they are substantially different, but it would be a nice thing to look into.

  2. Avatar  

    Neeme Praks

    March 30, 2013 @ 10:32 pm

    On the difference between Chef and Puppet, a nice summary:

  3. Avatar  

    Mirko Adari

    April 1, 2013 @ 1:48 pm

    Ansible is also a nice choice. There are pros and cons to all of them, just have to pick one and roll with it.

  4. Avatar  

    Stéphan Mestach

    April 2, 2013 @ 8:29 am

    No mention about veewee to create the initial base box ?

  5. Avatar  


    May 10, 2013 @ 8:52 am

    It seems as it is just depending on the person using the tools. A personal choice. Just as one prefers Firefox over Chrome or IE or Opera.

RSS feed for comments on this post.

Leave a comment