Jump to: navigation, search

Difference between revisions of "SingleNodeNovaVagrantChef"

Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
= Single node nova installation using Vagrant and Chef =
 
= Single node nova installation using Vagrant and Chef =
 
 
Note: The original article was written by Anso Labs and can be found at http://ansolabs.com/articles/single-node-nova-installation-using-vagrant-and-chef.
 
Note: The original article was written by Anso Labs and can be found at http://ansolabs.com/articles/single-node-nova-installation-using-vagrant-and-chef.
  
Line 7: Line 6:
  
 
== Install [[VirtualBox]] ==
 
== Install [[VirtualBox]] ==
 
 
VirtualBox is virtualization software by Oracle. It runs on Mac/Linux/Windows and can be controlled from the command line. Note that we will be using VirtualBox 4.0.
 
VirtualBox is virtualization software by Oracle. It runs on Mac/Linux/Windows and can be controlled from the command line. Note that we will be using VirtualBox 4.0.
  
 
=== OSX ===
 
=== OSX ===
 
 
Download the latest at version at http://www.virtualbox.org/wiki/Downloads
 
Download the latest at version at http://www.virtualbox.org/wiki/Downloads
  
=== Maverick ===
+
Lucid
 
 
<pre><nowiki>
 
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
 
echo "deb http://download.virtualbox.org/virtualbox/debian maverick contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
 
sudo apt-get update
 
sudo apt-get install -y virtualbox-4.0
 
</nowiki></pre>
 
 
 
  
=== Lucid ===
 
  
 
<pre><nowiki>
 
<pre><nowiki>
Line 32: Line 20:
 
sudo apt-get install -y virtualbox-4.0
 
sudo apt-get install -y virtualbox-4.0
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
== Install Vagrant ==
 
== Install Vagrant ==
 
 
Note that the below assumes (wrongly) that the user has [[RubyGems]] installed. There should be a section on installing [[RubyGems]], and *not* from source tarballs from the Vagrant site... that's simply not professional to expect a user install a source package of a dependency in order to run your software. -JRP.
 
Note that the below assumes (wrongly) that the user has [[RubyGems]] installed. There should be a section on installing [[RubyGems]], and *not* from source tarballs from the Vagrant site... that's simply not professional to expect a user install a source package of a dependency in order to run your software. -JRP.
  
 
=== OS X ===
 
=== OS X ===
 
  
 
<pre><nowiki>
 
<pre><nowiki>
Line 45: Line 30:
 
sudo gem install vagrant
 
sudo gem install vagrant
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
If this fails, install the MacPorts version of ruby instead. See http://vagrantup.com/docs/getting-started/setup/mac.html for more details
 
If this fails, install the MacPorts version of ruby instead. See http://vagrantup.com/docs/getting-started/setup/mac.html for more details
 
=== Maverick ===
 
 
 
<pre><nowiki>
 
sudo gem install vagrant
 
sudo ln -s /var/lib/gems/1.8/bin/vagrant /usr/local/bin/vagrant
 
</nowiki></pre>
 
 
  
 
=== Lucid ===
 
=== Lucid ===
 
  
 
<pre><nowiki>
 
<pre><nowiki>
Line 69: Line 43:
 
sudo gem1.8 install vagrant
 
sudo gem1.8 install vagrant
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
== Get the anso chef recipes ==
 
== Get the anso chef recipes ==
Line 75: Line 48:
 
<pre><nowiki>
 
<pre><nowiki>
 
cd ~
 
cd ~
git clone http://github.com/ansolabs/openstack-cookbooks.git 
+
git clone
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
== Set up some directories ==
 
== Set up some directories ==
Line 86: Line 58:
 
cd chef
 
cd chef
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
== Get the chef-solo Vagrantfile ==
 
== Get the chef-solo Vagrantfile ==
Line 93: Line 64:
  
 
<pre><nowiki>
 
<pre><nowiki>
curl -o Vagrantfile https://gist.github.com/raw/786945/solo.rb
+
curl -o Vagrantfile
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
== Running nova ==
 
== Running nova ==
Line 104: Line 74:
 
vagrant up
 
vagrant up
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
In 3-10 minutes, your vagrant instance should be running. NOTE: Some people report an error from vagrant complaining about MAC addresses the first time they vagrant up. Doing vagrant up again seems to resolve the problem.
 
In 3-10 minutes, your vagrant instance should be running. NOTE: Some people report an error from vagrant complaining about MAC addresses the first time they vagrant up. Doing vagrant up again seems to resolve the problem.
Line 112: Line 81:
 
vagrant ssh
 
vagrant ssh
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
Now you can run an instance and connect to it:
 
Now you can run an instance and connect to it:
Line 125: Line 93:
 
ssh -i test.pem root@10.0.0.3
 
ssh -i test.pem root@10.0.0.3
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
Yo, dawg, your VMs have VMs! That is, you are now running an instance inside of Nova, which itself is running inside a VirtualBox VM.
 
Yo, dawg, your VMs have VMs! That is, you are now running an instance inside of Nova, which itself is running inside a VirtualBox VM.
Line 135: Line 102:
 
vagrant destroy
 
vagrant destroy
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
== Using the dashboard ==
 
== Using the dashboard ==
 
 
The openstack dashboard should be running on 192.168.86.100. You can login using username: admin, password: vagrant.
 
The openstack dashboard should be running on 192.168.86.100. You can login using username: admin, password: vagrant.

Revision as of 23:32, 10 July 2012

Single node nova installation using Vagrant and Chef

Note: The original article was written by Anso Labs and can be found at http://ansolabs.com/articles/single-node-nova-installation-using-vagrant-and-chef.

Integration testing for distributed systems that have many dependencies can be a huge challenge. Ideally, you would have a cluster of machines that you could PXE boot to a base os install and run a complete install of the system. Unfortunately not everyone has a bunch of extra hardware sitting around. For those of us that are a bit on the frugal side, a whole lot of testing can be done with Virtual Machines. Read on for a simple guide to installing Nova with VirtualBox and Vagrant.

Install VirtualBox

VirtualBox is virtualization software by Oracle. It runs on Mac/Linux/Windows and can be controlled from the command line. Note that we will be using VirtualBox 4.0.

OSX

Download the latest at version at http://www.virtualbox.org/wiki/Downloads

Lucid


wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
echo "deb http://download.virtualbox.org/virtualbox/debian lucid contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt-get update
sudo apt-get install -y virtualbox-4.0

Install Vagrant

Note that the below assumes (wrongly) that the user has RubyGems installed. There should be a section on installing RubyGems, and *not* from source tarballs from the Vagrant site... that's simply not professional to expect a user install a source package of a dependency in order to run your software. -JRP.

OS X

sudo gem update --system
sudo gem install vagrant

If this fails, install the MacPorts version of ruby instead. See http://vagrantup.com/docs/getting-started/setup/mac.html for more details

Lucid

wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.6.zip
sudo apt-get install -y unzip ruby-dev libopenssl-ruby
unzip rubygems-1.3.6.zip
cd rubygems-1.3.6
sudo ruby setup.rb
sudo gem1.8 install vagrant

Get the anso chef recipes

cd ~
git clone

Set up some directories

mkdir aptcache
mkdir chef
cd chef

Get the chef-solo Vagrantfile

Provisioning for vagrant can use chef-solo, chef-server, or puppet. We’re going to use chef-solo for the installation of nova.


curl -o Vagrantfile

Running nova

Installing and running nova is as simple as vagrant up


vagrant up

In 3-10 minutes, your vagrant instance should be running. NOTE: Some people report an error from vagrant complaining about MAC addresses the first time they vagrant up. Doing vagrant up again seems to resolve the problem.


vagrant ssh

Now you can run an instance and connect to it:


. /vagrant/novarc
euca-add-keypair test > test.pem
chmod 600 test.pem
euca-run-instances -t m1.tiny -k test ami-tty
# wait for boot (euca-describe-instances should report running)
ssh -i test.pem root@10.0.0.3

Yo, dawg, your VMs have VMs! That is, you are now running an instance inside of Nova, which itself is running inside a VirtualBox VM.

When the you are finished, you can destroy the entire system with vagrant destroy. You will also need to remove the .pem files and the novarc if you want to run the system again.


vagrant destroy

Using the dashboard

The openstack dashboard should be running on 192.168.86.100. You can login using username: admin, password: vagrant.