Vagrant, Devstack and the ICCLab

What?

So what is vagrant? In the words of its creator it allows you to:

“Create and configure lightweight, reproducible, and portable development environments.”

Vagrant is a ruby framework that automates a lot of the boring, painful setup a developer needs to do to work with services. In the case of the ICCLab those services are generally OpenStack services. We use vagrant to create consistent reproducible setups of our testbed on local development machines.

Why?

In the ICCLab we operate two testbeds, one that is stable and operates an OpenStack environment that does not change often. The other is a research testbed that is used to investigate the latest features of OpenStack, evaluate our own modifications or experiments upon OpenStack (e.g. Hadoop, CloudFoundry etc.). In order for code modifications to be placed on to the research test bed it must first prove that it is worthy. To prove itself it must be shown that it can run locally on a laptop/desktop and can be installed and configured automatically. The great advantage of this is that vagrant supports the same configuration framework, puppet, as is used on the test beds. Essentially what vagrant allows us to do is model our infrastructure but locally before deploying changes to metal.

How?

So the best way to get started with vagrant is by example. In this example, we’ll show you how to create a vagrant project to create an OpenStack devstack environment.

Install it!

To install vagrant, make sure you have virtualbox already installed. Then simply install it. On a mac it’s easiest to use the bundled installer but otherwise just execute gem install vagrant. Once installed execute vagrant help so see what you can do. You should see something like this:

[gist id=5309928]

The most common commands you’ll use are up, halt, reload and ssh

Play with it!

The example we will bring you through is setting up a devstack environment. To see all the code check out the github project here.

The first thing you need to do when creating a new vagrant project is to create a directory to host all your files. Once done you’ll need to execute:

[gist id=5310061]

Once done you should find a Vagrantfile created in your directory. This contains a basic template of how your vagrant project. For the purposes of this example we’ll use the following content:

[gist id=5310052]

What is important to note in this devstack_config.vm.box. This tells vagrant what ‘box’ it will use. A box is simply a VM image with a particular initial configuration (see here for more details). Boxes can also be created with veewee. You can also install other boxes from vagrantbox.es.

The next most important piece in this is the devstack_config.vm.provision block. This details how your software will be installed. In this example we are using puppet (in local mode) to install devstack. In the code block we specify where to find additional modules and where to find the vagrant specific manifests. Most importantly we note that the main “entry point” manifest is (devstack_puppet.manifest_file variable).

In our example, site.pp encodes the following steps to create our devstack VM:

  1. Install git
  2. Check out the devstack repository
  3. Customise the devstack installation by setting up the devstack localrc file
  4. Run devstack by executing stack.sh

You can see the contents of this manifest here.

If you’ve got this far then with the vagrant project cloned from github all you’ll have to do to get your devstack VM up and running is:

vagrant up

 

Easy eh?

Wrap up

The latest vagrant will add support for provisioning on the cloud (Amazon, OpenStack, Rackspace) and is also independent of hypervisor choice including support (paid) for VMware fusion.


2 Kommentare

  • Looks like the new devstack needs a pinch more memory than the 1024Mb used in the Vagrant file. I created a pull-request on the github of the project increasing the memory form 1024 into 1280Mb, perhaps you can have a look at it and see if this works for you guys as well. Many thanks for the project! Very useful to see the combination of puppet, vagrant and devstack.

    Wessel


Leave a Reply

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