Browse code

Merge branch 'master' of github.com:cloudbuilders/nfs-stack

Anthony Young authored on 2011/09/13 17:28:41
Showing 2 changed files
... ...
@@ -3,21 +3,22 @@ Tool to build (nfs export) openstack dev environments
3 3
 # Todo
4 4
 
5 5
 * Add python-novaclient cli support
6
-* move to mysql
6
+* move keystone/glance/dash to mysql
7
+* syslog
8
+* munin
9
+* check openstack-puppet recipes to see if anything else is missing
10
+* allow rabbit connection to be specified via environment variables with sensible defaults
7 11
 * Add volume support
8 12
 * extract image upload to a seperate script that supports generating images via debootstrap (ubuntu-vm-builder?)
9 13
 * allow changing of git locations (specify different tag/branch or repos)
10 14
 * change method of invoking stack.sh to ./stack.sh all _or_ ./stack.sh nova-compute,nova-network,nova-api,nova-volume
11 15
 * Add quantum support
12
-* allow rabbit connection to be specified via environment variables with sensible defaults
13
-* syslog
14
-* munin
15
-* check puppet recipes to see if anything else is missing
16 16
 
17 17
 # Done
18 18
 
19 19
 * sqlconn can be set via env
20 20
 * move back to using sudo
21
+* move nova to mysql
21 22
 
22 23
 # Future
23 24
 
... ...
@@ -2,14 +2,27 @@
2 2
 
3 3
 # **stack.sh** is rackspace cloudbuilder's opinionated openstack dev installation.
4 4
 
5
-# FIXME: commands should be: stack.sh should allow specifying a subset of services
6
-
7
-# Quit script on error
5
+# Settings/Options
6
+# ================
7
+
8
+# This script is customizable through setting environment variables.  If you
9
+# want to override a setting you can either::
10
+#
11
+#     export MYSQL_PASS=anothersecret
12
+#     ./stack.sh
13
+#
14
+# or run on a single line ``MYSQL_PASS=simple ./stack.sh``
15
+
16
+# This script exits on an error so that errors don't compound and you see 
17
+# only the first error that occured.
8 18
 set -o errexit
9 19
 
10
-# Log commands as they are run for debugging
20
+# Print the commands being run so that we can see the command that triggers 
21
+# an error.  It is also useful for following allowing as the install occurs.
11 22
 set -o xtrace
12 23
 
24
+# Important paths: ``DIR`` is where we are executing from and ``DEST`` is 
25
+# where we are installing openstack.
13 26
 DIR=`pwd`
14 27
 DEST=/opt
15 28
 
... ...
@@ -22,28 +35,38 @@ NOVACLIENT_DIR=$DEST/python-novaclient
22 22
 API_DIR=$DEST/openstackx
23 23
 NOVNC_DIR=$DEST/noVNC
24 24
 
25
-# Use the first IP unless an explicit is set by a HOST_IP environment variable
25
+# Use the first IP unless an explicit is set by ``HOST_IP`` environment variable
26 26
 if [ ! -n "$HOST_IP" ]; then
27 27
     HOST_IP=`LC_ALL=C ifconfig  | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
28 28
 fi
29 29
 
30
-# NOVA network / hypervisor configuration
30
+# Nova network configuration
31 31
 INTERFACE=${INTERFACE:-eth0}
32 32
 FLOATING_RANGE=${FLOATING_RANGE:-10.6.0.0/27}
33 33
 FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24}
34
-LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu}
35 34
 NET_MAN=${NET_MAN:-VlanManager}
36
-# NOTE(vish): If you are using FlatDHCP on multiple hosts, set the interface
37
-#             below but make sure that the interface doesn't already have an
38
-#             ip or you risk breaking things.
35
+
36
+# If you are using FlatDHCP on multiple hosts, set the ``FLAT_INTERFACE``
37
+# variable but make sure that the interface doesn't already have an
38
+# ip or you risk breaking things.
39 39
 # FLAT_INTERFACE=eth0
40 40
 
41
+# Nova hypervisor configuration
42
+LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu}
43
+
44
+
41 45
 # TODO: switch to mysql for all services
42 46
 MYSQL_PASS=${MYSQL_PASS:-nova}
43 47
 SQL_CONN=${SQL_CONN:-mysql://root:$MYSQL_PASS@localhost/nova}
44 48
 # TODO: set rabbitmq conn string explicitly as well
45 49
 
46
-# seed configuration with mysql password
50
+# Install Packages
51
+# ================
52
+#
53
+# Openstack uses a fair number of other projects.
54
+
55
+# Seed configuration with mysql password so that apt-get install doesn't 
56
+# prompt us for a password upon install.
47 57
 cat <<MYSQL_PRESEED | sudo debconf-set-selections
48 58
 mysql-server-5.1 mysql-server/root_password password $MYSQL_PASS
49 59
 mysql-server-5.1 mysql-server/root_password_again password $MYSQL_PASS
... ...
@@ -79,8 +102,11 @@ git_clone https://github.com/cloudbuilders/python-novaclient.git $NOVACLIENT_DIR
79 79
 # that is *deprecated*.  The code is being moved into python-novaclient & nova.
80 80
 git_clone https://github.com/cloudbuilders/openstackx.git $API_DIR
81 81
 
82
+# Initialization
83
+# ==============
84
+
82 85
 # setup our checkouts so they are installed into python path
83
-# allowing `import nova` or `import glance.client`
86
+# allowing ``import nova`` or ``import glance.client``
84 87
 cd $NOVACLIENT_DIR; sudo python setup.py develop
85 88
 cd $KEYSTONE_DIR; sudo python setup.py develop
86 89
 cd $GLANCE_DIR; sudo python setup.py develop
... ...
@@ -110,7 +136,10 @@ if [ -L /dev/disk/by-label/nova-instances ]; then
110 110
     sudo chown -R `whoami` $NOVA_DIR/instances
111 111
 fi
112 112
 
113
-# *Dashboard*: setup django application to serve via apache/wsgi
113
+# Dashboard
114
+# ---------
115
+#
116
+# Setup the django application to serve via apache/wsgi
114 117
 
115 118
 # Dash currently imports quantum even if you aren't using it.  Instead 
116 119
 # of installing quantum we can create a simple module that will pass the 
... ...
@@ -123,7 +152,7 @@ cd $DASH_DIR/openstack-dashboard
123 123
 cp local/local_settings.py.example local/local_settings.py
124 124
 dashboard/manage.py syncdb
125 125
 
126
-# ---- Setup Apache ----
126
+# setup apache
127 127
 # create an empty directory to use as our 
128 128
 mkdir $DASH_DIR/.blackhole
129 129
 
... ...
@@ -131,11 +160,14 @@ mkdir $DASH_DIR/.blackhole
131 131
 cat $DIR/files/000-default.template | sed 's/%DASH_DIR%/\/opt\/dash/g' > /tmp/000-default
132 132
 sudo mv /tmp/000-default /etc/apache2/sites-enabled
133 133
 
134
-# `python setup.py develop` left some files owned by root in $DASH_DIR and
134
+# ``python setup.py develop`` left some files owned by root in $DASH_DIR and
135 135
 # others by the original owner.  We need to change the owner to apache so
136 136
 # dashboard can run
137 137
 sudo chown -R www-data:www-data $DASH_DIR
138 138
 
139
+# Glance
140
+# ------
141
+
139 142
 sudo mkdir -p /var/log/glance
140 143
 sudo chown `whoami` /var/log/glance 
141 144
 
... ...
@@ -144,6 +176,9 @@ cp $DIR/files/screenrc ~/.screenrc
144 144
 
145 145
 # TODO: update current user to allow sudo for all commands in files/sudo/*
146 146
 
147
+# Nova
148
+# ----
149
+
147 150
 NL=`echo -ne '\015'`
148 151
 
149 152
 
... ...
@@ -208,6 +243,9 @@ sudo chown -R `whoami` /var/lib/glance
208 208
 rm -rf /var/lib/glance/images/*
209 209
 rm -f $GLANCE_DIR/glance.sqlite
210 210
 
211
+# Launch Services
212
+# ===============
213
+
211 214
 # nova api crashes if we start it with a regular screen command,
212 215
 # so send the start command by forcing text into the window.
213 216
 function screen_it {
... ...
@@ -227,12 +265,14 @@ screen_it n-sch "$NOVA_DIR/bin/nova-scheduler"
227 227
 screen_it n-vnc "$NOVA_DIR/bin/nova-vncproxy"
228 228
 screen_it dash "sudo /etc/init.d/apache2 restart; tail -f /var/log/apache2/error.log"
229 229
 
230
+# Install Images
231
+# ==============
230 232
 
231
-# ---- download an install images ----
233
+# Downloads a tty image (ami/aki/ari style), then extracts it.  Upon extraction 
234
+# we upload to glance with the glance cli tool.
232 235
 
233 236
 mkdir -p $DEST/images
234 237
 cd $DEST/images
235
-# prepare initial images for loading into glance
236 238
 if [ ! -f $DEST/tty.tgz ]; then
237 239
     wget -c http://images.ansolabs.com/tty.tgz -O $DEST/tty.tgz
238 240
 fi