| Dean Troyer | 54b9732 | 2014-06-20 17:53:55 -0500 | [diff] [blame] | 1 | <!DOCTYPE html> | 
 | 2 | <html lang="en"> | 
 | 3 |   <head> | 
 | 4 |     <meta charset="utf-8"> | 
 | 5 |     <title>Single Machine Guide - DevStack</title> | 
 | 6 |     <meta name="description" content=""> | 
 | 7 |     <meta name="author" content=""> | 
 | 8 |  | 
 | 9 |     <!-- Le HTML5 shim, for IE6-8 support of HTML elements --> | 
 | 10 |     <!--[if lt IE 9]> | 
 | 11 |       <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> | 
 | 12 |     <![endif]--> | 
 | 13 |  | 
 | 14 |     <!-- Le styles --> | 
 | 15 |     <link href="../assets/css/bootstrap.css" rel="stylesheet"> | 
 | 16 |     <link href="../assets/css/local.css" rel="stylesheet"> | 
 | 17 |     <style type="text/css"> | 
 | 18 |       body { padding-top: 60px; } | 
 | 19 |       dd { padding: 10px; } | 
 | 20 |     </style> | 
 | 21 |      | 
 | 22 |     <!-- Le javascripts --> | 
 | 23 |     <script src="../assets/js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script> | 
 | 24 |     <script src="../assets/js/bootstrap.js" type="text/javascript" charset="utf-8"></script> | 
 | 25 |   </head> | 
 | 26 |  | 
 | 27 |   <body> | 
 | 28 |  | 
 | 29 |     <div class="navbar navbar-fixed-top"> | 
 | 30 |       <div class="navbar-inner"> | 
 | 31 |         <div class="container"> | 
 | 32 |           <a class="brand" href="/">DevStack</a> | 
 | 33 |           <ul class="nav pull-right"> | 
 | 34 |             <li><a href="../overview.html">Overview</a></li> | 
 | 35 |             <li><a href="../changes.html">Changes</a></li> | 
 | 36 |             <li><a href="../faq.html">FAQ</a></li> | 
 | 37 |             <li><a href="http://github.com/openstack-dev/devstack">GitHub</a></li> | 
 | 38 |             <li><a href="https://review.openstack.org/#/q/status:open+project:openstack-dev/devstack,n,z">Gerrit</a></li> | 
 | 39 |           </ul> | 
 | 40 |         </div> | 
 | 41 |       </div> | 
 | 42 |     </div> | 
 | 43 |  | 
 | 44 |     <div class="container"> | 
 | 45 |       <section id="overview"> | 
 | 46 |         <h1>Running a Cloud in a VM</h1> | 
 | 47 |         <p>Use the cloud to build the cloud! Use your cloud to launch new versions of OpenStack  | 
 | 48 |         in about 5 minutes.  When you break it, start over!  The VMs launched in the cloud will  | 
 | 49 |         be slow as they are running in QEMU (emulation), but their primary use is testing | 
 | 50 |         OpenStack development and operation.  Speed not required.</p> | 
 | 51 |       </section> | 
 | 52 |  | 
 | 53 |       <section id="prerequisites"> | 
 | 54 |         <div class="page-header"> | 
 | 55 |           <h2>Prerequisites <small>Cloud & Image</small></h2> | 
 | 56 |         </div> | 
 | 57 |  | 
 | 58 |         <h3>Virtual Machine</h3> | 
 | 59 |         <p>DevStack should run in any virtual machine running a supported Linux release.  It will perform best with 2Gb or more of RAM.</p> | 
 | 60 |  | 
 | 61 |         <h3>OpenStack Deployment & cloud-init</h3> | 
 | 62 |         <p>If the cloud service has an image with <code>cloud-init</code> pre-installed, use it.  You can | 
 | 63 |         get one from <a href="http://uec-images.ubuntu.com">Ubuntu's Daily Build</a> | 
 | 64 |         site if necessary.  This will enable you to launch VMs with userdata that installs  | 
 | 65 |         everything at boot time.  The userdata script below will install and run | 
 | 66 |         DevStack with a minimal configuration.  The use of <code>cloud-init</code> | 
 | 67 |         is outside the scope of this document, refer to <a href"http://cloudinit.readthedocs.org/en/latest/index.html">the | 
 | 68 |         <code>cloud-init</code> docs</a> for more information.</p> | 
 | 69 |  | 
 | 70 |         <p>If you are directly using a hypervisor like Xen, kvm or VirtualBox you can manually kick off | 
 | 71 |         the script below as a non-root user in a bare-bones server installation.</p> | 
 | 72 |       </section> | 
 | 73 |  | 
 | 74 |       <section id="requirements"> | 
 | 75 |         <div class="page-header"> | 
 | 76 |           <h2>Installation <small>shake and bake</small></h2> | 
 | 77 |         </div> | 
 | 78 |  | 
 | 79 |         <h3>Launching With Cloud-Init</h3> | 
 | 80 |         <p>This cloud config grabs the latest version of DevStack via git, creates a minimal  | 
 | 81 |         <code>local.conf</code> file and kicks off <code>stack.sh</code>.  It should | 
 | 82 |         be passed as the user-data file when booting the VM.</p> | 
 | 83 |         <pre>#cloud-config | 
 | 84 |  | 
 | 85 | users: | 
 | 86 |   - default | 
 | 87 |   - name: stack | 
 | 88 |     lock_passwd: False | 
 | 89 |     sudo: ["ALL=(ALL) NOPASSWD:ALL\nDefaults:stack !requiretty"] | 
 | 90 |     shell: /bin/bash | 
 | 91 |  | 
 | 92 | write_files: | 
 | 93 |   - content: | | 
 | 94 |         #!/bin/sh | 
 | 95 |         DEBIAN_FRONTEND=noninteractive sudo apt-get -qqy update || sudo yum update -qy | 
 | 96 |         DEBIAN_FRONTEND=noninteractive sudo apt-get install -qqy git || sudo yum install -qy git | 
 | 97 |         sudo chown stack:stack /home/stack | 
 | 98 |         cd /home/stack | 
 | 99 |         git clone https://github.com/openstack-dev/devstack.git | 
 | 100 |         cd devstack | 
 | 101 |         echo '[[local|localrc]]' > local.conf | 
 | 102 |         echo ADMIN_PASSWORD=password >> local.conf | 
 | 103 |         echo MYSQL_PASSWORD=password >> local.conf | 
 | 104 |         echo RABBIT_PASSWORD=password >> local.conf | 
 | 105 |         echo SERVICE_PASSWORD=password >> local.conf | 
 | 106 |         echo SERVICE_TOKEN=tokentoken >> local.conf | 
 | 107 |         ./stack.sh | 
 | 108 |     path: /home/stack/start.sh | 
 | 109 |     permissions: 0755 | 
 | 110 |  | 
 | 111 | runcmd: | 
 | 112 |   - su -l stack ./start.sh</pre> | 
 | 113 |         <p>As DevStack will refuse to run as root, this configures <code>cloud-init</code> | 
 | 114 |         to create a non-root user and run the <code>start.sh</code> script as that user.</p> | 
 | 115 |  | 
 | 116 |         <h3>Launching By Hand</h3> | 
 | 117 |         <p>Using a hypervisor directly, launch the VM and either manually perform the steps in the  | 
 | 118 |         embedded shell script above or copy it into the VM.</p> | 
 | 119 |  | 
 | 120 |         <h3>Using OpenStack</h3> | 
 | 121 |         <p>At this point you should be able to access the dashboard.  Launch VMs and if you give them floating IPs access those VMs from other machines on your network.</p> | 
 | 122 |  | 
 | 123 |         <p>One interesting use case is for developers working on a VM on their laptop.  Once | 
 | 124 |         <code>stack.sh</code> has completed once, all of the pre-requisite packages are installed | 
 | 125 |         in the VM and the source trees checked out.  Setting <code>OFFLINE=True</code> in | 
 | 126 |         <code>local.conf</code> enables <code>stack.sh</code> to run multiple times without an Internet | 
 | 127 |         connection.  DevStack, making hacking at the lake possible since 2012!</p> | 
 | 128 |       </section> | 
 | 129 |  | 
 | 130 |       <footer> | 
 | 131 |         <p>© Openstack Foundation 2011-2014 — An <a href="https://www.openstack.org/">OpenStack</a> <a href="https://wiki.openstack.org/wiki/Programs">program</a></p> | 
 | 132 |       </footer> | 
 | 133 |  | 
 | 134 |     </div> <!-- /container --> | 
 | 135 |  | 
 | 136 |   </body> | 
 | 137 | </html> |