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