Dean Troyer | 26dd21b | 2014-11-06 09:33:02 -0600 | [diff] [blame] | 1 | ==================== |
| 2 | All-In-One Single VM |
| 3 | ==================== |
Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 4 | |
| 5 | Use the cloud to build the cloud! Use your cloud to launch new versions |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 6 | of OpenStack in about 5 minutes. If you break it, start over! The VMs |
Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 7 | launched in the cloud will be slow as they are running in QEMU |
| 8 | (emulation), but their primary use is testing OpenStack development and |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 9 | operation. |
Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 10 | |
| 11 | Prerequisites Cloud & Image |
Sean Dague | 3293046 | 2014-11-18 06:51:16 -0500 | [diff] [blame] | 12 | =========================== |
Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 13 | |
| 14 | Virtual Machine |
Sean Dague | 3293046 | 2014-11-18 06:51:16 -0500 | [diff] [blame] | 15 | --------------- |
Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 16 | |
| 17 | DevStack should run in any virtual machine running a supported Linux |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 18 | release. It will perform best with 4GB or more of RAM. |
Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 19 | |
| 20 | OpenStack Deployment & cloud-init |
Sean Dague | 3293046 | 2014-11-18 06:51:16 -0500 | [diff] [blame] | 21 | --------------------------------- |
Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 22 | |
| 23 | If the cloud service has an image with ``cloud-init`` pre-installed, use |
| 24 | it. You can get one from `Ubuntu's Daily |
| 25 | Build <http://uec-images.ubuntu.com>`__ site if necessary. This will |
| 26 | enable you to launch VMs with userdata that installs everything at boot |
| 27 | time. The userdata script below will install and run DevStack with a |
| 28 | minimal configuration. The use of ``cloud-init`` is outside the scope of |
| 29 | this document, refer to the ``cloud-init`` docs for more information. |
| 30 | |
| 31 | If you are directly using a hypervisor like Xen, kvm or VirtualBox you |
| 32 | can manually kick off the script below as a non-root user in a |
| 33 | bare-bones server installation. |
| 34 | |
| 35 | Installation shake and bake |
Sean Dague | 3293046 | 2014-11-18 06:51:16 -0500 | [diff] [blame] | 36 | =========================== |
Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 37 | |
| 38 | Launching With Cloud-Init |
Sean Dague | 3293046 | 2014-11-18 06:51:16 -0500 | [diff] [blame] | 39 | ------------------------- |
Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 40 | |
| 41 | This cloud config grabs the latest version of DevStack via git, creates |
| 42 | a minimal ``local.conf`` file and kicks off ``stack.sh``. It should be |
| 43 | passed as the user-data file when booting the VM. |
| 44 | |
| 45 | :: |
| 46 | |
| 47 | #cloud-config |
| 48 | |
| 49 | users: |
| 50 | - default |
| 51 | - name: stack |
| 52 | lock_passwd: False |
| 53 | sudo: ["ALL=(ALL) NOPASSWD:ALL\nDefaults:stack !requiretty"] |
| 54 | shell: /bin/bash |
| 55 | |
| 56 | write_files: |
| 57 | - content: | |
| 58 | #!/bin/sh |
| 59 | DEBIAN_FRONTEND=noninteractive sudo apt-get -qqy update || sudo yum update -qy |
| 60 | DEBIAN_FRONTEND=noninteractive sudo apt-get install -qqy git || sudo yum install -qy git |
| 61 | sudo chown stack:stack /home/stack |
| 62 | cd /home/stack |
| 63 | git clone https://git.openstack.org/openstack-dev/devstack |
| 64 | cd devstack |
| 65 | echo '[[local|localrc]]' > local.conf |
| 66 | echo ADMIN_PASSWORD=password >> local.conf |
| 67 | echo MYSQL_PASSWORD=password >> local.conf |
| 68 | echo RABBIT_PASSWORD=password >> local.conf |
| 69 | echo SERVICE_PASSWORD=password >> local.conf |
| 70 | echo SERVICE_TOKEN=tokentoken >> local.conf |
| 71 | ./stack.sh |
| 72 | path: /home/stack/start.sh |
| 73 | permissions: 0755 |
| 74 | |
| 75 | runcmd: |
| 76 | - su -l stack ./start.sh |
| 77 | |
| 78 | As DevStack will refuse to run as root, this configures ``cloud-init`` |
| 79 | to create a non-root user and run the ``start.sh`` script as that user. |
| 80 | |
| 81 | Launching By Hand |
Sean Dague | 3293046 | 2014-11-18 06:51:16 -0500 | [diff] [blame] | 82 | ----------------- |
Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 83 | |
| 84 | Using a hypervisor directly, launch the VM and either manually perform |
| 85 | the steps in the embedded shell script above or copy it into the VM. |
| 86 | |
| 87 | Using OpenStack |
Sean Dague | 3293046 | 2014-11-18 06:51:16 -0500 | [diff] [blame] | 88 | --------------- |
Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 89 | |
| 90 | At this point you should be able to access the dashboard. Launch VMs and |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 91 | if you give them floating IPs, access those VMs from other machines on |
Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 92 | your network. |
| 93 | |
| 94 | One interesting use case is for developers working on a VM on their |
| 95 | laptop. Once ``stack.sh`` has completed once, all of the pre-requisite |
| 96 | packages are installed in the VM and the source trees checked out. |
| 97 | Setting ``OFFLINE=True`` in ``local.conf`` enables ``stack.sh`` to run |
| 98 | multiple times without an Internet connection. DevStack, making hacking |
| 99 | at the lake possible since 2012! |