Merge pull request #16 from cloudbuilders/opt_stack
install into /opt/stack instead of /opt by default
This commit is contained in:
commit
f446f5154f
4 changed files with 42 additions and 31 deletions
57
build_lxc.sh
57
build_lxc.sh
|
@ -22,6 +22,7 @@ CONTAINER_NETMASK=${CONTAINER_NETMASK:-255.255.255.0}
|
|||
CONTAINER_GATEWAY=${CONTAINER_GATEWAY:-192.168.1.1}
|
||||
NAMESERVER=${NAMESERVER:-$CONTAINER_GATEWAY}
|
||||
COPYENV=${COPYENV:-1}
|
||||
DEST=${DEST:-/opt/stack}
|
||||
|
||||
# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova"
|
||||
STACKSH_PARAMS=${STACKSH_PARAMS:-}
|
||||
|
@ -94,21 +95,27 @@ if [ ! -d $CACHEDIR ]; then
|
|||
chroot $CACHEDIR pip install `cat files/pips/*`
|
||||
fi
|
||||
|
||||
# Clean out code repos if directed to do so
|
||||
if [ "$CLEAN" = "1" ]; then
|
||||
rm -rf $CACHEDIR/$DEST
|
||||
fi
|
||||
|
||||
# Cache openstack code
|
||||
git_clone $NOVA_REPO $CACHEDIR/opt/nova $NOVA_BRANCH
|
||||
git_clone $GLANCE_REPO $CACHEDIR/opt/glance $GLANCE_BRANCH
|
||||
git_clone $KEYSTONE_REPO $CACHEDIR/opt/keystone $KEYSTONE_BRANCH
|
||||
git_clone $NOVNC_REPO $CACHEDIR/opt/novnc $NOVNC_BRANCH
|
||||
git_clone $DASH_REPO $CACHEDIR/opt/dash $DASH_BRANCH $DASH_TAG
|
||||
git_clone $NIXON_REPO $CACHEDIR/opt/nixon $NIXON_BRANCH
|
||||
git_clone $NOVACLIENT_REPO $CACHEDIR/opt/python-novaclient $NOVACLIENT_BRANCH
|
||||
git_clone $OPENSTACKX_REPO $CACHEDIR/opt/openstackx $OPENSTACKX_BRANCH
|
||||
git_clone $MUNIN_REPO $CACHEDIR/opt/openstack-munin $MUNIN_BRANCH
|
||||
mkdir -p $CACHEDIR/$DEST
|
||||
git_clone $NOVA_REPO $CACHEDIR/$DEST/nova $NOVA_BRANCH
|
||||
git_clone $GLANCE_REPO $CACHEDIR/$DEST/glance $GLANCE_BRANCH
|
||||
git_clone $KEYSTONE_REPO $CACHEDIR/$DESTkeystone $KEYSTONE_BRANCH
|
||||
git_clone $NOVNC_REPO $CACHEDIR/$DEST/novnc $NOVNC_BRANCH
|
||||
git_clone $DASH_REPO $CACHEDIR/$DEST/dash $DASH_BRANCH $DASH_TAG
|
||||
git_clone $NIXON_REPO $CACHEDIR/$DEST/nixon $NIXON_BRANCH
|
||||
git_clone $NOVACLIENT_REPO $CACHEDIR/$DEST/python-novaclient $NOVACLIENT_BRANCH
|
||||
git_clone $OPENSTACKX_REPO $CACHEDIR/$DEST/openstackx $OPENSTACKX_BRANCH
|
||||
git_clone $MUNIN_REPO $CACHEDIR/$DEST/openstack-munin $MUNIN_BRANCH
|
||||
|
||||
# Use this version of devstack?
|
||||
if [ "$USE_CURRENT_DEVSTACK" = "1" ]; then
|
||||
rm -rf $CACHEDIR/opt/devstack
|
||||
cp -pr $CWD $CACHEDIR/opt/devstack
|
||||
rm -rf $CACHEDIR/$DEST/devstack
|
||||
cp -pr $CWD $CACHEDIR/$DEST/devstack
|
||||
fi
|
||||
|
||||
# Destroy the old container
|
||||
|
@ -128,7 +135,7 @@ ROOTFS=/var/lib/lxc/$CONTAINER/rootfs/
|
|||
# Create a stack user that is a member of the libvirtd group so that stack
|
||||
# is able to interact with libvirt.
|
||||
chroot $ROOTFS groupadd libvirtd
|
||||
chroot $ROOTFS useradd stack -s /bin/bash -d /opt -G libvirtd
|
||||
chroot $ROOTFS useradd stack -s /bin/bash -d $DEST -G libvirtd
|
||||
|
||||
# a simple password - pass
|
||||
echo stack:pass | chroot $ROOTFS chpasswd
|
||||
|
@ -151,19 +158,19 @@ function cp_it {
|
|||
|
||||
# Copy over your ssh keys and env if desired
|
||||
if [ "$COPYENV" = "1" ]; then
|
||||
cp_it ~/.ssh $ROOTFS/opt/.ssh
|
||||
cp_it ~/.ssh/id_rsa.pub $ROOTFS/opt/.ssh/authorized_keys
|
||||
cp_it ~/.gitconfig $ROOTFS/opt/.gitconfig
|
||||
cp_it ~/.vimrc $ROOTFS/opt/.vimrc
|
||||
cp_it ~/.bashrc $ROOTFS/opt/.bashrc
|
||||
cp_it ~/.ssh $ROOTFS/$DEST/.ssh
|
||||
cp_it ~/.ssh/id_rsa.pub $ROOTFS/$DEST/.ssh/authorized_keys
|
||||
cp_it ~/.gitconfig $ROOTFS/$DEST/.gitconfig
|
||||
cp_it ~/.vimrc $ROOTFS/$DEST/.vimrc
|
||||
cp_it ~/.bashrc $ROOTFS/$DEST/.bashrc
|
||||
fi
|
||||
|
||||
# Make our ip address hostnames look nice at the command prompt
|
||||
echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/opt/.bashrc
|
||||
echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/$DEST/.bashrc
|
||||
echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/etc/profile
|
||||
|
||||
# Give stack ownership over /opt so it may do the work needed
|
||||
chroot $ROOTFS chown -R stack /opt
|
||||
# Give stack ownership over $DEST so it may do the work needed
|
||||
chroot $ROOTFS chown -R stack $DEST
|
||||
|
||||
# Configure instance network
|
||||
INTERFACES=$ROOTFS/etc/network/interfaces
|
||||
|
@ -179,7 +186,7 @@ iface eth0 inet static
|
|||
EOF
|
||||
|
||||
# Configure the runner
|
||||
RUN_SH=$ROOTFS/opt/run.sh
|
||||
RUN_SH=$ROOTFS/$DEST/run.sh
|
||||
cat > $RUN_SH <<EOF
|
||||
#!/usr/bin/env bash
|
||||
# Make sure dns is set up
|
||||
|
@ -192,10 +199,10 @@ killall screen
|
|||
# Install and run stack.sh
|
||||
sudo apt-get update
|
||||
sudo apt-get -y --force-yes install git-core vim-nox sudo
|
||||
if [ ! -d "/opt/devstack" ]; then
|
||||
git clone git://github.com/cloudbuilders/devstack.git /opt/devstack
|
||||
if [ ! -d "$DEST/devstack" ]; then
|
||||
git clone git://github.com/cloudbuilders/devstack.git $DEST/devstack
|
||||
fi
|
||||
cd /opt/devstack && $STACKSH_PARAMS ./stack.sh > /opt/run.sh.log
|
||||
cd $DEST/devstack && $STACKSH_PARAMS ./stack.sh > /$DEST/run.sh.log
|
||||
EOF
|
||||
|
||||
# Make the run.sh executable
|
||||
|
@ -205,7 +212,7 @@ chmod 755 $RUN_SH
|
|||
RC_LOCAL=$ROOTFS/etc/rc.local
|
||||
cat > $RC_LOCAL <<EOF
|
||||
#!/bin/sh -e
|
||||
su -c "/opt/run.sh" stack
|
||||
su -c "$DEST/run.sh" stack
|
||||
EOF
|
||||
|
||||
# Configure cgroup directory
|
||||
|
|
|
@ -12,7 +12,7 @@ default_store = sqlite
|
|||
|
||||
# Log to this file. Make sure you do not set the same log
|
||||
# file for both the API and registry servers!
|
||||
log_file = /opt/keystone/keystone.log
|
||||
log_file = %DEST%/keystone/keystone.log
|
||||
|
||||
# List of backends to be configured
|
||||
backends = keystone.backends.sqlalchemy
|
||||
|
|
5
stack.sh
5
stack.sh
|
@ -70,7 +70,9 @@ fi
|
|||
source ./stackrc
|
||||
|
||||
# Destination path for installation ``DEST``
|
||||
DEST=${DEST:-/opt}
|
||||
DEST=${DEST:-/opt/stack}
|
||||
sudo mkdir -p $DEST
|
||||
sudo chown `whoami` $DEST
|
||||
|
||||
# Set the destination directories for openstack projects
|
||||
NOVA_DIR=$DEST/nova
|
||||
|
@ -405,6 +407,7 @@ if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
|
|||
KEYSTONE_CONF=$KEYSTONE_DIR/etc/keystone.conf
|
||||
cp $FILES/keystone.conf $KEYSTONE_CONF
|
||||
sudo sed -e "s,%SQL_CONN%,$BASE_SQL_CONN/keystone,g" -i $KEYSTONE_CONF
|
||||
sudo sed -e "s,%DEST%,$DEST,g" -i $KEYSTONE_CONF
|
||||
|
||||
KEYSTONE_DATA=$KEYSTONE_DIR/bin/keystone_data.sh
|
||||
cp $FILES/keystone_data.sh $KEYSTONE_DATA
|
||||
|
|
|
@ -12,6 +12,7 @@ usage() {
|
|||
|
||||
HOST=${HOST:-localhost}
|
||||
PORT=${PORT:-9292}
|
||||
DEST=${DEST:-/opt/stack}
|
||||
|
||||
while getopts h:p: c; do
|
||||
case $c in
|
||||
|
@ -59,14 +60,14 @@ esac
|
|||
|
||||
GLANCE=`which glance`
|
||||
if [ -z "$GLANCE" ]; then
|
||||
if [ -x "/opt/glance/bin/glance" ]; then
|
||||
if [ -x "$DEST/glance/bin/glance" ]; then
|
||||
# Look for stack.sh's install
|
||||
GLANCE="/opt/glance/bin/glance"
|
||||
GLANCE="$DEST/glance/bin/glance"
|
||||
else
|
||||
# Install Glance client in /opt
|
||||
# Install Glance client in $DEST
|
||||
echo "Glance not found, must install client"
|
||||
OWD=`pwd`
|
||||
cd /opt
|
||||
cd $DEST
|
||||
sudo apt-get install python-pip python-eventlet python-routes python-greenlet python-argparse python-sqlalchemy python-wsgiref python-pastedeploy python-xattr
|
||||
sudo pip install kombu
|
||||
sudo git clone https://github.com/cloudbuilders/glance.git
|
||||
|
|
Loading…
Reference in a new issue