...
|
...
|
@@ -4,6 +4,8 @@
|
4
|
4
|
|
5
|
5
|
# This script installs and configures *nova*, *glance*, *dashboard* and *keystone*
|
6
|
6
|
|
|
7
|
+# FIXME: talk about single or multi-node installs
|
|
8
|
+
|
7
|
9
|
# To keep this script simple we assume you are running on an **Ubuntu 11.04
|
8
|
10
|
# Natty** machine. It should work in a VM or physical server. Additionally we
|
9
|
11
|
# put the list of *apt* and *pip* dependencies and other configuration files in
|
...
|
...
|
@@ -14,7 +16,7 @@
|
14
|
14
|
# Sanity Check
|
15
|
15
|
# ============
|
16
|
16
|
|
17
|
|
-# Start our timer
|
|
17
|
+# Record the start time. This allows us to print how long this script takes to run.
|
18
|
18
|
START_TIME=`python -c "import time; print time.time()"`
|
19
|
19
|
|
20
|
20
|
# Warn users who aren't on natty, but allow them to override check and attempt
|
...
|
...
|
@@ -37,28 +39,41 @@ if [ ! -d $FILES ]; then
|
37
|
37
|
exit 1
|
38
|
38
|
fi
|
39
|
39
|
|
40
|
|
-# If stack.sh is run as root, it automatically creates a stack user with
|
|
40
|
+# OpenStack is designed to be run as a regular user (Dashboard will fail to run
|
|
41
|
+# as root, since apache refused to startup serve content from root user). If
|
|
42
|
+# stack.sh is run as root, it automatically creates a stack user with
|
41
|
43
|
# sudo privileges and runs as that user.
|
42
|
44
|
if [[ $EUID -eq 0 ]]; then
|
43
|
45
|
echo "You are running this script as root."
|
|
46
|
+
|
|
47
|
+ # ensure sudo
|
44
|
48
|
apt-get update
|
45
|
49
|
apt-get install -y sudo
|
|
50
|
+
|
46
|
51
|
if ! getent passwd | grep -q stack; then
|
47
|
52
|
echo "Creating a user called stack"
|
48
|
53
|
useradd -U -G sudo -s /bin/bash -m stack
|
49
|
54
|
fi
|
50
|
|
- echo "Making sure stack has passwordless sudo"
|
|
55
|
+ echo "Giving stack user passwordless sudo priviledges"
|
51
|
56
|
echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
|
57
|
+
|
52
|
58
|
echo "Copying files to stack user"
|
53
|
59
|
cp -r -f `pwd` /home/stack/
|
54
|
60
|
THIS_DIR=$(basename $(dirname $(readlink -f $0)))
|
55
|
|
- chown -R stack:sudo /home/stack/$THIS_DIR
|
|
61
|
+ chown -R stack /home/stack/$THIS_DIR
|
56
|
62
|
echo "Running the script as stack in 3 seconds..."
|
57
|
63
|
sleep 3
|
58
|
64
|
exec su -c "cd /home/stack/$THIS_DIR/; bash stack.sh; bash" stack
|
59
|
65
|
exit 0
|
60
|
66
|
fi
|
61
|
67
|
|
|
68
|
+# So that errors don't compound we exit on any errors so you see only the
|
|
69
|
+# first error that occured.
|
|
70
|
+set -o errexit
|
|
71
|
+
|
|
72
|
+# Print the commands being run so that we can see the command that triggers
|
|
73
|
+# an error. It is also useful for following allowing as the install occurs.
|
|
74
|
+set -o xtrace
|
62
|
75
|
|
63
|
76
|
# Settings
|
64
|
77
|
# ========
|
...
|
...
|
@@ -79,13 +94,8 @@ fi
|
79
|
79
|
# We try to have sensible defaults, so you should be able to run ``./stack.sh``
|
80
|
80
|
# in most cases.
|
81
|
81
|
|
82
|
|
-# So that errors don't compound we exit on any errors so you see only the
|
83
|
|
-# first error that occured.
|
84
|
|
-set -o errexit
|
85
|
82
|
|
86
|
|
-# Print the commands being run so that we can see the command that triggers
|
87
|
|
-# an error. It is also useful for following allowing as the install occurs.
|
88
|
|
-set -o xtrace
|
|
83
|
+# FIXME: TALK ABOUT stackrc and localrc
|
89
|
84
|
|
90
|
85
|
# Import variables
|
91
|
86
|
source ./stackrc
|
...
|
...
|
@@ -107,12 +117,21 @@ NOVNC_DIR=$DEST/noVNC
|
107
|
107
|
# Specify which services to launch. These generally correspond to screen tabs
|
108
|
108
|
ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,dash,mysql,rabbit}
|
109
|
109
|
|
|
110
|
+# Nova hypervisor configuration. We default to **kvm** but will drop back to
|
|
111
|
+# **qemu** if we are unable to load the kvm module. Stack.sh can also install
|
|
112
|
+# an **LXC** based system.
|
|
113
|
+LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
|
|
114
|
+
|
|
115
|
+SCHEDULER=${SCHEDULER:-nova.scheduler.simple.SimpleScheduler}
|
|
116
|
+
|
110
|
117
|
# Use the first IP unless an explicit is set by ``HOST_IP`` environment variable
|
111
|
118
|
if [ ! -n "$HOST_IP" ]; then
|
112
|
119
|
HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
|
113
|
120
|
fi
|
114
|
121
|
|
115
|
|
-# Nova network configuration
|
|
122
|
+# Nova Network Configuration
|
|
123
|
+# --------------------------
|
|
124
|
+
|
116
|
125
|
PUBLIC_INTERFACE=${PUBLIC_INTERFACE:-eth0}
|
117
|
126
|
VLAN_INTERFACE=${VLAN_INTERFACE:-$PUBLIC_INTERFACE}
|
118
|
127
|
FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.1/28}
|
...
|
...
|
@@ -121,21 +140,28 @@ FIXED_NETWORK_SIZE=${FIXED_NETWORK_SIZE:-256}
|
121
|
121
|
NET_MAN=${NET_MAN:-FlatDHCPManager}
|
122
|
122
|
EC2_DMZ_HOST=${EC2_DMZ_HOST:-$HOST_IP}
|
123
|
123
|
FLAT_NETWORK_BRIDGE=${FLAT_NETWORK_BRIDGE:-br100}
|
124
|
|
-SCHEDULER=${SCHEDULER:-nova.scheduler.simple.SimpleScheduler}
|
125
|
124
|
|
126
|
125
|
# If you are using FlatDHCP on multiple hosts, set the ``FLAT_INTERFACE``
|
127
|
126
|
# variable but make sure that the interface doesn't already have an
|
128
|
127
|
# ip or you risk breaking things.
|
129
|
128
|
FLAT_INTERFACE=${FLAT_INTERFACE:-eth0}
|
130
|
129
|
|
131
|
|
-# Nova hypervisor configuration. We default to **kvm** but will drop back to
|
132
|
|
-# **qemu** if we are unable to load the kvm module.
|
133
|
|
-LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
|
134
|
130
|
|
135
|
|
-# Mysql connection info
|
|
131
|
+# MySQL & RabbitMQ
|
|
132
|
+# ----------------
|
|
133
|
+
|
|
134
|
+# We configure Nova, Dashboard, Glance and Keystone to use MySQL as their
|
|
135
|
+# database server. While they share a single server, each has their own
|
|
136
|
+# database and tables.
|
|
137
|
+
|
|
138
|
+# By default this script will install and configure MySQL. If you want to
|
|
139
|
+# use an existing server, you can pass in the user/password/host parameters.
|
|
140
|
+# You will need to send the same ``MYSQL_PASS`` to every host if you are doing
|
|
141
|
+# a multi-node devstack installation.
|
136
|
142
|
MYSQL_USER=${MYSQL_USER:-root}
|
137
|
143
|
MYSQL_PASS=${MYSQL_PASS:-`openssl rand -hex 12`}
|
138
|
144
|
MYSQL_HOST=${MYSQL_HOST:-localhost}
|
|
145
|
+
|
139
|
146
|
# don't specify /db in this string, so we can use it for multiple services
|
140
|
147
|
BASE_SQL_CONN=${BASE_SQL_CONN:-mysql://$MYSQL_USER:$MYSQL_PASS@$MYSQL_HOST}
|
141
|
148
|
|
...
|
...
|
@@ -146,6 +172,9 @@ RABBIT_PASSWORD=${RABBIT_PASSWORD:-`openssl rand -hex 12`}
|
146
|
146
|
# Glance connection info. Note the port must be specified.
|
147
|
147
|
GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292}
|
148
|
148
|
|
|
149
|
+# Keystone
|
|
150
|
+# --------
|
|
151
|
+
|
149
|
152
|
# Service Token - Openstack components need to have an admin token
|
150
|
153
|
# to validate user tokens.
|
151
|
154
|
SERVICE_TOKEN=${SERVICE_TOKEN:-`uuidgen`}
|