... | ... |
@@ -22,6 +22,7 @@ CONTAINER_NETMASK=${CONTAINER_NETMASK:-255.255.255.0} |
22 | 22 |
CONTAINER_GATEWAY=${CONTAINER_GATEWAY:-192.168.1.1} |
23 | 23 |
NAMESERVER=${NAMESERVER:-$CONTAINER_GATEWAY} |
24 | 24 |
COPYENV=${COPYENV:-1} |
25 |
+DEST=${DEST:-/opt/stack} |
|
25 | 26 |
|
26 | 27 |
# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova" |
27 | 28 |
STACKSH_PARAMS=${STACKSH_PARAMS:-} |
... | ... |
@@ -94,21 +95,27 @@ if [ ! -d $CACHEDIR ]; then |
94 | 94 |
chroot $CACHEDIR pip install `cat files/pips/*` |
95 | 95 |
fi |
96 | 96 |
|
97 |
+# Clean out code repos if directed to do so |
|
98 |
+if [ "$CLEAN" = "1" ]; then |
|
99 |
+ rm -rf $NOVA_REPO $CACHEDIR/$DEST |
|
100 |
+fi |
|
101 |
+ |
|
97 | 102 |
# Cache openstack code |
98 |
-git_clone $NOVA_REPO $CACHEDIR/opt/nova $NOVA_BRANCH |
|
99 |
-git_clone $GLANCE_REPO $CACHEDIR/opt/glance $GLANCE_BRANCH |
|
100 |
-git_clone $KEYSTONE_REPO $CACHEDIR/opt/keystone $KEYSTONE_BRANCH |
|
101 |
-git_clone $NOVNC_REPO $CACHEDIR/opt/novnc $NOVNC_BRANCH |
|
102 |
-git_clone $DASH_REPO $CACHEDIR/opt/dash $DASH_BRANCH $DASH_TAG |
|
103 |
-git_clone $NIXON_REPO $CACHEDIR/opt/nixon $NIXON_BRANCH |
|
104 |
-git_clone $NOVACLIENT_REPO $CACHEDIR/opt/python-novaclient $NOVACLIENT_BRANCH |
|
105 |
-git_clone $OPENSTACKX_REPO $CACHEDIR/opt/openstackx $OPENSTACKX_BRANCH |
|
106 |
-git_clone $MUNIN_REPO $CACHEDIR/opt/openstack-munin $MUNIN_BRANCH |
|
103 |
+mkdir -p $CACHEDIR/$DEST |
|
104 |
+git_clone $NOVA_REPO $CACHEDIR/$DEST/nova $NOVA_BRANCH |
|
105 |
+git_clone $GLANCE_REPO $CACHEDIR/$DEST/glance $GLANCE_BRANCH |
|
106 |
+git_clone $KEYSTONE_REPO $CACHEDIR/$DESTkeystone $KEYSTONE_BRANCH |
|
107 |
+git_clone $NOVNC_REPO $CACHEDIR/$DEST/novnc $NOVNC_BRANCH |
|
108 |
+git_clone $DASH_REPO $CACHEDIR/$DEST/dash $DASH_BRANCH $DASH_TAG |
|
109 |
+git_clone $NIXON_REPO $CACHEDIR/$DEST/nixon $NIXON_BRANCH |
|
110 |
+git_clone $NOVACLIENT_REPO $CACHEDIR/$DEST/python-novaclient $NOVACLIENT_BRANCH |
|
111 |
+git_clone $OPENSTACKX_REPO $CACHEDIR/$DEST/openstackx $OPENSTACKX_BRANCH |
|
112 |
+git_clone $MUNIN_REPO $CACHEDIR/$DEST/openstack-munin $MUNIN_BRANCH |
|
107 | 113 |
|
108 | 114 |
# Use this version of devstack? |
109 | 115 |
if [ "$USE_CURRENT_DEVSTACK" = "1" ]; then |
110 |
- rm -rf $CACHEDIR/opt/devstack |
|
111 |
- cp -pr $CWD $CACHEDIR/opt/devstack |
|
116 |
+ rm -rf $CACHEDIR/$DEST/devstack |
|
117 |
+ cp -pr $CWD $CACHEDIR/$DEST/devstack |
|
112 | 118 |
fi |
113 | 119 |
|
114 | 120 |
# Destroy the old container |
... | ... |
@@ -128,7 +135,7 @@ ROOTFS=/var/lib/lxc/$CONTAINER/rootfs/ |
128 | 128 |
# Create a stack user that is a member of the libvirtd group so that stack |
129 | 129 |
# is able to interact with libvirt. |
130 | 130 |
chroot $ROOTFS groupadd libvirtd |
131 |
-chroot $ROOTFS useradd stack -s /bin/bash -d /opt -G libvirtd |
|
131 |
+chroot $ROOTFS useradd stack -s /bin/bash -d $DEST -G libvirtd |
|
132 | 132 |
|
133 | 133 |
# a simple password - pass |
134 | 134 |
echo stack:pass | chroot $ROOTFS chpasswd |
... | ... |
@@ -151,19 +158,19 @@ function cp_it { |
151 | 151 |
|
152 | 152 |
# Copy over your ssh keys and env if desired |
153 | 153 |
if [ "$COPYENV" = "1" ]; then |
154 |
- cp_it ~/.ssh $ROOTFS/opt/.ssh |
|
155 |
- cp_it ~/.ssh/id_rsa.pub $ROOTFS/opt/.ssh/authorized_keys |
|
156 |
- cp_it ~/.gitconfig $ROOTFS/opt/.gitconfig |
|
157 |
- cp_it ~/.vimrc $ROOTFS/opt/.vimrc |
|
158 |
- cp_it ~/.bashrc $ROOTFS/opt/.bashrc |
|
154 |
+ cp_it ~/.ssh $ROOTFS/$DEST/.ssh |
|
155 |
+ cp_it ~/.ssh/id_rsa.pub $ROOTFS/$DEST/.ssh/authorized_keys |
|
156 |
+ cp_it ~/.gitconfig $ROOTFS/$DEST/.gitconfig |
|
157 |
+ cp_it ~/.vimrc $ROOTFS/$DEST/.vimrc |
|
158 |
+ cp_it ~/.bashrc $ROOTFS/$DEST/.bashrc |
|
159 | 159 |
fi |
160 | 160 |
|
161 | 161 |
# Make our ip address hostnames look nice at the command prompt |
162 |
-echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/opt/.bashrc |
|
162 |
+echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/$DEST/.bashrc |
|
163 | 163 |
echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/etc/profile |
164 | 164 |
|
165 |
-# Give stack ownership over /opt so it may do the work needed |
|
166 |
-chroot $ROOTFS chown -R stack /opt |
|
165 |
+# Give stack ownership over /$DEST so it may do the work needed |
|
166 |
+chroot $ROOTFS chown -R stack /$DEST |
|
167 | 167 |
|
168 | 168 |
# Configure instance network |
169 | 169 |
INTERFACES=$ROOTFS/etc/network/interfaces |
... | ... |
@@ -179,7 +186,7 @@ iface eth0 inet static |
179 | 179 |
EOF |
180 | 180 |
|
181 | 181 |
# Configure the runner |
182 |
-RUN_SH=$ROOTFS/opt/run.sh |
|
182 |
+RUN_SH=$ROOTFS/$DEST/run.sh |
|
183 | 183 |
cat > $RUN_SH <<EOF |
184 | 184 |
#!/usr/bin/env bash |
185 | 185 |
# Make sure dns is set up |
... | ... |
@@ -192,10 +199,10 @@ killall screen |
192 | 192 |
# Install and run stack.sh |
193 | 193 |
sudo apt-get update |
194 | 194 |
sudo apt-get -y --force-yes install git-core vim-nox sudo |
195 |
-if [ ! -d "/opt/devstack" ]; then |
|
196 |
- git clone git://github.com/cloudbuilders/devstack.git /opt/devstack |
|
195 |
+if [ ! -d "/$DEST/devstack" ]; then |
|
196 |
+ git clone git://github.com/cloudbuilders/devstack.git /$DEST/devstack |
|
197 | 197 |
fi |
198 |
-cd /opt/devstack && $STACKSH_PARAMS ./stack.sh > /opt/run.sh.log |
|
198 |
+cd /$DEST/devstack && $STACKSH_PARAMS ./stack.sh > /$DEST/run.sh.log |
|
199 | 199 |
EOF |
200 | 200 |
|
201 | 201 |
# Make the run.sh executable |
... | ... |
@@ -205,7 +212,7 @@ chmod 755 $RUN_SH |
205 | 205 |
RC_LOCAL=$ROOTFS/etc/rc.local |
206 | 206 |
cat > $RC_LOCAL <<EOF |
207 | 207 |
#!/bin/sh -e |
208 |
-su -c "/opt/run.sh" stack |
|
208 |
+su -c "/$DEST/run.sh" stack |
|
209 | 209 |
EOF |
210 | 210 |
|
211 | 211 |
# Configure cgroup directory |
... | ... |
@@ -12,7 +12,7 @@ default_store = sqlite |
12 | 12 |
|
13 | 13 |
# Log to this file. Make sure you do not set the same log |
14 | 14 |
# file for both the API and registry servers! |
15 |
-log_file = /opt/keystone/keystone.log |
|
15 |
+log_file = %DEST%/keystone/keystone.log |
|
16 | 16 |
|
17 | 17 |
# List of backends to be configured |
18 | 18 |
backends = keystone.backends.sqlalchemy |
... | ... |
@@ -70,7 +70,9 @@ fi |
70 | 70 |
source ./stackrc |
71 | 71 |
|
72 | 72 |
# Destination path for installation ``DEST`` |
73 |
-DEST=${DEST:-/opt} |
|
73 |
+DEST=${DEST:-/opt/stack} |
|
74 |
+sudo mkdir -p $DEST |
|
75 |
+sudo chown `whoami` $DEST |
|
74 | 76 |
|
75 | 77 |
# Set the destination directories for openstack projects |
76 | 78 |
NOVA_DIR=$DEST/nova |
... | ... |
@@ -405,6 +407,7 @@ if [[ "$ENABLED_SERVICES" =~ "key" ]]; then |
405 | 405 |
KEYSTONE_CONF=$KEYSTONE_DIR/etc/keystone.conf |
406 | 406 |
cp $FILES/keystone.conf $KEYSTONE_CONF |
407 | 407 |
sudo sed -e "s,%SQL_CONN%,$BASE_SQL_CONN/keystone,g" -i $KEYSTONE_CONF |
408 |
+ sudo sed -e "s,%DEST%,$DEST,g" -i $KEYSTONE_CONF |
|
408 | 409 |
|
409 | 410 |
KEYSTONE_DATA=$KEYSTONE_DIR/bin/keystone_data.sh |
410 | 411 |
cp $FILES/keystone_data.sh $KEYSTONE_DATA |
... | ... |
@@ -12,6 +12,7 @@ usage() { |
12 | 12 |
|
13 | 13 |
HOST=${HOST:-localhost} |
14 | 14 |
PORT=${PORT:-9292} |
15 |
+DEST=${DEST:-/opt/stack} |
|
15 | 16 |
|
16 | 17 |
while getopts h:p: c; do |
17 | 18 |
case $c in |
... | ... |
@@ -59,14 +60,14 @@ esac |
59 | 59 |
|
60 | 60 |
GLANCE=`which glance` |
61 | 61 |
if [ -z "$GLANCE" ]; then |
62 |
- if [ -x "/opt/glance/bin/glance" ]; then |
|
62 |
+ if [ -x "$DEST/glance/bin/glance" ]; then |
|
63 | 63 |
# Look for stack.sh's install |
64 |
- GLANCE="/opt/glance/bin/glance" |
|
64 |
+ GLANCE="$DEST/glance/bin/glance" |
|
65 | 65 |
else |
66 |
- # Install Glance client in /opt |
|
66 |
+ # Install Glance client in $DEST |
|
67 | 67 |
echo "Glance not found, must install client" |
68 | 68 |
OWD=`pwd` |
69 |
- cd /opt |
|
69 |
+ cd $DEST |
|
70 | 70 |
sudo apt-get install python-pip python-eventlet python-routes python-greenlet python-argparse python-sqlalchemy python-wsgiref python-pastedeploy python-xattr |
71 | 71 |
sudo pip install kombu |
72 | 72 |
sudo git clone https://github.com/cloudbuilders/glance.git |