Using OpenHatch with Vagrant: Difference between revisions

From OpenHatch wiki
Content added Content deleted
imported>Paulproteus
imported>Paulproteus
(Gitorious => Github)
 
(8 intermediate revisions by 2 users not shown)
Line 11: Line 11:
=== Install VirtualBox ===
=== Install VirtualBox ===


First, you will need to download VirtualBox. If you are on Ubuntu or a Debian-based operating system, just do:
First, you will need to download VirtualBox. If you're running Windows, Mac, or Linux, I suggest you visit [http://www.virtualbox.org/wiki/Downloads the VirtualBox downloads page] and get the version you need.


(If you're on Debian squeeze higher, or Ubuntu Maverick or higher, you can install virtualbox-ose from the package manager. You must make sure to get version 4.0 or higher of VirtualBox. If in doubt, use the official installer.
$ sudo apt-get install virtualbox-ose

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


=== Install Vagrant ===
=== Install Vagrant ===


Vagrant is a tool that makes it ''quite easy'' to manage virtual machines. To install it, type:
Vagrant is a tool that makes it ''quite easy'' to manage virtual machines. Here we install it using the '''gem''' tool.


First, make sure you have the '''gem''' command. If you are unsure, type this into a terminal:
$ gem install vagrant


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


If you get an error saying "command not found", then you'll need to install it. On Ubuntu/Debian, you can do that with:
$ sudo apt-get install rubygems

$ sudo apt-get install rubygems build-essential ruby-dev

Now, we install Vagrant:

$ sudo gem install vagrant


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


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


Line 39: Line 43:


$ vagrant up
$ vagrant up

If you get a '''command not found''' error, try:

$ /var/lib/gems/1.8/bin/vagrant up


This may take 30 minutes! This is a good time to go get a sandwich.
This may take 30 minutes! This is a good time to go get a sandwich.
Line 46: Line 54:
$ vagrant ssh
$ vagrant ssh
$ cd /vagrant
$ cd /vagrant
$ ./bin/mysite runserver
$ ./bin/mysite runserver 0.0.0.0:8000


Now, on your '''real''' computer, visit http://127.0.0.1:8000/. Ta-da! Your own editable copy of the OpenHatch site.
Now, on your '''real''' computer, visit http://127.0.0.1:8000/. Ta-da! Your own editable copy of the OpenHatch site.
Line 66: Line 74:
$ vagrant suspend
$ vagrant suspend


to turn the machine off. When you do "vagrant up" the next time, everything will be restored to the way it was when you did suspend.
to turn the machine off.


=== Starting the VM again ===
=== Starting the VM again ===
Line 82: Line 90:
== How to get help with this ==
== How to get help with this ==


Sign on to #openhatch and ask us. ''paulproteus'' there is likely to be able to help.
Sign on to our IRC channel (#openhatch on irc.freenode.net) and ask us. ''paulproteus'' there is likely to be able to help.

Latest revision as of 02:16, 13 February 2012

This is a page about improving or modifying OpenHatch.

We call that "Hacking OpenHatch," and there is a whole category of pages about that.


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.

Getting started

Install VirtualBox

First, you will need to download VirtualBox. If you're running Windows, Mac, or Linux, I suggest you visit the VirtualBox downloads page and get the version you need.

(If you're on Debian squeeze higher, or Ubuntu Maverick or higher, you can install virtualbox-ose from the package manager. You must make sure to get version 4.0 or higher of VirtualBox. If in doubt, use the official installer.

Install Vagrant

Vagrant is a tool that makes it quite easy to manage virtual machines. Here we install it using the gem tool.

First, make sure you have the gem command. If you are unsure, type this into a terminal:

 gem

If you get an error saying "command not found", then you'll need to install it. On Ubuntu/Debian, you can do that with:

$ sudo apt-get install rubygems build-essential ruby-dev

Now, we install Vagrant:

$ sudo gem install vagrant

Get the OpenHatch code

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

$ git clone git://github.com/openhatch/oh-mainline.git
$ cd oh-mainline

Tell vagrant to bring up the machine

This should be as easy as:

$ vagrant up

If you get a command not found error, try:

$ /var/lib/gems/1.8/bin/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 0.0.0.0:8000

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.

Virtual machine maintenance

Stopping the VM

From your own machine, you can do:

$ vagrant suspend

to turn the machine off. When you do "vagrant up" the next time, everything will be restored to the way it was when you did suspend.

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 our IRC channel (#openhatch on irc.freenode.net) and ask us. paulproteus there is likely to be able to help.