implement stackrc for variable configuration (esp repos)
| ... | ... |
@@ -1,5 +1,15 @@ |
| 1 | 1 |
#!/usr/bin/env bash |
| 2 | 2 |
|
| 3 |
+# Use stackrc.example if stackrc is missing |
|
| 4 |
+if [ ! -e ./stackrc ]; then |
|
| 5 |
+ read -n1 -p "No stackrc present. Copy stackrc.example to stackrc? (y/n) " |
|
| 6 |
+ echo |
|
| 7 |
+ [[ $REPLY = [yY] ]] && cp stackrc.example stackrc|| { echo "Aborting: Missing stackrc"; exit 1; }
|
|
| 8 |
+fi |
|
| 9 |
+ |
|
| 10 |
+# Source params |
|
| 11 |
+source ./stackrc |
|
| 12 |
+ |
|
| 3 | 13 |
# Configurable params |
| 4 | 14 |
BRIDGE=${BRIDGE:-br0}
|
| 5 | 15 |
CONTAINER=${CONTAINER:-STACK}
|
| ... | ... |
@@ -13,6 +23,9 @@ COPYENV=${COPYENV:-1}
|
| 13 | 13 |
# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova" |
| 14 | 14 |
STACKSH_PARAMS=${STACKSH_PARAMS:-}
|
| 15 | 15 |
|
| 16 |
+# Option to use the version of devstack on which we are currently working |
|
| 17 |
+USE_CURRENT_DEVSTACK=${USE_CURRENT_DEVSTACK:-1}
|
|
| 18 |
+ |
|
| 16 | 19 |
# Warn users who aren't on natty |
| 17 | 20 |
if ! grep -q natty /etc/lsb-release; then |
| 18 | 21 |
echo "WARNING: this script has only been tested on natty" |
| ... | ... |
@@ -51,6 +64,19 @@ if [ -d /cgroup/$CONTAINER ]; then |
| 51 | 51 |
cgdelete -r cpu,net_cls:$CONTAINER |
| 52 | 52 |
fi |
| 53 | 53 |
|
| 54 |
+# git clone only if directory doesn't exist already. Since ``DEST`` might not |
|
| 55 |
+# be owned by the installation user, we create the directory and change the |
|
| 56 |
+# ownership to the proper user. |
|
| 57 |
+function git_clone {
|
|
| 58 |
+ if [ ! -d $2 ]; then |
|
| 59 |
+ sudo mkdir $2 |
|
| 60 |
+ sudo chown `whoami` $2 |
|
| 61 |
+ git clone $1 $2 |
|
| 62 |
+ cd $2 |
|
| 63 |
+ # This checkout syntax works for both branches and tags |
|
| 64 |
+ git checkout $3 |
|
| 65 |
+ fi |
|
| 66 |
+} |
|
| 54 | 67 |
|
| 55 | 68 |
# Warm the base image on first install |
| 56 | 69 |
CACHEDIR=/var/cache/lxc/natty/rootfs-amd64 |
| ... | ... |
@@ -63,15 +89,23 @@ if [ ! -d $CACHEDIR ]; then |
| 63 | 63 |
chroot $CACHEDIR apt-get update |
| 64 | 64 |
chroot $CACHEDIR apt-get install -y --force-yes `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"` |
| 65 | 65 |
chroot $CACHEDIR pip install `cat files/pips/*` |
| 66 |
- # FIXME (anthony) - provide ability to vary source locations |
|
| 67 |
- #git clone https://github.com/cloudbuilders/nova.git $CACHEDIR/opt/nova |
|
| 68 |
- bzr clone lp:~hudson-openstack/nova/milestone-proposed/ $CACHEDIR/opt/nova |
|
| 69 |
- git clone https://github.com/cloudbuilders/openstackx.git $CACHEDIR/opt/openstackx |
|
| 70 |
- git clone https://github.com/cloudbuilders/noVNC.git $CACHEDIR/opt/noVNC |
|
| 71 |
- git clone https://github.com/cloudbuilders/openstack-dashboard.git $CACHEDIR/opt/dash |
|
| 72 |
- git clone https://github.com/cloudbuilders/python-novaclient.git $CACHEDIR/opt/python-novaclient |
|
| 73 |
- git clone https://github.com/cloudbuilders/keystone.git $CACHEDIR/opt/keystone |
|
| 74 |
- git clone https://github.com/cloudbuilders/glance.git $CACHEDIR/opt/glance |
|
| 66 |
+fi |
|
| 67 |
+ |
|
| 68 |
+# Cache openstack code |
|
| 69 |
+git_clone $NOVA_REPO $CACHEDIR/opt/nova $NOVA_BRANCH |
|
| 70 |
+git_clone $GLANCE_REPO $CACHEDIR/opt/glance $GLANCE_BRANCH |
|
| 71 |
+git_clone $KEYSTONE_REPO $CACHEDIR/opt/keystone $KEYSTONE_BRANCH |
|
| 72 |
+git_clone $NOVNC_REPO $CACHEDIR/opt/novnc $NOVNC_BRANCH |
|
| 73 |
+git_clone $DASH_REPO $CACHEDIR/opt/dash $DASH_BRANCH $DASH_TAG |
|
| 74 |
+git_clone $NIXON_REPO $CACHEDIR/opt/nixon $NIXON_BRANCH |
|
| 75 |
+git_clone $NOVACLIENT_REPO $CACHEDIR/opt/python-novaclient $NOVACLIENT_BRANCH |
|
| 76 |
+git_clone $OPENSTACKX_REPO $CACHEDIR/opt/openstackx $OPENSTACKX_BRANCH |
|
| 77 |
+git_clone $MUNIN_REPO $CACHEDIR/opt/openstack-munin $MUNIN_BRANCH |
|
| 78 |
+ |
|
| 79 |
+# Use this version of devstack? |
|
| 80 |
+if [ "$USE_CURRENT_DEVSTACK" = "1" ]; then |
|
| 81 |
+ rm -rf $CACHEDIR/opt/devstack |
|
| 82 |
+ cp -pr . $CACHEDIR/opt/devstack |
|
| 75 | 83 |
fi |
| 76 | 84 |
|
| 77 | 85 |
# Destroy the old container |
| ... | ... |
@@ -1,5 +1,15 @@ |
| 1 | 1 |
#!/bin/bash |
| 2 | 2 |
|
| 3 |
+# Use stackrc.example if stackrc is missing |
|
| 4 |
+if [ ! -e ./stackrc ]; then |
|
| 5 |
+ read -n1 -p "No stackrc present. Copy stackrc.example to stackrc? (y/n) " |
|
| 6 |
+ echo |
|
| 7 |
+ [[ $REPLY = [yY] ]] && cp stackrc.example stackrc|| { echo "Aborting: Missing stackrc"; exit 1; }
|
|
| 8 |
+fi |
|
| 9 |
+ |
|
| 10 |
+# Source params |
|
| 11 |
+source ./stackrc |
|
| 12 |
+ |
|
| 3 | 13 |
# TODO: make dest not hardcoded |
| 4 | 14 |
|
| 5 | 15 |
NAME=$1 |
| ... | ... |
@@ -15,13 +25,15 @@ if [ ! -d proto ]; then |
| 15 | 15 |
chroot proto apt-get update |
| 16 | 16 |
chroot proto apt-get install -y `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"` |
| 17 | 17 |
chroot proto pip install `cat files/pips/*` |
| 18 |
- git clone https://github.com/cloudbuilders/nova.git proto/opt/nova |
|
| 19 |
- git clone https://github.com/cloudbuilders/openstackx.git proto/opt/openstackx |
|
| 20 |
- git clone https://github.com/cloudbuilders/noVNC.git proto/opt/noVNC |
|
| 21 |
- git clone https://github.com/cloudbuilders/openstack-dashboard.git proto/opt/dash |
|
| 22 |
- git clone https://github.com/cloudbuilders/python-novaclient.git proto/opt/python-novaclient |
|
| 23 |
- git clone https://github.com/cloudbuilders/keystone.git proto/opt/keystone |
|
| 24 |
- git clone https://github.com/cloudbuilders/glance.git proto/opt/glance |
|
| 18 |
+ git_clone $NOVA_REPO proto/opt/nova $NOVA_BRANCH |
|
| 19 |
+ git_clone $GLANCE_REPO proto/opt/glance $GLANCE_BRANCH |
|
| 20 |
+ git_clone $KEYSTONE_REPO proto/opt/keystone $KEYSTONE_BRANCH |
|
| 21 |
+ git_clone $NOVNC_REPO proto/opt/novnc $NOVNC_BRANCH |
|
| 22 |
+ git_clone $DASH_REPO proto/opt/dash $DASH_BRANCH $DASH_TAG |
|
| 23 |
+ git_clone $NIXON_REPO proto/opt/nixon $NIXON_BRANCH |
|
| 24 |
+ git_clone $NOVACLIENT_REPO proto/opt/python-novaclient $NOVACLIENT_BRANCH |
|
| 25 |
+ git_clone $OPENSTACKX_REPO proto/opt/openstackx $OPENSTACKX_BRANCH |
|
| 26 |
+ git_clone $MUNIN_REPO proto/opt/openstack-munin $MUNIN_BRANCH |
|
| 25 | 27 |
chroot proto mkdir -p /opt/files |
| 26 | 28 |
wget -c http://images.ansolabs.com/tty.tgz -O proto/opt/files/tty.tgz |
| 27 | 29 |
fi |
| ... | ... |
@@ -59,6 +59,16 @@ set -o errexit |
| 59 | 59 |
# an error. It is also useful for following allowing as the install occurs. |
| 60 | 60 |
set -o xtrace |
| 61 | 61 |
|
| 62 |
+# Use stackrc.example if stackrc is missing |
|
| 63 |
+if [ ! -e ./stackrc ]; then |
|
| 64 |
+ read -n1 -p "No stackrc present. Copy stackrc.example to stackrc? (y/n) " |
|
| 65 |
+ echo |
|
| 66 |
+ [[ $REPLY = [yY] ]] && cp stackrc.example stackrc|| { echo "Aborting: Missing stackrc"; exit 1; }
|
|
| 67 |
+fi |
|
| 68 |
+ |
|
| 69 |
+# Import variables |
|
| 70 |
+source ./stackrc |
|
| 71 |
+ |
|
| 62 | 72 |
# Destination path for installation ``DEST`` |
| 63 | 73 |
DEST=${DEST:-/opt}
|
| 64 | 74 |
|
| ... | ... |
@@ -69,7 +79,7 @@ NIXON_DIR=$DEST/dash/openstack-dashboard/dashboard/nixon |
| 69 | 69 |
GLANCE_DIR=$DEST/glance |
| 70 | 70 |
KEYSTONE_DIR=$DEST/keystone |
| 71 | 71 |
NOVACLIENT_DIR=$DEST/python-novaclient |
| 72 |
-API_DIR=$DEST/openstackx |
|
| 72 |
+OPENSTACKX_DIR=$DEST/openstackx |
|
| 73 | 73 |
NOVNC_DIR=$DEST/noVNC |
| 74 | 74 |
MUNIN_DIR=$DEST/openstack-munin |
| 75 | 75 |
|
| ... | ... |
@@ -141,34 +151,31 @@ function git_clone {
|
| 141 | 141 |
sudo mkdir $2 |
| 142 | 142 |
sudo chown `whoami` $2 |
| 143 | 143 |
git clone $1 $2 |
| 144 |
+ cd $2 |
|
| 145 |
+ # This checkout syntax works for both branches and tags |
|
| 146 |
+ git checkout $3 |
|
| 144 | 147 |
fi |
| 145 | 148 |
} |
| 146 | 149 |
|
| 147 | 150 |
# compute service |
| 148 |
-# FIXME - need to factor out these repositories |
|
| 149 |
-# git_clone https://github.com/cloudbuilders/nova.git $NOVA_DIR |
|
| 150 |
-if [ ! -d $NOVA_DIR ]; then |
|
| 151 |
- bzr clone lp:~hudson-openstack/nova/milestone-proposed/ $NOVA_DIR |
|
| 152 |
-fi |
|
| 151 |
+git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH |
|
| 153 | 152 |
# image catalog service |
| 154 |
-git_clone https://github.com/cloudbuilders/glance.git $GLANCE_DIR |
|
| 153 |
+git_clone $GLANCE_REPO $GLANCE_DIR $GLANCE_BRANCH |
|
| 155 | 154 |
# unified auth system (manages accounts/tokens) |
| 156 |
-git_clone https://github.com/cloudbuilders/keystone.git $KEYSTONE_DIR |
|
| 155 |
+git_clone $KEYSTONE_REPO $KEYSTONE_DIR $KEYSTONE_BRANCH |
|
| 157 | 156 |
# a websockets/html5 or flash powered VNC console for vm instances |
| 158 |
-git_clone https://github.com/cloudbuilders/noVNC.git $NOVNC_DIR |
|
| 157 |
+git_clone $NOVNC_REPO $NOVNC_DIR $NOVNC_BRANCH |
|
| 159 | 158 |
# django powered web control panel for openstack |
| 160 |
-git_clone https://github.com/cloudbuilders/openstack-dashboard.git $DASH_DIR |
|
| 161 |
-# FIXME - need to factor out logic like this |
|
| 162 |
-cd $DASH_DIR && sudo git fetch && sudo git checkout origin/keystone_diablo |
|
| 159 |
+git_clone $DASH_REPO $DASH_DIR $DASH_BRANCH $DASH_TAG |
|
| 163 | 160 |
# add nixon, will use this to show munin graphs in dashboard |
| 164 |
-git_clone https://github.com/cloudbuilders/nixon.git $NIXON_DIR |
|
| 161 |
+git_clone $NIXON_REPO $NIXON_DIR $NIXON_BRANCH |
|
| 165 | 162 |
# python client library to nova that dashboard (and others) use |
| 166 |
-git_clone https://github.com/cloudbuilders/python-novaclient.git $NOVACLIENT_DIR |
|
| 163 |
+git_clone $NOVACLIENT_REPO $NOVACLIENT_DIR $NOVACLIENT_BRANCH |
|
| 167 | 164 |
# openstackx is a collection of extensions to openstack.compute & nova |
| 168 | 165 |
# that is *deprecated*. The code is being moved into python-novaclient & nova. |
| 169 |
-git_clone https://github.com/cloudbuilders/openstackx.git $API_DIR |
|
| 166 |
+git_clone $OPENSTACKX_REPO $OPENSTACKX_DIR $OPENSTACKX_BRANCH |
|
| 170 | 167 |
# openstack-munin is a collection of munin plugins for monitoring the stack |
| 171 |
-git_clone https://github.com/cloudbuilders/openstack-munin.git $MUNIN_DIR |
|
| 168 |
+git_clone $MUNIN_REPO $MUNIN_DIR $MUNIN_BRANCH |
|
| 172 | 169 |
|
| 173 | 170 |
# Initialization |
| 174 | 171 |
# ============== |
| ... | ... |
@@ -180,7 +187,7 @@ cd $NOVA_DIR; sudo python setup.py develop |
| 180 | 180 |
cd $NOVACLIENT_DIR; sudo python setup.py develop |
| 181 | 181 |
cd $KEYSTONE_DIR; sudo python setup.py develop |
| 182 | 182 |
cd $GLANCE_DIR; sudo python setup.py develop |
| 183 |
-cd $API_DIR; sudo python setup.py develop |
|
| 183 |
+cd $OPENSTACKX_DIR; sudo python setup.py develop |
|
| 184 | 184 |
cd $DASH_DIR/django-openstack; sudo python setup.py develop |
| 185 | 185 |
cd $DASH_DIR/openstack-dashboard; sudo python setup.py develop |
| 186 | 186 |
|
| ... | ... |
@@ -356,7 +363,7 @@ add_nova_flag "--public_interface=$PUBLIC_INTERFACE" |
| 356 | 356 |
add_nova_flag "--vlan_interface=$VLAN_INTERFACE" |
| 357 | 357 |
add_nova_flag "--sql_connection=$BASE_SQL_CONN/nova" |
| 358 | 358 |
add_nova_flag "--libvirt_type=$LIBVIRT_TYPE" |
| 359 |
-add_nova_flag "--osapi_extensions_path=$API_DIR/extensions" |
|
| 359 |
+add_nova_flag "--osapi_extensions_path=$OPENSTACKX_DIR/extensions" |
|
| 360 | 360 |
add_nova_flag "--vncproxy_url=http://$HOST_IP:6080" |
| 361 | 361 |
add_nova_flag "--vncproxy_wwwroot=$NOVNC_DIR/" |
| 362 | 362 |
add_nova_flag "--api_paste_config=$KEYSTONE_DIR/examples/paste/nova-api-paste.ini" |
| 363 | 363 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,36 @@ |
| 0 |
+# compute service |
|
| 1 |
+NOVA_REPO=https://github.com/openstack/nova.git |
|
| 2 |
+NOVA_BRANCH=2011.3 |
|
| 3 |
+ |
|
| 4 |
+# image catalog service |
|
| 5 |
+GLANCE_REPO=https://github.com/cloudbuilders/glance.git |
|
| 6 |
+GLANCE_BRANCH=diablo |
|
| 7 |
+ |
|
| 8 |
+# unified auth system (manages accounts/tokens) |
|
| 9 |
+KEYSTONE_REPO=https://github.com/cloudbuilders/keystone.git |
|
| 10 |
+KEYSTONE_BRANCH=diablo |
|
| 11 |
+ |
|
| 12 |
+# a websockets/html5 or flash powered VNC console for vm instances |
|
| 13 |
+NOVNC_REPO=https://github.com/cloudbuilders/noVNC.git |
|
| 14 |
+NOVNC_BRANCH=master |
|
| 15 |
+ |
|
| 16 |
+# django powered web control panel for openstack |
|
| 17 |
+DASH_REPO=https://github.com/cloudbuilders/openstack-dashboard.git |
|
| 18 |
+DASH_BRANCH=master |
|
| 19 |
+ |
|
| 20 |
+# add nixon, will use this to show munin graphs in dashboard |
|
| 21 |
+NIXON_REPO=https://github.com/cloudbuilders/nixon.git |
|
| 22 |
+NIXON_BRANCH=diablo |
|
| 23 |
+ |
|
| 24 |
+# python client library to nova that dashboard (and others) use |
|
| 25 |
+NOVACLIENT_REPO=https://github.com/cloudbuilders/python-novaclient.git |
|
| 26 |
+NOVACLIENT_BRANCH=master |
|
| 27 |
+ |
|
| 28 |
+# openstackx is a collection of extensions to openstack.compute & nova |
|
| 29 |
+# that is *deprecated*. The code is being moved into python-novaclient & nova. |
|
| 30 |
+OPENSTACKX_REPO=https://github.com/cloudbuilders/openstackx.git |
|
| 31 |
+OPENSTACKX_BRANCH=diablo |
|
| 32 |
+ |
|
| 33 |
+# openstack-munin is a collection of munin plugins for monitoring the stack |
|
| 34 |
+MUNIN_REPO=https://github.com/cloudbuilders/openstack-munin.git |
|
| 35 |
+MUNIN_BRANCH=master |