...
|
...
|
@@ -2,19 +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
|
5
|
# Settings/Options
|
8
|
|
-# ----------------
|
|
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``
|
9
|
15
|
|
10
|
|
-# Quit script on error
|
|
16
|
+# This script exits on an error so that errors don't compound and you see
|
|
17
|
+# only the first error that occured.
|
11
|
18
|
set -o errexit
|
12
|
19
|
|
13
|
|
-# 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.
|
14
|
22
|
set -o xtrace
|
15
|
23
|
|
16
|
|
-# Important paths: `DIR` is where we are executing from and `DEST` is where we
|
17
|
|
-# are installing openstack.
|
|
24
|
+# Important paths: ``DIR`` is where we are executing from and ``DEST`` is
|
|
25
|
+# where we are installing openstack.
|
18
|
26
|
DIR=`pwd`
|
19
|
27
|
DEST=/opt
|
20
|
28
|
|
...
|
...
|
@@ -27,34 +35,38 @@ NOVACLIENT_DIR=$DEST/python-novaclient
|
27
|
27
|
API_DIR=$DEST/openstackx
|
28
|
28
|
NOVNC_DIR=$DEST/noVNC
|
29
|
29
|
|
30
|
|
-# Use the first IP unless an explicit is set by a HOST_IP environment variable
|
|
30
|
+# Use the first IP unless an explicit is set by ``HOST_IP`` environment variable
|
31
|
31
|
if [ ! -n "$HOST_IP" ]; then
|
32
|
32
|
HOST_IP=`LC_ALL=C ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
|
33
|
33
|
fi
|
34
|
34
|
|
35
|
|
-# NOVA network / hypervisor configuration
|
|
35
|
+# Nova network configuration
|
36
|
36
|
INTERFACE=${INTERFACE:-eth0}
|
37
|
37
|
FLOATING_RANGE=${FLOATING_RANGE:-10.6.0.0/27}
|
38
|
38
|
FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24}
|
39
|
|
-LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu}
|
40
|
39
|
NET_MAN=${NET_MAN:-VlanManager}
|
41
|
40
|
|
42
|
|
-# NOTE(vish): If you are using FlatDHCP on multiple hosts, set the interface
|
43
|
|
-# below but make sure that the interface doesn't already have an
|
44
|
|
-# ip or you risk breaking things.
|
|
41
|
+# If you are using FlatDHCP on multiple hosts, set the ``FLAT_INTERFACE``
|
|
42
|
+# variable but make sure that the interface doesn't already have an
|
|
43
|
+# ip or you risk breaking things.
|
45
|
44
|
# FLAT_INTERFACE=eth0
|
46
|
45
|
|
|
46
|
+# Nova hypervisor configuration
|
|
47
|
+LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu}
|
|
48
|
+
|
|
49
|
+
|
47
|
50
|
# TODO: switch to mysql for all services
|
48
|
51
|
MYSQL_PASS=${MYSQL_PASS:-nova}
|
49
|
52
|
SQL_CONN=${SQL_CONN:-mysql://root:$MYSQL_PASS@localhost/nova}
|
50
|
53
|
# TODO: set rabbitmq conn string explicitly as well
|
51
|
54
|
|
52
|
55
|
# Install Packages
|
53
|
|
-# ----------------
|
|
56
|
+# ================
|
54
|
57
|
#
|
55
|
58
|
# Openstack uses a fair number of other projects.
|
56
|
59
|
|
57
|
|
-# seed configuration with mysql password
|
|
60
|
+# Seed configuration with mysql password so that apt-get install doesn't
|
|
61
|
+# prompt us for a password upon install.
|
58
|
62
|
cat <<MYSQL_PRESEED | sudo debconf-set-selections
|
59
|
63
|
mysql-server-5.1 mysql-server/root_password password $MYSQL_PASS
|
60
|
64
|
mysql-server-5.1 mysql-server/root_password_again password $MYSQL_PASS
|
...
|
...
|
@@ -91,10 +103,10 @@ git_clone https://github.com/cloudbuilders/python-novaclient.git $NOVACLIENT_DIR
|
91
|
91
|
git_clone https://github.com/cloudbuilders/openstackx.git $API_DIR
|
92
|
92
|
|
93
|
93
|
# Initialization
|
94
|
|
-# --------------
|
|
94
|
+# ==============
|
95
|
95
|
|
96
|
96
|
# setup our checkouts so they are installed into python path
|
97
|
|
-# allowing `import nova` or `import glance.client`
|
|
97
|
+# allowing ``import nova`` or ``import glance.client``
|
98
|
98
|
cd $NOVACLIENT_DIR; sudo python setup.py develop
|
99
|
99
|
cd $KEYSTONE_DIR; sudo python setup.py develop
|
100
|
100
|
cd $GLANCE_DIR; sudo python setup.py develop
|
...
|
...
|
@@ -124,7 +136,10 @@ if [ -L /dev/disk/by-label/nova-instances ]; then
|
124
|
124
|
sudo chown -R `whoami` $NOVA_DIR/instances
|
125
|
125
|
fi
|
126
|
126
|
|
127
|
|
-# *Dashboard*: setup django application to serve via apache/wsgi
|
|
127
|
+# Dashboard
|
|
128
|
+# ---------
|
|
129
|
+#
|
|
130
|
+# Setup the django application to serve via apache/wsgi
|
128
|
131
|
|
129
|
132
|
# Dash currently imports quantum even if you aren't using it. Instead
|
130
|
133
|
# of installing quantum we can create a simple module that will pass the
|
...
|
...
|
@@ -145,11 +160,14 @@ mkdir $DASH_DIR/.blackhole
|
145
|
145
|
cat $DIR/files/000-default.template | sed 's/%DASH_DIR%/\/opt\/dash/g' > /tmp/000-default
|
146
|
146
|
sudo mv /tmp/000-default /etc/apache2/sites-enabled
|
147
|
147
|
|
148
|
|
-# `python setup.py develop` left some files owned by root in $DASH_DIR and
|
|
148
|
+# ``python setup.py develop`` left some files owned by root in $DASH_DIR and
|
149
|
149
|
# others by the original owner. We need to change the owner to apache so
|
150
|
150
|
# dashboard can run
|
151
|
151
|
sudo chown -R www-data:www-data $DASH_DIR
|
152
|
152
|
|
|
153
|
+# Glance
|
|
154
|
+# ------
|
|
155
|
+
|
153
|
156
|
sudo mkdir -p /var/log/glance
|
154
|
157
|
sudo chown `whoami` /var/log/glance
|
155
|
158
|
|
...
|
...
|
@@ -158,6 +176,9 @@ cp $DIR/files/screenrc ~/.screenrc
|
158
|
158
|
|
159
|
159
|
# TODO: update current user to allow sudo for all commands in files/sudo/*
|
160
|
160
|
|
|
161
|
+# Nova
|
|
162
|
+# ----
|
|
163
|
+
|
161
|
164
|
NL=`echo -ne '\015'`
|
162
|
165
|
|
163
|
166
|
|
...
|
...
|
@@ -222,8 +243,8 @@ sudo chown -R `whoami` /var/lib/glance
|
222
|
222
|
rm -rf /var/lib/glance/images/*
|
223
|
223
|
rm -f $GLANCE_DIR/glance.sqlite
|
224
|
224
|
|
225
|
|
-# Launching Services
|
226
|
|
-# ------------------
|
|
225
|
+# Launch Services
|
|
226
|
+# ===============
|
227
|
227
|
|
228
|
228
|
# nova api crashes if we start it with a regular screen command,
|
229
|
229
|
# so send the start command by forcing text into the window.
|
...
|
...
|
@@ -244,8 +265,8 @@ screen_it n-sch "$NOVA_DIR/bin/nova-scheduler"
|
244
|
244
|
screen_it n-vnc "$NOVA_DIR/bin/nova-vncproxy"
|
245
|
245
|
screen_it dash "sudo /etc/init.d/apache2 restart; tail -f /var/log/apache2/error.log"
|
246
|
246
|
|
247
|
|
-# Installing Images
|
248
|
|
-# -----------------
|
|
247
|
+# Install Images
|
|
248
|
+# ==============
|
249
|
249
|
|
250
|
250
|
# Downloads a tty image (ami/aki/ari style), then extracts it. Upon extraction
|
251
|
251
|
# we upload to glance with the glance cli tool.
|