diff --git a/build_pxe_ramdisk.sh b/build_pxe_ramdisk.sh new file mode 100755 index 0000000..0f598f8 --- /dev/null +++ b/build_pxe_ramdisk.sh @@ -0,0 +1,108 @@ +#!/bin/bash + +if [ ! "$#" -eq "1" ]; then + echo "$0 builds a gziped natty openstack install" + echo "usage: $0 dest" + exit 1 +fi + +# Source params +source ./stackrc + +# clean install of natty +if [ ! -d natty-base ]; then + debootstrap natty natty-base + # copy kernel modules... + # NOTE(ja): is there a better way to do this? + cp -pr /lib/modules/`uname -r` proto/lib/modules + cp files/sources.list natty-base/etc/apt/sources.list + chroot natty-base apt-get update +fi + +# prime natty with as many apt/pips as we can +if [ ! -d primed ]; then + rsync -azH natty-base/ primed/ + chroot primed apt-get install -y `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"` + chroot primed pip install `cat files/pips/*` + + # Create a stack user that is a member of the libvirtd group so that stack + # is able to interact with libvirt. + chroot primed groupadd libvirtd + chroot primed useradd stack -s /bin/bash -d /opt -G libvirtd + + # a simple password - pass + echo stack:pass | chroot primed chpasswd + + # and has sudo ability (in the future this should be limited to only what + # stack requires) + echo "stack ALL=(ALL) NOPASSWD: ALL" >> primed/etc/sudoers +fi + +# clone git repositories onto the system +# ====================================== + +if [ ! -d cloned ]; then + rsync -azH primed/ cloned/ +fi + +# git clone only if directory doesn't exist already. Since ``DEST`` might not +# be owned by the installation user, we create the directory and change the +# ownership to the proper user. +function git_clone { + + # clone new copy or fetch latest changes + CHECKOUT=cloned$2 + if [ ! -d $CHECKOUT ]; then + mkdir -p $CHECKOUT + git clone $1 $CHECKOUT + else + pushd $CHECKOUT + git fetch + popd + fi + + # FIXME(ja): checkout specified version (should works for branches and tags) + + pushd $CHECKOUT + # checkout the proper branch/tag + git checkout $3 + # force our local version to be the same as the remote version + git reset --hard origin/$3 + popd + + # give ownership to the stack user + chroot cloned/ chown -R stack $2 +} + +git_clone $NOVA_REPO /opt/stack/nova $NOVA_BRANCH +git_clone $GLANCE_REPO /opt/stack/glance $GLANCE_BRANCH +git_clone $KEYSTONE_REPO /opt/stack/keystone $KEYSTONE_BRANCH +git_clone $NOVNC_REPO /opt/stack/novnc $NOVNC_BRANCH +git_clone $DASH_REPO /opt/stack/dash $DASH_BRANCH +git_clone $NIXON_REPO /opt/stack/nixon $NIXON_BRANCH +git_clone $NOVACLIENT_REPO /opt/stack/python-novaclient $NOVACLIENT_BRANCH +git_clone $OPENSTACKX_REPO /opt/stack/openstackx $OPENSTACKX_BRANCH +git_clone $MUNIN_REPO /opt/stack/openstack-munin $MUNIN_BRANCH + +# build a new image +BASE=build.$$ +IMG=$BASE.img +MNT=$BASE/ + +# create a 2GB blank filesystem +dd if=/dev/zero of=$IMG bs=1024k count=2048 +# force it to be initialized as ext2 +mkfs.ext2 -F $IMG + +# mount blank image loopback and load it +mkdir -p $MNT +mount -o loop $IMG $MNT +rsync -azH cloned/ $MNT + +# umount and cleanup +umount $MNT +rmdir $MNT + +# gzip into final location +gzip -1 $IMG -c > $1 + diff --git a/files/000-default.template b/files/000-default.template index cb4585b..4e4b5c4 100644 --- a/files/000-default.template +++ b/files/000-default.template @@ -1,8 +1,8 @@ WSGIScriptAlias / %DASH_DIR%/openstack-dashboard/dashboard/wsgi/django.wsgi - WSGIDaemonProcess dashboard user=stack group=stack processes=3 threads=10 - SetEnv APACHE_RUN_USER stack - SetEnv APACHE_RUN_GROUP stack + WSGIDaemonProcess dashboard user=%USER% group=%USER% processes=3 threads=10 + SetEnv APACHE_RUN_USER %USER% + SetEnv APACHE_RUN_GROUP %USER% WSGIProcessGroup dashboard DocumentRoot %DASH_DIR%/.blackhole/ diff --git a/files/apts/novnc b/files/apts/novnc new file mode 100644 index 0000000..c8722b9 --- /dev/null +++ b/files/apts/novnc @@ -0,0 +1 @@ +python-numpy diff --git a/stack.sh b/stack.sh index 7ecbc83..f21b371 100755 --- a/stack.sh +++ b/stack.sh @@ -241,6 +241,7 @@ if [[ "$ENABLED_SERVICES" =~ "dash" ]]; then ## Configure apache's 000-default to run dashboard sudo cp $FILES/000-default.template /etc/apache2/sites-enabled/000-default + sudo sed -e "s,%USER%,$USER,g" -i /etc/apache2/sites-enabled/000-default sudo sed -e "s,%DASH_DIR%,$DASH_DIR,g" -i /etc/apache2/sites-enabled/000-default fi @@ -461,8 +462,7 @@ fi screen_it n-cpu "cd $NOVA_DIR && echo $NOVA_DIR/bin/nova-compute | newgrp libvirtd" screen_it n-net "cd $NOVA_DIR && $NOVA_DIR/bin/nova-network" screen_it n-sch "cd $NOVA_DIR && $NOVA_DIR/bin/nova-scheduler" -# nova-vncproxy binds a privileged port, and so needs sudo -screen_it n-vnc "cd $NOVA_DIR && sudo $NOVA_DIR/bin/nova-vncproxy" +screen_it n-vnc "cd $NOVNC_DIR && ./utils/nova-wsproxy.py 6080 --web ." screen_it dash "cd $DASH_DIR && sudo /etc/init.d/apache2 restart; sudo tail -f /var/log/apache2/error.log" # Install Images