From 4d28218954ce9e7e4425bfd6f51da3b5d3b9ba2a Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Fri, 16 Sep 2011 11:27:43 -0700 Subject: [PATCH 1/2] move apts/pips to files directory --- build_lxc.sh | 4 ++-- build_nfs.sh | 11 +++++------ {apts => files/apts}/dash | 0 {apts => files/apts}/general | 0 {apts => files/apts}/glance | 0 {apts => files/apts}/keystone | 0 {apts => files/apts}/nova | 0 {apts => files/apts}/preseed | 0 {pips => files/pips}/dash | 0 stack.sh | 30 +++++++++++++++--------------- 10 files changed, 22 insertions(+), 23 deletions(-) rename {apts => files/apts}/dash (100%) rename {apts => files/apts}/general (100%) rename {apts => files/apts}/glance (100%) rename {apts => files/apts}/keystone (100%) rename {apts => files/apts}/nova (100%) rename {apts => files/apts}/preseed (100%) rename {pips => files/pips}/dash (100%) diff --git a/build_lxc.sh b/build_lxc.sh index b5de23266c..c1ab995b0c 100755 --- a/build_lxc.sh +++ b/build_lxc.sh @@ -55,8 +55,8 @@ if [ ! -d $CACHEDIR ]; then # trigger the initial debootstrap lxc-create -n $CONTAINER -t natty -f $LXC_CONF chroot $CACHEDIR apt-get update - chroot $CACHEDIR apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"` - chroot $CACHEDIR pip install `cat pips/*` + chroot $CACHEDIR apt-get install -y `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"` + chroot $CACHEDIR pip install `cat files/pips/*` git clone https://github.com/cloudbuilders/nova.git $CACHEDIR/opt/nova git clone https://github.com/cloudbuilders/openstackx.git $CACHEDIR/opt/openstackx git clone https://github.com/cloudbuilders/noVNC.git $CACHEDIR/opt/noVNC diff --git a/build_nfs.sh b/build_nfs.sh index 6509011d9d..180a6e5a10 100755 --- a/build_nfs.sh +++ b/build_nfs.sh @@ -13,8 +13,8 @@ if [ ! -d proto ]; then debootstrap natty proto cp files/sources.list proto/etc/apt/sources.list chroot proto apt-get update - chroot proto apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"` - chroot proto pip install `cat pips/*` + chroot proto apt-get install -y `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"` + chroot proto pip install `cat files/pips/*` git clone https://github.com/cloudbuilders/nova.git proto/opt/nova git clone https://github.com/cloudbuilders/openstackx.git proto/opt/openstackx git clone https://github.com/cloudbuilders/noVNC.git proto/opt/noVNC @@ -34,14 +34,13 @@ echo "127.0.0.1 localhost $NAME" > $DEST/etc/hosts # copy kernel modules cp -pr /lib/modules/`uname -r` $DEST/lib/modules -# inject stack.sh files -cp -r files $DEST/opt/files # copy openstack installer and requirement lists to a new directory. mkdir -p $DEST/opt + +# inject stack.sh and dependant files +cp -r files $DEST/opt/files cp stack.sh $DEST/opt/stack.sh -cp -r pips $DEST/opt -cp -r apts $DEST/opt # injecting root's public ssh key if it exists if [ -f /root/.ssh/id_rsa.pub ]; then diff --git a/apts/dash b/files/apts/dash similarity index 100% rename from apts/dash rename to files/apts/dash diff --git a/apts/general b/files/apts/general similarity index 100% rename from apts/general rename to files/apts/general diff --git a/apts/glance b/files/apts/glance similarity index 100% rename from apts/glance rename to files/apts/glance diff --git a/apts/keystone b/files/apts/keystone similarity index 100% rename from apts/keystone rename to files/apts/keystone diff --git a/apts/nova b/files/apts/nova similarity index 100% rename from apts/nova rename to files/apts/nova diff --git a/apts/preseed b/files/apts/preseed similarity index 100% rename from apts/preseed rename to files/apts/preseed diff --git a/pips/dash b/files/pips/dash similarity index 100% rename from pips/dash rename to files/pips/dash diff --git a/stack.sh b/stack.sh index ebd8f02f3b..d71503c836 100755 --- a/stack.sh +++ b/stack.sh @@ -21,12 +21,12 @@ if ! grep -q natty /etc/lsb-release; then fi fi -# stack.sh keeps the list of **apt** and **pip** dependencies in files. -# Additionally we have a few config templates and other useful files useful -# installation. They are needed to be located at ``apts``, ``files`` and -# ``pips`` in the ``DEVSTACK`` directory (next to this script). -DEVSTACK=`pwd` -if [ ! -d $DEVSTACK/apts ] || [ ! -d $DEVSTACK/files ] || [ ! -d $DEVSTACK/pips ]; then +# stack.sh keeps the list of **apt** and **pip** dependencies in external +# files, along with config templates and other useful files. You can find these +# in the ``files`` directory (next to this script). We will reference this +# directory using the ``DEVSTACK`` variable in this script. +DEVSTACK=`pwd`/files +if [ ! -d $DEVSTACK ]; then echo "ERROR: missing devstack files - did you grab more than just stack.sh?" exit 1 fi @@ -164,7 +164,7 @@ cd $DASH_DIR/openstack-dashboard; sudo python setup.py develop # Add a useful screenrc. This isn't required to run openstack but is we do # it since we are going to run the services in screen for simple -cp $DEVSTACK/files/screenrc ~/.screenrc +cp $DEVSTACK/screenrc ~/.screenrc ## TODO: update current user to allow sudo for all commands in files/sudo/* @@ -208,7 +208,7 @@ if [[ "$ENABLED_SERVICES" =~ "dash" ]]; then cd $DASH_DIR/openstack-dashboard # Includes settings for Nixon, to expose munin charts. - sudo cp $DEVSTACK/files/dash_settings.py local/local_settings.py + sudo cp $DEVSTACK/dash_settings.py local/local_settings.py dashboard/manage.py syncdb @@ -216,12 +216,12 @@ if [[ "$ENABLED_SERVICES" =~ "dash" ]]; then sudo mkdir -p $DASH_DIR/.blackhole ## Configure apache's 000-default to run dashboard - sudo cp $DEVSTACK/files/000-default.template /etc/apache2/sites-enabled/000-default + sudo cp $DEVSTACK/000-default.template /etc/apache2/sites-enabled/000-default sudo sed -e "s,%DASH_DIR%,$DASH_DIR,g" -i /etc/apache2/sites-enabled/000-default - # ``python setup.py develop`` left some files owned by root in ``DASH_DIR`` and - # others by the original owner. We need to change the owner to apache so - # dashboard can run + # ``python setup.py develop`` left some files owned by root in ``DASH_DIR`` + # and others are owned by the user you are using to run this script. + # We need to change the owner to apache for dashboard to run. sudo chown -R www-data:www-data $DASH_DIR fi @@ -271,7 +271,7 @@ if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then mysql -u$MYSQL_USER -p$MYSQL_PASS -e 'CREATE DATABASE glance;' # Copy over our glance-registry.conf GLANCE_CONF=$GLANCE_DIR/etc/glance-registry.conf - cp $DEVSTACK/files/glance-registry.conf $GLANCE_CONF + cp $DEVSTACK/glance-registry.conf $GLANCE_CONF sudo sed -e "s,%SQL_CONN%,$BASE_SQL_CONN/glance,g" -i $GLANCE_CONF fi @@ -367,11 +367,11 @@ if [[ "$ENABLED_SERVICES" =~ "key" ]]; then # FIXME (anthony) keystone should use keystone.conf.example KEYSTONE_CONF=$KEYSTONE_DIR/etc/keystone.conf - cp $DEVSTACK/files/keystone.conf $KEYSTONE_CONF + cp $DEVSTACK/keystone.conf $KEYSTONE_CONF sudo sed -e "s,%SQL_CONN%,$BASE_SQL_CONN/keystone,g" -i $KEYSTONE_CONF # initialize keystone with default users/endpoints - BIN_DIR=$KEYSTONE_DIR/bin bash $DEVSTACK/files/keystone_data.sh + BIN_DIR=$KEYSTONE_DIR/bin bash $DEVSTACK/keystone_data.sh fi From bf3868d889564f716e293fa3180c7c199bfe893a Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Fri, 16 Sep 2011 11:31:16 -0700 Subject: [PATCH 2/2] use variable FILES instead of DEVSTACK --- stack.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/stack.sh b/stack.sh index d71503c836..93b665abea 100755 --- a/stack.sh +++ b/stack.sh @@ -24,10 +24,10 @@ fi # stack.sh keeps the list of **apt** and **pip** dependencies in external # files, along with config templates and other useful files. You can find these # in the ``files`` directory (next to this script). We will reference this -# directory using the ``DEVSTACK`` variable in this script. -DEVSTACK=`pwd`/files -if [ ! -d $DEVSTACK ]; then - echo "ERROR: missing devstack files - did you grab more than just stack.sh?" +# directory using the ``FILES`` variable in this script. +FILES=`pwd`/files +if [ ! -d $FILES ]; then + echo "ERROR: missing devstack/files - did you grab more than just stack.sh?" exit 1 fi @@ -117,10 +117,10 @@ mysql-server-5.1 mysql-server/start_on_boot boolean true MYSQL_PRESEED # install apt requirements -sudo apt-get install -y -q `cat $DEVSTACK/apts/* | cut -d\# -f1 | grep -Ev "mysql-server|rabbitmq-server"` +sudo apt-get install -y -q `cat $FILES/apts/* | cut -d\# -f1 | grep -Ev "mysql-server|rabbitmq-server"` # install python requirements -sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install `cat $DEVSTACK/pips/*` +sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install `cat $FILES/pips/*` # git clone only if directory doesn't exist already function git_clone { @@ -164,7 +164,7 @@ cd $DASH_DIR/openstack-dashboard; sudo python setup.py develop # Add a useful screenrc. This isn't required to run openstack but is we do # it since we are going to run the services in screen for simple -cp $DEVSTACK/screenrc ~/.screenrc +cp $FILES/screenrc ~/.screenrc ## TODO: update current user to allow sudo for all commands in files/sudo/* @@ -208,7 +208,7 @@ if [[ "$ENABLED_SERVICES" =~ "dash" ]]; then cd $DASH_DIR/openstack-dashboard # Includes settings for Nixon, to expose munin charts. - sudo cp $DEVSTACK/dash_settings.py local/local_settings.py + sudo cp $FILES/dash_settings.py local/local_settings.py dashboard/manage.py syncdb @@ -216,7 +216,7 @@ if [[ "$ENABLED_SERVICES" =~ "dash" ]]; then sudo mkdir -p $DASH_DIR/.blackhole ## Configure apache's 000-default to run dashboard - sudo cp $DEVSTACK/000-default.template /etc/apache2/sites-enabled/000-default + sudo cp $FILES/000-default.template /etc/apache2/sites-enabled/000-default sudo sed -e "s,%DASH_DIR%,$DASH_DIR,g" -i /etc/apache2/sites-enabled/000-default # ``python setup.py develop`` left some files owned by root in ``DASH_DIR`` @@ -271,7 +271,7 @@ if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then mysql -u$MYSQL_USER -p$MYSQL_PASS -e 'CREATE DATABASE glance;' # Copy over our glance-registry.conf GLANCE_CONF=$GLANCE_DIR/etc/glance-registry.conf - cp $DEVSTACK/glance-registry.conf $GLANCE_CONF + cp $FILES/glance-registry.conf $GLANCE_CONF sudo sed -e "s,%SQL_CONN%,$BASE_SQL_CONN/glance,g" -i $GLANCE_CONF fi @@ -367,11 +367,11 @@ if [[ "$ENABLED_SERVICES" =~ "key" ]]; then # FIXME (anthony) keystone should use keystone.conf.example KEYSTONE_CONF=$KEYSTONE_DIR/etc/keystone.conf - cp $DEVSTACK/keystone.conf $KEYSTONE_CONF + cp $FILES/keystone.conf $KEYSTONE_CONF sudo sed -e "s,%SQL_CONN%,$BASE_SQL_CONN/keystone,g" -i $KEYSTONE_CONF # initialize keystone with default users/endpoints - BIN_DIR=$KEYSTONE_DIR/bin bash $DEVSTACK/keystone_data.sh + BIN_DIR=$KEYSTONE_DIR/bin bash $FILES/keystone_data.sh fi