From 6c4464e1743e789286a6f1e34bf1113b6c38f247 Mon Sep 17 00:00:00 2001 From: blsaws Date: Fri, 1 Apr 2016 16:35:34 -0700 Subject: Add parameter check; add echo statements JIRA: COPPER-4 Change-Id: I25307c2b915715a4fdc4d6a1fda37ded50219b1a Signed-off-by: blsaws (cherry picked from commit 5b745412d7d43467b5e0019c10b57596786c4779) --- .../setup/install_congress_testserver_1.sh | 21 ++++++++--- .../setup/install_congress_testserver_2.sh | 43 ++++++++++------------ 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/components/congress/test-webapp/setup/install_congress_testserver_1.sh b/components/congress/test-webapp/setup/install_congress_testserver_1.sh index 9342bc7..2c65464 100644 --- a/components/congress/test-webapp/setup/install_congress_testserver_1.sh +++ b/components/congress/test-webapp/setup/install_congress_testserver_1.sh @@ -28,22 +28,33 @@ # Create and Activate the Container # Earlier versions of the JOID installer installed lxc and created local templates # but now we have to get the ubuntu template from the controller -set -x +if [ $# -lt 2 ]; then + echo 1>&2 "$0: arguments required " + return 2 +fi + +if [ $1 == "debug" ]; then set -x #echo on +fi + +echo "Install prerequisites" sudo apt-get install -y lxc +echo "Copy lxc-ubuntu container from the controller" juju scp ubuntu@$1:/usr/share/lxc/templates/lxc-ubuntu ~/lxc-ubuntu sudo cp ~/lxc-ubuntu /usr/share/lxc/templates/lxc-ubuntu +echo "Create the trusty-copper container" sudo lxc-create -n trusty-copper -t /usr/share/lxc/templates/lxc-ubuntu -l DEBUG -- -b $2 ~/$2 +echo "Start trusty-copper" sudo lxc-start -n trusty-copper -d if (($? > 0)); then echo Error starting trusty-copper lxc container return fi -# Get the CONGRESS_HOST value from env.sh +echo "Get the CONGRESS_HOST value from env.sh" source ~/env.sh -# Get the copper server address +echo "Get trusty-copper address" sleep 5 export COPPER_HOST="" while [ "$COPPER_HOST" == "" ]; do @@ -52,7 +63,7 @@ while [ "$COPPER_HOST" == "" ]; do done echo COPPER_HOST = $COPPER_HOST -# Create the environment file +echo "Create the environment file" cat <~/env.sh export COPPER_HOST=$COPPER_HOST export CONGRESS_HOST=$CONGRESS_HOST @@ -64,7 +75,7 @@ export NEUTRON_HOST=$(juju status --format=short | awk "/neutron-api\/0/ { print export NOVA_HOST=$(juju status --format=short | awk "/nova-cloud-controller\/0/ { print \$3 }") EOF -# Invoke install_congress_testserver_2.sh +echo "Invoke install_congress_testserver_2.sh on trusty-copper" ssh -t -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $2@$COPPER_HOST "source ~/git/copper/components/congress/test-webapp/setup/install_congress_testserver_2.sh; exit" set +x diff --git a/components/congress/test-webapp/setup/install_congress_testserver_2.sh b/components/congress/test-webapp/setup/install_congress_testserver_2.sh index 009ff5e..98fdcd2 100644 --- a/components/congress/test-webapp/setup/install_congress_testserver_2.sh +++ b/components/congress/test-webapp/setup/install_congress_testserver_2.sh @@ -22,27 +22,27 @@ # How to use: # $ source ~/git/copper/tests/setup/install_congress_testserver_1.sh -# Setup OpenStack environment variables per your OPNFV install +echo "Setup OpenStack environment variables per your OPNFV install" source ~/env.sh source ~/admin-openrc.sh < +echo "Setup the Congress Test Webappp" -# === Setup the Congress Test Webapp === - -# -# Clone Copper (if not already cloned in user home) +echo "Clone Copper" cd ~/coppertest/git git clone https://gerrit.opnfv.org/gerrit/copper -# Install Apache, PHP +echo "Install Apache, PHP" sudo apt-get install -y apache2 php5 libapache2-mod-php5 sudo /etc/init.d/apache2 restart -# Copy the Apache config +echo "Copy the Apache config" sudo cp ~/coppertest/git/copper/components/congress/test-webapp/www/ubuntu-apache2.conf /etc/apache2/apache2.conf -# Copy the webapp to the Apache root directory and fix permissions +echo "Copy the webapp to the Apache root directory and fix permissions" sudo cp -R ~/coppertest/git/copper/components/congress/test-webapp/www/html /var/www sudo chmod 755 /var/www/html -R -# Point copper.js to the trusty-copper server per your install +echo "Point copper.js to the trusty-copper server per your install" sudo sed -i -- "s/COPPER_HOST/$COPPER_HOST/g" /var/www/html/copper.js -# Point proxy.php to the Congress server per your install +echo "Point proxy.php to the Congress server per your install" sudo sed -i -- "s/CONGRESS_HOST/$CONGRESS_HOST/g" /var/www/html/proxy/index.php -# Make webapp log directory and set permissions +echo "Make webapp log directory and set permissions" mkdir ~/coppertest/logs chmod 777 ~/coppertest/logs -# Restart Apache +echo "Restart Apache" sudo service apache2 restart set +x -- cgit 1.2.3-korg