| 1 | 1 |
new file mode 100755 |
| ... | ... |
@@ -0,0 +1,108 @@ |
| 0 |
+#!/bin/bash |
|
| 1 |
+ |
|
| 2 |
+if [ ! "$#" -eq "1" ]; then |
|
| 3 |
+ echo "$0 builds a gziped natty openstack install" |
|
| 4 |
+ echo "usage: $0 dest" |
|
| 5 |
+ exit 1 |
|
| 6 |
+fi |
|
| 7 |
+ |
|
| 8 |
+# Source params |
|
| 9 |
+source ./stackrc |
|
| 10 |
+ |
|
| 11 |
+# clean install of natty |
|
| 12 |
+if [ ! -d natty-base ]; then |
|
| 13 |
+ debootstrap natty natty-base |
|
| 14 |
+ # copy kernel modules... |
|
| 15 |
+ # NOTE(ja): is there a better way to do this? |
|
| 16 |
+ cp -pr /lib/modules/`uname -r` proto/lib/modules |
|
| 17 |
+ cp files/sources.list natty-base/etc/apt/sources.list |
|
| 18 |
+ chroot natty-base apt-get update |
|
| 19 |
+fi |
|
| 20 |
+ |
|
| 21 |
+# prime natty with as many apt/pips as we can |
|
| 22 |
+if [ ! -d primed ]; then |
|
| 23 |
+ rsync -azH natty-base/ primed/ |
|
| 24 |
+ chroot primed apt-get install -y `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"` |
|
| 25 |
+ chroot primed pip install `cat files/pips/*` |
|
| 26 |
+ |
|
| 27 |
+ # Create a stack user that is a member of the libvirtd group so that stack |
|
| 28 |
+ # is able to interact with libvirt. |
|
| 29 |
+ chroot primed groupadd libvirtd |
|
| 30 |
+ chroot primed useradd stack -s /bin/bash -d /opt -G libvirtd |
|
| 31 |
+ |
|
| 32 |
+ # a simple password - pass |
|
| 33 |
+ echo stack:pass | chroot primed chpasswd |
|
| 34 |
+ |
|
| 35 |
+ # and has sudo ability (in the future this should be limited to only what |
|
| 36 |
+ # stack requires) |
|
| 37 |
+ echo "stack ALL=(ALL) NOPASSWD: ALL" >> primed/etc/sudoers |
|
| 38 |
+fi |
|
| 39 |
+ |
|
| 40 |
+# clone git repositories onto the system |
|
| 41 |
+# ====================================== |
|
| 42 |
+ |
|
| 43 |
+if [ ! -d cloned ]; then |
|
| 44 |
+ rsync -azH primed/ cloned/ |
|
| 45 |
+fi |
|
| 46 |
+ |
|
| 47 |
+# git clone only if directory doesn't exist already. Since ``DEST`` might not |
|
| 48 |
+# be owned by the installation user, we create the directory and change the |
|
| 49 |
+# ownership to the proper user. |
|
| 50 |
+function git_clone {
|
|
| 51 |
+ |
|
| 52 |
+ # clone new copy or fetch latest changes |
|
| 53 |
+ CHECKOUT=cloned$2 |
|
| 54 |
+ if [ ! -d $CHECKOUT ]; then |
|
| 55 |
+ mkdir -p $CHECKOUT |
|
| 56 |
+ git clone $1 $CHECKOUT |
|
| 57 |
+ else |
|
| 58 |
+ pushd $CHECKOUT |
|
| 59 |
+ git fetch |
|
| 60 |
+ popd |
|
| 61 |
+ fi |
|
| 62 |
+ |
|
| 63 |
+ # FIXME(ja): checkout specified version (should works for branches and tags) |
|
| 64 |
+ |
|
| 65 |
+ pushd $CHECKOUT |
|
| 66 |
+ # checkout the proper branch/tag |
|
| 67 |
+ git checkout $3 |
|
| 68 |
+ # force our local version to be the same as the remote version |
|
| 69 |
+ git reset --hard origin/$3 |
|
| 70 |
+ popd |
|
| 71 |
+ |
|
| 72 |
+ # give ownership to the stack user |
|
| 73 |
+ chroot cloned/ chown -R stack $2 |
|
| 74 |
+} |
|
| 75 |
+ |
|
| 76 |
+git_clone $NOVA_REPO /opt/stack/nova $NOVA_BRANCH |
|
| 77 |
+git_clone $GLANCE_REPO /opt/stack/glance $GLANCE_BRANCH |
|
| 78 |
+git_clone $KEYSTONE_REPO /opt/stack/keystone $KEYSTONE_BRANCH |
|
| 79 |
+git_clone $NOVNC_REPO /opt/stack/novnc $NOVNC_BRANCH |
|
| 80 |
+git_clone $DASH_REPO /opt/stack/dash $DASH_BRANCH |
|
| 81 |
+git_clone $NIXON_REPO /opt/stack/nixon $NIXON_BRANCH |
|
| 82 |
+git_clone $NOVACLIENT_REPO /opt/stack/python-novaclient $NOVACLIENT_BRANCH |
|
| 83 |
+git_clone $OPENSTACKX_REPO /opt/stack/openstackx $OPENSTACKX_BRANCH |
|
| 84 |
+git_clone $MUNIN_REPO /opt/stack/openstack-munin $MUNIN_BRANCH |
|
| 85 |
+ |
|
| 86 |
+# build a new image |
|
| 87 |
+BASE=build.$$ |
|
| 88 |
+IMG=$BASE.img |
|
| 89 |
+MNT=$BASE/ |
|
| 90 |
+ |
|
| 91 |
+# create a 2GB blank filesystem |
|
| 92 |
+dd if=/dev/zero of=$IMG bs=1024k count=2048 |
|
| 93 |
+# force it to be initialized as ext2 |
|
| 94 |
+mkfs.ext2 -F $IMG |
|
| 95 |
+ |
|
| 96 |
+# mount blank image loopback and load it |
|
| 97 |
+mkdir -p $MNT |
|
| 98 |
+mount -o loop $IMG $MNT |
|
| 99 |
+rsync -azH cloned/ $MNT |
|
| 100 |
+ |
|
| 101 |
+# umount and cleanup |
|
| 102 |
+umount $MNT |
|
| 103 |
+rmdir $MNT |
|
| 104 |
+ |
|
| 105 |
+# gzip into final location |
|
| 106 |
+gzip -1 $IMG -c > $1 |
|
| 107 |
+ |
| ... | ... |
@@ -1,8 +1,8 @@ |
| 1 | 1 |
<VirtualHost *:80> |
| 2 | 2 |
WSGIScriptAlias / %DASH_DIR%/openstack-dashboard/dashboard/wsgi/django.wsgi |
| 3 |
- WSGIDaemonProcess dashboard user=stack group=stack processes=3 threads=10 |
|
| 4 |
- SetEnv APACHE_RUN_USER stack |
|
| 5 |
- SetEnv APACHE_RUN_GROUP stack |
|
| 3 |
+ WSGIDaemonProcess dashboard user=%USER% group=%USER% processes=3 threads=10 |
|
| 4 |
+ SetEnv APACHE_RUN_USER %USER% |
|
| 5 |
+ SetEnv APACHE_RUN_GROUP %USER% |
|
| 6 | 6 |
WSGIProcessGroup dashboard |
| 7 | 7 |
|
| 8 | 8 |
DocumentRoot %DASH_DIR%/.blackhole/ |
| ... | ... |
@@ -241,6 +241,7 @@ if [[ "$ENABLED_SERVICES" =~ "dash" ]]; then |
| 241 | 241 |
|
| 242 | 242 |
## Configure apache's 000-default to run dashboard |
| 243 | 243 |
sudo cp $FILES/000-default.template /etc/apache2/sites-enabled/000-default |
| 244 |
+ sudo sed -e "s,%USER%,$USER,g" -i /etc/apache2/sites-enabled/000-default |
|
| 244 | 245 |
sudo sed -e "s,%DASH_DIR%,$DASH_DIR,g" -i /etc/apache2/sites-enabled/000-default |
| 245 | 246 |
fi |
| 246 | 247 |
|
| ... | ... |
@@ -461,8 +462,7 @@ fi |
| 461 | 461 |
screen_it n-cpu "cd $NOVA_DIR && echo $NOVA_DIR/bin/nova-compute | newgrp libvirtd" |
| 462 | 462 |
screen_it n-net "cd $NOVA_DIR && $NOVA_DIR/bin/nova-network" |
| 463 | 463 |
screen_it n-sch "cd $NOVA_DIR && $NOVA_DIR/bin/nova-scheduler" |
| 464 |
-# nova-vncproxy binds a privileged port, and so needs sudo |
|
| 465 |
-screen_it n-vnc "cd $NOVA_DIR && sudo $NOVA_DIR/bin/nova-vncproxy" |
|
| 464 |
+screen_it n-vnc "cd $NOVNC_DIR && ./utils/nova-wsproxy.py 6080 --web ." |
|
| 466 | 465 |
screen_it dash "cd $DASH_DIR && sudo /etc/init.d/apache2 restart; sudo tail -f /var/log/apache2/error.log" |
| 467 | 466 |
|
| 468 | 467 |
# Install Images |