| 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 | 
| Swapnil (coolsvap) Kulkarni | c988bf6 | 2015-10-08 13:10:43 +0530 | [diff] [blame] | 67 | echo DATABASE_PASSWORD=password >> local.conf | 
| Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 68 | echo RABBIT_PASSWORD=password >> local.conf | 
|  | 69 | echo SERVICE_PASSWORD=password >> local.conf | 
| Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 70 | ./stack.sh | 
|  | 71 | path: /home/stack/start.sh | 
|  | 72 | permissions: 0755 | 
|  | 73 |  | 
|  | 74 | runcmd: | 
|  | 75 | - su -l stack ./start.sh | 
|  | 76 |  | 
|  | 77 | As DevStack will refuse to run as root, this configures ``cloud-init`` | 
|  | 78 | to create a non-root user and run the ``start.sh`` script as that user. | 
|  | 79 |  | 
| Matt Riedemann | f798ec1 | 2015-09-01 13:20:48 -0700 | [diff] [blame] | 80 | If you are using cloud-init and you have not | 
|  | 81 | `enabled custom logging <../configuration.html#enable-logging>`_ of the stack | 
|  | 82 | output, then the stack output can be found in | 
|  | 83 | ``/var/log/cloud-init-output.log`` by default. | 
|  | 84 |  | 
| Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 85 | Launching By Hand | 
| Sean Dague | 3293046 | 2014-11-18 06:51:16 -0500 | [diff] [blame] | 86 | ----------------- | 
| Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 87 |  | 
|  | 88 | Using a hypervisor directly, launch the VM and either manually perform | 
|  | 89 | the steps in the embedded shell script above or copy it into the VM. | 
|  | 90 |  | 
|  | 91 | Using OpenStack | 
| Sean Dague | 3293046 | 2014-11-18 06:51:16 -0500 | [diff] [blame] | 92 | --------------- | 
| Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame] | 93 |  | 
|  | 94 | 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] | 95 | 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] | 96 | your network. | 
|  | 97 |  | 
|  | 98 | One interesting use case is for developers working on a VM on their | 
|  | 99 | laptop. Once ``stack.sh`` has completed once, all of the pre-requisite | 
|  | 100 | packages are installed in the VM and the source trees checked out. | 
|  | 101 | Setting ``OFFLINE=True`` in ``local.conf`` enables ``stack.sh`` to run | 
|  | 102 | multiple times without an Internet connection. DevStack, making hacking | 
|  | 103 | at the lake possible since 2012! |