openstack-manuals/doc/src/docbkx/openstack-compute-admin/computeautomation.xml

240 lines
14 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter [
<!-- Some useful entities borrowed from HTML -->
<!ENTITY ndash "&#x2013;">
<!ENTITY mdash "&#x2014;">
<!ENTITY hellip "&#x2026;">
<!ENTITY nbsp "&#160;">
<!ENTITY CHECK '<inlinemediaobject xmlns="http://docbook.org/ns/docbook">
<imageobject>
<imagedata fileref="img/Check_mark_23x20_02.svg"
format="SVG" scale="60"/>
</imageobject>
</inlinemediaobject>'>
<!ENTITY ARROW '<inlinemediaobject xmlns="http://docbook.org/ns/docbook">
<imageobject>
<imagedata fileref="img/Arrow_east.svg"
format="SVG" scale="60"/>
</imageobject>
</inlinemediaobject>'>
]>
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
xml:id="ch_openstack-compute-automated-installations">
<title>OpenStack Compute Automated Installations</title>
<para>In a large-scale cloud deployment, automated installations are a requirement for
successful, efficient, repeatable installations. Automation for installation also helps with
continuous integration and testing. This chapter offers some tested methods for deploying
OpenStack Compute with either Puppet (an infrastructure management platform) or Chef (an
infrastructure management framework) paired with Vagrant (a tool for building and
distributing virtualized development environments).</para>
<section xml:id="openstack-compute-deployment-tool-with-puppet">
<title>Deployment Tool for OpenStack using Puppet(dodai-deploy)</title>
<para>The dodai-deploy is a software management tool. It supports OpenStack Diablo(Nova, Glance, Swift) and hadoop 0.20.2</para>
<simplesect>
<title>Features</title>
<itemizedlist>
<listitem>
<para>Manage installation, uninstallation and testing of a software.</para>
</listitem>
<listitem>
<para>Support OpenStack Diablo and hadoop 0.20.2</para>
</listitem>
<listitem>
<para>Support target machines in different network segments.</para></listitem>
<listitem>
<para>Provide web UI to facilitate user operations.</para></listitem>
<listitem>
<para>Provide REST API to make it possible to integrate it with other tools.</para>
</listitem>
<listitem>
<para>Support parallel installation of software components.</para>
</listitem>
</itemizedlist>
</simplesect>
<simplesect>
<title>Glossary</title>
<itemizedlist>
<listitem>
<para>Deployment server - The server in which Dodai is installed.</para>
</listitem>
<listitem>
<para>Node - The machine that is the target of installation.</para>
</listitem>
<listitem>
<para>Nova, Glance, Swift etc.</para></listitem>
<listitem>
<para>Proposal - The set of the kinds of configurations which describe how to install a software. The configurations include "Node config", "Config item", "Software config", "Component config".</para></listitem>
<listitem>
<para>Node config - A configuration that describes which component to be installed on a node.</para>
</listitem>
<listitem>
<para>Config item - A variable which can be used in the content of software config and component config.</para>
</listitem>
<listitem>
<para>Software config - A configuration that describes the content of a configuration file for all components.</para>
</listitem>
<listitem>
<para>Component config - A configuration that describes the content of a configuration file for only one component.</para>
</listitem>
</itemizedlist>
</simplesect>
<simplesect><title>Installation</title>
<para>The "$home" in the following sections is the path of the home directory of the dodai-deploy.</para>
<para>OSes supported</para>
<para>The following OSes are supported.</para>
<itemizedlist>
<listitem>
<para>ubuntu 10.10</para>
</listitem>
<listitem>
<para>ubuntu 11.04</para>
</listitem>
<listitem>
<para>ubuntu 11.10</para></listitem>
</itemizedlist>
<para>1. Download dodai-deploy</para>
<para>Execute the following commands on the deployment server and all the nodes.</para>
<literallayout class="monospaced">
sudo apt-get install git -y
git clone https://github.com/nii-cloud/dodai-deploy.git
cd dodai-deploy; git checkout 1.0 #only used to get dodai-deploy 1.0</literallayout>
<para>2. Set up the deployment server</para>
<para>Execute the following commands on deployment server to install necessary softwares and modify their settings.</para>
<literallayout class="monospaced">sudo $home/setup-env/setup.sh server</literallayout>
<para>3. Set up nodes</para>
<para>Execute the following commands on all the nodes to install necessary softwares and modify their settings.</para>
<literallayout class="monospaced">sudo $home/setup-env/setup.sh node $server</literallayout>
<para>The $server in the above command is the fully qualified domain name (fqdn) of the deployment server. You can confirm the fqdn with the following command.</para>
<literallayout class="monospaced">sudo hostname -f</literallayout>
<para>4. Set up storage device for Swift</para>
<para>It is necessary to set up a storage device before swift is installed.
You should execute the commands for a physical device or for a loopback device
on all nodes in which swift storage server is to be installed.</para>
<para>4.1 For a physical device</para>
<para>Use the following command when the device is a physical device.</para>
<literallayout class="monospaced">sudo $home/setup-env/setup-storage-for-swift.sh physical $storage_path $storage_dev</literallayout>
<para>For example,</para>
<literallayout class="monospaced">sudo $home/setup-env/setup-storage-for-swift.sh physical /srv/node sdb1</literallayout>
<para>4.2 For a loopback device</para>
<para>Use the following command when the device is a loopback device.</para>
<literallayout class="monospaced">sudo $home/setup-env/setup-storage-for-swift.sh loopback $storage_path $storage_dev $size</literallayout>
<para>For example,</para>
<literallayout class="monospaced">sudo $home/setup-env/setup-storage-for-swift.sh loopback /srv/node sdb1 4</literallayout>
<para>5. Start servers</para>
<para>Execute the following command on the deployment server to start the web server and job server.</para>
<literallayout class="monospaced">sudo $home/script/start-servers production</literallayout>
<para>BTW, You can stop the web server and job server with the following command.</para>
<literallayout class="monospaced">sudo $home/script/stop-servers</literallayout>
</simplesect>
<simplesect><title>Using web UI</title>
<para>You can find step-by-step guidance at http://$deployment_server:3000/rest_apis/index.html.</para>
</simplesect>
<simplesect><title>Using REST APIs</title>
<para>An API simulator can be found at http://$deployment_server:3000/rest_apis/index.html.
You can get the list of REST APIs with it. Moreover, you can execute APIs by simply filling
in parameters and clicking the "Execute" button.</para>
</simplesect>
<simplesect><title>Notes</title>
<para>1. SSH login nova instance after test of nova </para>
<para>An instance will be started during the test of nova. After the test,
you can login the instance by executing the following commands.</para>
<literallayout class="monospaced">
sudo -i
cd /tmp/nova
. env/novarc
euca-describe-instances
ssh -i mykey.priv 10.0.0.3</literallayout>
<para>2. Nova depends on glance in default settings.</para>
<para>Because in /etc/nova/nova.conf the value of setting "image_service" is "nova.image.glance.GlanceImageService",
glance should be installed before using nova.</para>
</simplesect>
</section>
<section xml:id="openstack-compute-installation-using-virtualbox-vagrant-and-chef">
<title>OpenStack Compute Installation Using VirtualBox, Vagrant, And Chef</title>
<para>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 OpenStack Compute (Nova) with VirtualBox and Vagrant.</para>
<simplesect><title>Installing VirtualBox</title>
<para>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 and the vagrant prerelease.</para>
<para>OSX</para>
<literallayout class="monospaced">curl -O http://download.virtualbox.org/virtualbox/4.0.2/VirtualBox-4.0.2-69518-OSX.dmg&#x000A;open VirtualBox-4.0.2-69518-OSX.dmg</literallayout>
<para>Ubuntu Maverick</para>
<literallayout class="monospaced">wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -&#x000A;echo &quot;deb http://download.virtualbox.org/virtualbox/debian maverick contrib&quot; | sudo tee /etc/apt/sources.list.d/virtualbox.list&#x000A;sudo apt-get update&#x000A;sudo apt-get install -y virtualbox-4.0</literallayout>
<para>Ubuntu Lucid</para>
<literallayout class="monospaced">wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -&#x000A;echo &quot;deb http://download.virtualbox.org/virtualbox/debian lucid contrib&quot; | sudo tee /etc/apt/sources.list.d/virtualbox.list&#x000A;sudo apt-get update&#x000A;sudo apt-get install -y virtualbox-4.0</literallayout></simplesect>
<simplesect><title>Install RubyGems</title>
<para>The following instructions for installing Vagrant use RubyGems for the installation commands. You can download RubyGems from <link xlink:href="http://rubygems.org/pages/download">http://rubygems.org/pages/download</link>. </para>
</simplesect>
<simplesect><title>Get the Vagrant Pre-release</title>
<para>OSX</para>
<literallayout class="monospaced">sudo gem update -- system&#x000A;sudo gem install vagrant -- pre</literallayout>
<para>Ubuntu Maverick</para>
<literallayout class="monospaced">sudo gem install vagrant --pre&#x000A;sudo ln -s /var/lib/gems/1.8/bin/vagrant /usr/local/bin/vagrant</literallayout>
<para>Ubuntu Lucid</para>
<literallayout class="monospaced">wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.6.zip&#x000A;sudo apt-get install -y unzip&#x000A;unzip rubygems-1.3.6.zip&#x000A;cd rubygems-1.3.6&#x000A;sudo ruby setup.rb&#x000A;sudo gem1.8 install vagrant --pre</literallayout></simplesect>
<simplesect> <title>Get the Chef Recipes</title>
<literallayout class="monospaced">cd ~&#x000A;git clone https://github.com/ansolabs/openstack-cookbooks/openstack-cookbooks.git</literallayout>
</simplesect>
<simplesect><title>Set Up Some Directories</title>
<literallayout class="monospaced">mkdir aptcache&#x000A;mkdir chef&#x000A;cd chef</literallayout>
</simplesect>
<simplesect><title>Get the chef-solo Vagrant file</title>
<para>Provisioning for vagrant can use chef-solo, chef-server, or puppet. We&#8217;re going to use chef-solo for the installation of OpenStack Compute.</para>
<literallayout class="monospaced">curl -o Vagrantfile https://raw.github.com/gist/786945/solo.rb</literallayout>
</simplesect>
<simplesect><title>Running OpenStack Compute within a Vagrant Instance</title>
<para>Installing and running OpenStack Compute is as simple as typing "vagrant up"</para>
<literallayout class="monospaced">vagrant up</literallayout>
<para>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 <code>vagrant up</code> again seems to resolve the problem.</para>
<literallayout class="monospaced">vagrant ssh</literallayout>
<para>Now you can run an instance and connect to it:</para>
<literallayout class="monospaced">. /vagrant/novarc&#x000A;euca-add-keypair test &gt; test.pem&#x000A;chmod 600 test.pem&#x000A;euca-run-instances -t m1.tiny -k test ami-tty&#x000A;# wait for boot (euca-describe-instances should report running)&#x000A;ssh -i test.pem root@10.0.0.3</literallayout>
<para>Yo, dawg, your VMs have VMs! That is, you are now running an instance inside of OpenStack Compute, which itself is running inside a VirtualBox VM.</para>
<para>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.</para>
<literallayout class="monospaced">vagrant destroy&#x000A;rm *.pem novarc</literallayout></simplesect>
<simplesect><title>Using the dashboard
</title><para>The OpenStack Dashboard should be running on 192.168.86.100. You can login using username: admin, password: vagrant.</para>
</simplesect></section>
</chapter>