Using OpenHatch with Vagrant

Summary
This page explains how to install OpenHatch into a virtual machine. Thanks to Vagrant and puppet, there are very few steps necessary.

It also explains how to maintain your virtual machine, and what to do if something goes wrong.

Install VirtualBox
First, you will need to download VirtualBox. If you are on Ubuntu or a Debian-based operating system, just do:

$ sudo apt-get install virtualbox-ose

If you are on Windows, Mac, or some other system, select the right

Install Vagrant
Vagrant is a tool that makes it quite easy to manage virtual machines. To install it, type:

$ gem install vagrant

If that does not work, you may not have the 'gem' program available. On Ubuntu/Debian, you can fix that with:

$ sudo apt-get install rubygems

Get the OpenHatch code
From a terminal, type these commands to download the most recent version from OpenHatch git:

$ git clone git://gitorious.org/openhatch/oh-mainline.git $ cd oh-mainline

Tell vagrant to bring up the machine
This should be as easy as:

$ vagrant up

This may take 30 minutes! This is a good time to go get a sandwich.

SSH into the machine, and start the web server
$ vagrant ssh $ cd /vagrant $ ./bin/mysite runserver

Now, on your real computer, visit http://127.0.0.1:8000/. Ta-da! Your own editable copy of the OpenHatch site.

Things to understand
There are a few things that you 'really should understand:


 * 1) On the virtual machine /vagrant maps to your git clone.
 * 2) You should use a text editor on your own machine to edit the code and templates.
 * 3) The same goes for git commands: do them on your own machine.

Stopping the VM
From your own machine, you can do:

$ vagrant suspend

to turn the machine off.

Starting the VM again
$ vagrant up

will bring the virtual machine online. That should work properly no matter why the VM is not on (for example: it will work if the machine has never been booted; it will work if you suspend it; it will work if you halted it).

Destroying the VM
If you want to throw away the virtual machine entirely, reclaiming disk space:

$ vagrant destroy

How to get help with this
Sign on to #openhatch and ask us. paulproteus there is likely to be able to help.