diff options
Diffstat (limited to 'components/congress')
3 files changed, 137 insertions, 102 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 400d27e..88d9b8b 100644 --- a/components/congress/test-webapp/setup/install_congress_testserver_1.sh +++ b/components/congress/test-webapp/setup/install_congress_testserver_1.sh @@ -19,7 +19,7 @@ # Prequisite: OPFNV installed per JOID or Apex installer # On jumphost: # - Congress installed through install_congress_1.sh -# - ~/env.sh created as part of Congress install (install_congress_1.sh) +# - ~/congress/env.sh created as part of Congress install (install_congress_1.sh) # How to use: # $ source install_congress_testserver_1.sh [<controller_hostname>] # If provided, <controller_hostname> is the name of the controller node in MAAS @@ -42,43 +42,35 @@ if [ "$dist" == "Ubuntu" ]; then fi 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 copper container" sudo lxc-create -n copper -t /usr/share/lxc/templates/lxc-ubuntu -l DEBUG -- -b $USER ~/$USER -else - sudo yum install -y epel-release - sudo yum install -y debootstrap perl - sudo yum install -y lxc lxc-templates - sudo systemctl start lxc.service - echo "Create the copper container" - brctl addbr virbr0 - # TODO: this is not yet working - need additional config - sudo lxc-create -t download -n copper -- -d ubuntu -r trusty -a amd64 -- -b $USER ~/$USER -fi -echo "Start copper" -sudo lxc-start -n copper -d -if (($? > 0)); then - echo Error starting copper lxc container - return -fi + echo "Start copper" + sudo lxc-start -n copper -d + if (($? > 0)); then + echo Error starting copper lxc container + return + fi -echo "Get the CONGRESS_HOST value from env.sh" -source ~/env.sh + echo "Get the CONGRESS_HOST value from env.sh" + source ~/congress/env.sh -echo "Get copper address" -sleep 5 -export COPPER_HOST="" -while [ "$COPPER_HOST" == "" ]; do + echo "Get copper address" sleep 5 - export COPPER_HOST=$(sudo lxc-info --name copper | grep IP | awk "/ / { print \$2 }") -done -echo COPPER_HOST = $COPPER_HOST + export COPPER_HOST="" + while [ "$COPPER_HOST" == "" ]; do + sleep 5 + export COPPER_HOST=$(sudo lxc-info --name copper | grep IP | awk "/ / { print \$2 }") + done + echo COPPER_HOST = $COPPER_HOST -echo "Create the environment file" -cat <<EOF >~/env.sh + echo "Create the environment file" + cat <<EOF >~/congress/env.sh export COPPER_HOST=$COPPER_HOST export CONGRESS_HOST=$CONGRESS_HOST export KEYSTONE_HOST=$KEYSTONE_HOST @@ -89,7 +81,29 @@ export NEUTRON_HOST=$NEUTRON_HOST export NOVA_HOST=$NOVA_HOST EOF -echo "Invoke install_congress_testserver_2.sh on copper" -ssh -t -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $USER@$COPPER_HOST "source ~/git/copper/components/congress/test-webapp/setup/install_congress_testserver_2.sh; exit" + echo "Invoke install_congress_testserver_2.sh on copper" + ssh -t -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $USER@$COPPER_HOST "source ~/git/copper/components/congress/test-webapp/setup/install_congress_testserver_2.sh; exit" + +else + sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' +[dockerrepo] +name=Docker Repository +baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/ +enabled=1 +gpgcheck=1 +gpgkey=https://yum.dockerproject.org/gpg +EOF + sudo yum install -y docker-engine + sudo service docker start + sudo docker pull centos + mkdir /tmp/copper + cp ~/congress/*.sh /tmp/copper + cp -r ~/git/copper/components/congress/test-webapp/* /tmp/copper/ + CID=$(sudo docker run -d -t centos -P --name copper -v /tmp/copper:/opt/copper centos source ~/git/copper/components/congress/test-webapp/setup/install_congress_testserver_2.sh) +# CIP=$(sudo docker inspect $CID | grep IPAddress | cut -d '"' -f 4 | tail -1) +# sudo docker attach $CID + +fi + 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 0f9ee57..1dc8119 100644 --- a/components/congress/test-webapp/setup/install_congress_testserver_2.sh +++ b/components/congress/test-webapp/setup/install_congress_testserver_2.sh @@ -19,119 +19,140 @@ # Prequisite: OPFNV installed per JOID or Apex installer # On jumphost: # - Congress installed through install_congress_1.sh -# - ~/env.sh created as part of Congress install (install_congress_1.sh) # How to use: -# $ source install_congress_testserver_1.sh [<controller_hostname>] -# If provided, <controller_hostname> is the name of the controller node in MAAS -# (the parameter is not used for Apex-based installs) +# $ source install_congress_testserver_1.sh + +set -x echo "Setup OpenStack environment variables per your OPNFV install" -source ~/env.sh -source ~/admin-openrc.sh <<EOF -openstack -EOF +source /opt/copper/env.sh +source /opt/copper/admin-openrc.sh -echo "Update the base server" -set -x -sudo apt-get update -#sudo apt-get -y upgrade +echo "Install prerequisites" +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 + #sudo 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" + sudo apt-get install -y git gcc python-dev libxml2 libxslt1-dev libzip-dev php5-curl + + echo "Install Apache, PHP" + sudo apt-get install -y apache2 php5 libapache2-mod-php5 + + echo "Setup the Congress Test Webappp" + + echo "Copy the Apache config" + sudo cp /opt/copper/www/ubuntu-apache2.conf /etc/apache2/apache2.conf + + echo "Copy the webapp to the Apache root directory and fix permissions" + sudo cp -R /opt/copper/www/html /var/www + sudo chmod 755 /var/www/html -R + + 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 + + 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 + + echo "Make webapp log directory" + mkdir /tmp/copper/log + + sudo /etc/init.d/apache2 restart + +else + + 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 "Install pip" -sudo apt-get install -y python-pip + echo "Install Apache, PHP" + sudo yum install -y httpd php -echo "Install java" -sudo apt-get install -y default-jre + echo "Setup the Congress Test Webappp" -echo "Install other dependencies" -sudo apt-get install -y git gcc python-dev libxml2 libxslt1-dev libzip-dev php5-curl + echo "Copy the Apache config" + sudo cp /opt/copper/www/centos-httpd.conf /etc/httpd/conf/httpd.conf -echo "Install and test OpenStack client" -mkdir ~/coppertest -mkdir ~/coppertest/git -cd ~/coppertest/git + echo "Copy the webapp to the Apache root directory and fix permissions" + sudo cp -R /opt/copper/www/html/* /var/www/html + sudo chmod 755 /var/www/html -R + + 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 + + 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 + + echo "Make webapp log directory" + mkdir /tmp/copper/log + + sudo systemctl restart httpd.service + +fi + +echo "Install python dependencies" +sudo pip install --upgrade pip setuptools pbr tox + +echo "Install OpenStack client" +mkdir /opt/copper/git +cd /opt/copper/git git clone https://github.com/openstack/python-openstackclient.git cd python-openstackclient git checkout stable/liberty sudo pip install -r requirements.txt sudo pip install . -openstack service list -echo "Install and test Congress client" -cd ~/coppertest/git +echo "Install Congress client" +cd /opt/copper/git git clone https://github.com/openstack/python-congressclient.git cd python-congressclient git checkout stable/liberty sudo pip install -r requirements.txt sudo pip install . -openstack congress driver list -echo "Install and test Glance client" -cd ~/coppertest/git +echo "Install Glance client" +cd /opt/copper/git git clone https://github.com/openstack/python-glanceclient.git cd python-glanceclient git checkout stable/liberty sudo pip install -r requirements.txt sudo pip install . -glance image-list -echo "Install and test Neutron client" -cd ~/coppertest/git +echo "Install Neutron client" +cd /opt/copper/git git clone https://github.com/openstack/python-neutronclient.git cd python-neutronclient git checkout stable/liberty sudo pip install -r requirements.txt sudo pip install . -neutron net-list -echo "Install and test Nova client" -cd ~/coppertest/git +echo "Install Nova client" +cd /opt/copper/git git clone https://github.com/openstack/python-novaclient.git cd python-novaclient git checkout stable/liberty sudo pip install -r requirements.txt sudo pip install . -nova hypervisor-list -echo "Install and test Keystone client" -cd ~/coppertest/git +echo "Install Keystone client" +cd /opt/copper/git git clone https://github.com/openstack/python-keystoneclient.git cd python-keystoneclient git checkout stable/liberty sudo pip install -r requirements.txt sudo pip install . -echo "Setup the Congress Test Webappp" - -echo "Clone Copper" -cd ~/coppertest/git -git clone https://gerrit.opnfv.org/gerrit/copper - -echo "Install Apache, PHP" -sudo apt-get install -y apache2 php5 libapache2-mod-php5 -sudo /etc/init.d/apache2 restart - -echo "Copy the Apache config" -sudo cp ~/coppertest/git/copper/components/congress/test-webapp/www/ubuntu-apache2.conf /etc/apache2/apache2.conf - -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 - -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 - -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 - -echo "Set user so log files are stored" -sudo sed -i -- "s/opnfv/$USER/g" /var/www/html/proxy/index.php - -echo "Make webapp log directory and set permissions" -mkdir ~/coppertest/logs -chmod 777 ~/coppertest/logs - -echo "Restart Apache" -sudo service apache2 restart - set +x diff --git a/components/congress/test-webapp/www/html/proxy/index.php b/components/congress/test-webapp/www/html/proxy/index.php index d422acf..f459549 100644 --- a/components/congress/test-webapp/www/html/proxy/index.php +++ b/components/congress/test-webapp/www/html/proxy/index.php @@ -43,14 +43,14 @@ $response = curl_exec($curlop); $req_time=time(); $info = curl_getinfo($curlop); -$result = file_put_contents("/home/opnfv/coppertest/logs/".date('ymd').".log", "proxy.php, ".$req_time.", ".$url.", ".$type.", ".$body."\n",FILE_APPEND); +$result = file_put_contents("/tmp/copper/log/".date('ymd').".log", "proxy.php, ".$req_time.", ".$url.", ".$type.", ".$body."\n",FILE_APPEND); if ($result === false) $response = "PHP error in index.php"; $responseCode=curl_getinfo($curlop,CURLINFO_HTTP_CODE); $header_size = curl_getinfo($response, CURLINFO_HEADER_SIZE); $header = substr($response, 0, $header_size); $type = curl_getinfo($curlop,CURLINFO_CONTENT_TYPE); $body = substr($response, $header_size); -$result = file_put_contents("/home/opnfv/coppertest/logs/".date('ymd').".log", "proxy.php, ".$req_time.", ".$responseCode.", ".$type.", ".$header.", ".$body."\n",FILE_APPEND); +$result = file_put_contents("/tmp/copper/log/".date('ymd').".log", "proxy.php, ".$req_time.", ".$responseCode.", ".$type.", ".$header.", ".$body."\n",FILE_APPEND); if ($result === false) $response = "PHP error in index.php"; // header("Location: ".$url); |