diff options
3 files changed, 62 insertions, 132 deletions
diff --git a/components/congress/test-webapp/setup/clean_congress_testserver.sh b/components/congress/test-webapp/setup/clean_congress_testserver.sh index 4376edc..4148751 100755 --- a/components/congress/test-webapp/setup/clean_congress_testserver.sh +++ b/components/congress/test-webapp/setup/clean_congress_testserver.sh @@ -14,25 +14,19 @@ # limitations under the License. # # This is a cleanup script for installation of the Congress testserver -# on an Ubuntu 14.04 LXC container in the jumphost. -# Presumably something has failed, and any record of the testserver -# needs to be removed, so you can try the install again. +# as installed under JOID or Apex (Fuel and Compass not yet verified). +# Prequisite: OPFNV installed per JOID or Apex installer # On jumphost: -# source ~/clean_congress_testserver.sh <debug> -# <debug> indicates whether to turn on command echoing - -source ~/admin-openrc.sh <<EOF -openstack -EOF - -source ~/env.sh - -if [ $# -gt 0 ]; then - if [ $1 == "debug" ]; then set -x #echo on - fi -fi - -sudo lxc-stop --name trusty-copper -sudo lxc-destroy --name trusty-copper -rm -rf ~/coppertest +# - Congress installed through install_congress_1.sh +# How to use: +# Retrieve the testserver uninstall script as below +# $ wget https://git.opnfv.org/cgit/copper/plain/components/congress/test-webapp/setup/clean_congress_testserver.sh +# $ source clean_congress_testserver.sh +set -x +echo "Get copper-webapp container ID" +CID=$(sudo docker ps | awk "/copper-webapp/ { print \$1 }") +echo "Stop copper-webapp container" +sudo docker stop $CID +echo "Remove copper-webapp container" +sudo docker rm $CID set +x diff --git a/components/congress/test-webapp/setup/install_congress_cli_test_environment.sh b/components/congress/test-webapp/setup/install_congress_cli_test_environment.sh index 17cd293..c072a02 100644 --- a/components/congress/test-webapp/setup/install_congress_cli_test_environment.sh +++ b/components/congress/test-webapp/setup/install_congress_cli_test_environment.sh @@ -24,118 +24,34 @@ # How to use: # Retrieve the copper install script as below, optionally specifying the # branch to use as a URL parameter, e.g. ?h=stable%2Fbrahmaputra -# $ wget https://git.opnfv.org/cgit/copper/tree/components/congress/test-webapp/setup/install_congress_cli_test_environment.sh -# $ source install_congress_testserver.sh [copper-branch openstack-branch] -# optionally specifying the branch identifier to use for copper and OpenStack +# $ wget https://git.opnfv.org/cgit/copper/plain/components/congress/test-webapp/setup/install_congress_cli_test_environment.sh +# $ source install_congress_cli_test_environment.sh [copper-branch] +# optionally specifying the branch identifier to use for copper set -x -if [ $# -eq 1 ]; then - echo 1>&2 "$0: specify both copper-branch and openstack-branch" - set +x - return 2 -fi -if [ $# -eq 2 ]; then - cubranch=$1 - osbranch=$2 -fi +if [ $# -eq 1 ]; then cubranch=$1; fi -cubranch=$1 -osbranch=$2 - -echo "Install prerequisites" +echo "Copy environment files to /tmp/copper" +if [ ! -d /tmp/copper ]; then mkdir /tmp/copper; fi dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'` - if [ "$dist" == "Ubuntu" ]; then - echo "Update the base server" - set -x - sudo apt-get update - #apt-get -y upgrade - echo "Install pip" - sudo apt-get install -y python-pip - echo "Install java" - sudo apt-get install -y default-jre - echo "Install other dependencies" - apt-get install -y git gcc python-dev libxml2 libxslt1-dev libzip-dev php5-curl + cp ~/congress/env.sh /tmp/copper/ + cp ~/congress/admin-openrc.sh /tmp/copper/ else - echo "Add epel repo" - sudo yum install epel-release -y - echo "install pip" - sudo yum install python-pip -y - echo "install other dependencies" - sudo yum install apg git gcc libxml2 python-devel libzip-devel libxslt-devel -y + echo "Copy copper environment files" + sudo scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no stack@192.0.2.1:/home/stack/congress/*.sh /tmp/copper fi -echo "Install python dependencies" -sudo pip install --upgrade pip virtualenv setuptools pbr tox - -echo "Create virtualenv" -mkdir /tmp/copper -cd /tmp/copper -virtualenv venv -source venv/bin/activate - echo "Clone copper" -git clone https://gerrit.opnfv.org/gerrit/copper -cd copper -if [ $# -eq 2 ]; then git checkout $1; fi - -echo "Setup OpenStack environment variables per your OPNFV install" -source env.sh -source admin-openrc.sh - -echo "Clone congress" -git clone https://github.com/openstack/congress.git -cd congress -if [ $# -eq 2 ]; then git checkout $2; fi - -echo "Install OpenStack client" -cd /tmp/copper -git clone https://github.com/openstack/python-openstackclient.git -cd python-openstackclient -if [ $# -eq 2 ]; then git checkout $2; fi -pip install -r requirements.txt -pip install . - -echo "Install Congress client" -cd /tmp/copper -git clone https://github.com/openstack/python-congressclient.git -cd python-congressclient -if [ $# -eq 2 ]; then git checkout $2; fi -pip install -r requirements.txt -pip install . - -echo "Install Glance client" -cd /tmp/copper -git clone https://github.com/openstack/python-glanceclient.git -cd python-glanceclient -if [ $# -eq 2 ]; then git checkout $2; fi -pip install -r requirements.txt -pip install . - -echo "Install Neutron client" -cd /tmp/copper -git clone https://github.com/openstack/python-neutronclient.git -cd python-neutronclient -if [ $# -eq 2 ]; then git checkout $2; fi -pip install -r requirements.txt -pip install . - -echo "Install Nova client" -cd /tmp/copper -git clone https://github.com/openstack/python-novaclient.git -cd python-novaclient -if [ $# -eq 2 ]; then git checkout $2; fi -pip install -r requirements.txt -pip install . - -echo "Install Keystone client" -cd /tmp/copper -git clone https://github.com/openstack/python-keystoneclient.git -cd python-keystoneclient -if [ $# -eq 2 ]; then git checkout $2; fi -pip install -r requirements.txt -pip install . +if [ ! -d /tmp/copper/copper ]; then + cd /tmp/copper + git clone https://gerrit.opnfv.org/gerrit/copper + cd copper + if [ $# -eq 1 ]; then git checkout $1; fi +else + echo "/tmp/copper exists: run 'rm -rf /tmp/copper' to start clean if needed" +fi cd /tmp/copper/copper/tests ls diff --git a/components/congress/test-webapp/setup/install_congress_testserver.sh b/components/congress/test-webapp/setup/install_congress_testserver.sh index ce89faf..a513929 100644 --- a/components/congress/test-webapp/setup/install_congress_testserver.sh +++ b/components/congress/test-webapp/setup/install_congress_testserver.sh @@ -24,7 +24,7 @@ # How to use: # Retrieve the copper install script as below, optionally specifying the # branch to use as a URL parameter, e.g. ?h=stable%2Fbrahmaputra -# $ wget https://git.opnfv.org/cgit/copper/tree/components/congress/test-webapp/setup/install_congress_testserver.sh +# $ wget https://git.opnfv.org/cgit/copper/plain/components/congress/test-webapp/setup/install_congress_testserver.sh # $ source install_congress_testserver.sh [copper-branch] # optionally specifying the branch identifier to use for copper @@ -36,9 +36,22 @@ echo "Install prerequisites" dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'` if [ "$dist" == "Ubuntu" ]; then - sudo apt-get install -y docker - cp env.sh /tmp/copper/ - cp admin-openrc.sh /tmp/copper/ + # Docker setup procedure from https://docs.docker.com/engine/installation/linux/ubuntulinux/ + echo "Install docker and prerequisites" + sudo apt-get update + sudo apt-get install -y apt-transport-https ca-certificates + sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D + sudo tee /etc/apt/sources.list.d/docker.list <<- 'EOF' +deb https://apt.dockerproject.org/repo ubuntu-trusty main +EOF + sudo apt-get update + sudo apt-get purge lxc-docker + apt-cache policy docker-engine + sudo apt-get install -y linux-image-extra-$(uname -r) + sudo apt-get install -y docker docker-engine + echo "Copy copper environment files" + cp ~/congress/env.sh /tmp/copper/ + cp ~/congress/admin-openrc.sh /tmp/copper/ else sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] @@ -48,19 +61,26 @@ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF + echo "Copy copper environment files" sudo scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no stack@192.0.2.1:/home/stack/congress/*.sh /tmp/copper fi echo "Clone copper" -if [ ! -d /tmp/copper ]; then mkdir /tmp/copper; fi -cd /tmp/copper -if [ -d copper ]; then rm -rf copper -git clone https://gerrit.opnfv.org/gerrit/copper; fi -cd copper -if [ $# -eq 1 ]; then git checkout $1; fi +if [ ! -d /tmp/copper ]; then + mkdir /tmp/copper + cd /tmp/copper + git clone https://gerrit.opnfv.org/gerrit/copper + cd copper + if [ $# -eq 1 ]; then git checkout $1; fi +else + echo "/tmp/copper exists: run 'rm -rf /tmp/copper' to start clean if needed" +fi sudo service docker start +echo "Setup copper environment" +source /tmp/copper/env.sh + echo "Setup webapp files" if [ ! -d /tmp/copper/log ]; then mkdir /tmp/copper/log; fi source /tmp/copper/env.sh |