Vagrant: Up and Running

This review was originally printed in the June 2013 edition of the UKUUG newsletter, which is now defunct.

Title: Vagrant: Up and Running
Authors: Mitchell Hashimoto
ISBN: 9781449335830

As a developer, one of the biggest challenges I find when testing or debugging code is building a sandboxed environment which mirrors production, yet can easily be created and destroyed. Vagrant is a piece of software to support the automated creation and provisioning of virtual machines for exactly this purpose. I’ve been looking forward to the release of this book for some time, as whilst the online documentation is excellent, I find a well-written book is often easier to follow when first learning about a topic.

One important myth that is refuted in the first chapter is that Vagrant only works with VirtualBox. Whilst this was the case prior to v1.1, Vagrant now supports all the major virtualisation layers, as well as Amazon EC2, although the book does use VirtualBox for all of its examples. The standard topics of an introductory chapter are also covered – installation, why you might want to use Vagrant, and where to find support and help.

The second chapter covers the basics of setting up your first Vagrant machine, including a sample Ubuntu Precise VM which is pre-configured. Each part of the sample configuration file is examined, from basic networking to how the box frees up resources on destruction. This dovetails nicely into the following chapter, which shows how to extend a bare bones machine with automated provisioning, beginning with shell scripts and moving on to cover Chef and Puppet (albeit briefly).

Chapter four covers networking, and at only 10 pages I felt this was a little light on detail, given how complex various network options and their interactions with each other can be. The same applies to the next chapter, which covers the modelling of clusters containing multiple machines, but only briefly, and with a sole real life example (MySQL) which wasn’t actually a cluster.

Despite being referred to throughout the text, boxes – the base images upon which Vagrant environments are built – do not get full coverage until the sixth chapter. All the basic aspects of boxes are discussed, as well as some useful tips on specific areas such as removing udev rules which can cause boot failures.

The final chapter of the book is by far the longest and explains how to extend Vagrant using plug-ins. This is perhaps a little advanced for an ‘up and running’ text, and I would have preferred greater detail on the topics in previous chapters. Anyone who is already familiar with RubyGems will find this chapter easier to work through, as Vagrant plug-ins are packaged as gems.

As with many technical books, there are a couple of appendices which in this case cover environment variables and configuration options. However, given Vagrant’s rapid development this is one of the areas where the online documentation is likely to be more up to date and useful.

Overall, I felt this book provided a good broad overview of Vagrant, and would be sufficient for a developer who wants to create simple sandboxed environments for testing code. It’s also an ideal starting point from which you can jump off into the more comprehensive online reference documentation.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.