diff options
author | blsaws <bryan.sullivan@att.com> | 2016-05-22 12:01:53 -0700 |
---|---|---|
committer | blsaws <bryan.sullivan@att.com> | 2016-05-22 12:01:53 -0700 |
commit | 3f0e3bb3cf85c94791c20ba0dc13532fc4f5a5ff (patch) | |
tree | e48dce29c262c44fc7f5567e7f7022118218a714 /components | |
parent | 7aa1a2d2054e37fe68c79ea652a496fbf522acaf (diff) |
Merge JOID and Apex installs.
JIRA: COPPER-2
Change-Id: I805644ff08d7a61a67469186890cd9920344025e
Signed-off-by: blsaws <bryan.sullivan@att.com>
Diffstat (limited to 'components')
-rw-r--r-- | components/congress/install/bash/centos/clean_congress.sh | 59 | ||||
-rw-r--r-- | components/congress/install/bash/centos/install_congress_1.sh | 179 | ||||
-rw-r--r-- | components/congress/install/bash/clean_congress.sh | 71 | ||||
-rw-r--r-- | components/congress/install/bash/install_congress_1.sh | 221 | ||||
-rw-r--r-- | components/congress/install/bash/install_congress_2.sh (renamed from components/congress/install/bash/centos/install_congress_2.sh) | 125 | ||||
-rw-r--r-- | components/congress/test-webapp/setup/install_congress_testserver_1.sh | 127 | ||||
-rw-r--r-- | components/congress/test-webapp/setup/install_congress_testserver_2.sh | 137 |
7 files changed, 379 insertions, 540 deletions
diff --git a/components/congress/install/bash/centos/clean_congress.sh b/components/congress/install/bash/centos/clean_congress.sh deleted file mode 100644 index 27d6193..0000000 --- a/components/congress/install/bash/centos/clean_congress.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# CCopyright 2015-2016 AT&T Intellectual Property, Inc -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This is a cleanup script for installation of Congress on the Centos 7 based -# OPNFV Controller node as installed per the OPNFV Apex project. -# Prequisites: -# Presumably something has failed, and any record of the Congress feature -# in OpenStack needs to be removed, so you can try the install again. -# -# Prequisite: -# OPFNV install per https://wiki.opnfv.org/display/copper/Apex -# How to use: -# cd ~/git/copper/ -# source /components/congress/install/bash/centos/clean_congress.sh - -cd ~ -# Setup undercloud environment so we can get overcloud Controller server address -source ~/stackrc - -# Get addresses of Controller node(s) -export CONTROLLER_HOST1=$(openstack server list | awk "/overcloud-controller-0/ { print \$8 }" | sed 's/ctlplane=//g') -export CONTROLLER_HOST2=$(openstack server list | awk "/overcloud-controller-1/ { print \$8 }" | sed 's/ctlplane=//g') - -echo "Stop the Congress service" -ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no heat-admin@$CONGRESS_HOST "pkill congress-server; exit" - -echo "Remove the Congress virtualenv and code" -ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no heat-admin@$CONGRESS_HOST "rm -rf ~/congress; exit" - -# Setup env for overcloud API access -source ~/overcloudrc - -# Delete Congress user -export CONGRESS_USER=$(openstack user list | awk "/ congress / { print \$2 }") -if [ "$CONGRESS_USER" != "" ]; then - openstack user delete $CONGRESS_USER -fi - -# Delete Congress service -export CONGRESS_SERVICE=$(openstack service list | awk "/ congress / { print \$2 }") -if [ "$CONGRESS_SERVICE" != "" ]; then - openstack service delete $CONGRESS_SERVICE -fi - -# Delete Congress and other installed code in virtualenv -rm -rf ~/congress - diff --git a/components/congress/install/bash/centos/install_congress_1.sh b/components/congress/install/bash/centos/install_congress_1.sh deleted file mode 100644 index 166f475..0000000 --- a/components/congress/install/bash/centos/install_congress_1.sh +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/bash -# Copyright 2015-2016 AT&T Intellectual Property, Inc -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This is script 1 of 2 for installation of Congress on the Centos 7 based -# OPNFV Controller node as installed per the OPNFV Apex project. -# Prequisites: -# OPFNV install per https://wiki.opnfv.org/display/copper/Apex -# On the jumphost, logged in as stack on the undercloud VM: -# su stack -# Clone the Copper repo and run the install script: -# mkdir ~/git; cd git; git clone https://gerrit.opnfv.org/gerrit/copper -# cd copper -# source components/congress/install/bash/centos/install_congress_1.sh - -if [ $# -gt 1 ] && [ $2 == "debug" ]; then set -x #echo on -fi - -cd ~ -# Setup undercloud environment so we can get overcloud Controller server address -source ~/stackrc - -# Get addresses of Controller node(s) -export CONTROLLER_HOST1=$(openstack server list | awk "/overcloud-controller-0/ { print \$8 }" | sed 's/ctlplane=//g') -export CONTROLLER_HOST2=$(openstack server list | awk "/overcloud-controller-1/ { print \$8 }" | sed 's/ctlplane=//g') - -echo "Create the environment file and copy to the congress server" -mkdir ~/congress -cat <<EOF >~/congress/env.sh -export CONGRESS_HOST=$CONTROLLER_HOST1 -export KEYSTONE_HOST=$CONTROLLER_HOST1 -export CEILOMETER_HOST=$CONTROLLER_HOST1 -export CINDER_HOST=$CONTROLLER_HOST1 -export GLANCE_HOST=$CONTROLLER_HOST1 -export NEUTRON_HOST=$CONTROLLER_HOST1 -export NOVA_HOST=$CONTROLLER_HOST1 -EOF -source ~/congress/env.sh -scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ~/congress/env.sh heat-admin@$CONTROLLER_HOST1:/home/heat-admin - -# Setup env for overcloud API access and copy to congress server -source ~/overcloudrc -export OS_REGION_NAME=$(openstack endpoint list | awk "/ nova / { print \$4 }") -cp ~/overcloudrc ~/congress/admin-openrc.sh -# sed command below is a workaound for a bug - region shows up twice for some reason -cat <<EOF | sed '$d' >>~/congress/admin-openrc.sh -export OS_REGION_NAME=$OS_REGION_NAME -EOF -ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no heat-admin@$CONTROLLER_HOST1 "mkdir ~/congress; exit" -scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ~/congress/admin-openrc.sh heat-admin@$CONTROLLER_HOST1:/home/heat-admin/congress - -echo "Copy install_congress_2.sh to the congress server and execute" -scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ~/git/copper/components/congress/install/bash/centos/install_congress_2.sh heat-admin@$CONTROLLER_HOST1:/home/heat-admin/congress -ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no heat-admin@$CONTROLLER_HOST1 "source ~/congress/install_congress_2.sh; exit" - -echo "Install jumphost dependencies" - -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 -sudo pip install --upgrade pip virtualenv setuptools pbr tox - -echo "Clone congress" -cd ~/congress -git clone https://github.com/openstack/congress.git -cd congress -git checkout stable/liberty - -echo "Create virtualenv" -virtualenv ~/congress/congress -source bin/activate - -echo "Setup overcloud OpenStack API" -source ~/congress/admin-openrc.sh - -echo "Install OpenStack client" -cd ~/congress -git clone https://github.com/openstack/python-openstackclient.git -cd python-openstackclient -git checkout stable/liberty -~/congress/congress/bin/pip install -r requirements.txt -~/congress/congress/bin/pip install . -openstack service list - -echo "Install Congress client" -cd ~/congress -git clone https://github.com/openstack/python-congressclient.git -cd python-congressclient -git checkout stable/liberty -~/congress/congress/bin/pip install -r requirements.txt -~/congress/congress/bin/pip install . - -echo "Install Keystone client" -cd ~/congress -git clone https://github.com/openstack/python-keystoneclient.git -cd python-keystoneclient -git checkout stable/liberty -~/congress/congress/bin/pip install -r requirements.txt -~/congress/congress/bin/pip install . - -echo "setup Congress user. TODO: needs update in http://congress.readthedocs.org/en/latest/readme.html#installing-congress" -pip install cliff --upgrade -export ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }") -export SERVICE_TENANT=$(openstack project list | awk "/ admin / { print \$2 }") -openstack user create --password congress --project admin --email "congress@example.com" congress -export CONGRESS_USER=$(openstack user list | awk "/ congress / { print \$2 }") -openstack role add --user $CONGRESS_USER --project $SERVICE_TENANT $ADMIN_ROLE - -echo "Create Congress service" -openstack service create congress --type "policy" --description "Congress Service" -export CONGRESS_SERVICE=$(openstack service list | awk "/ congress / { print \$2 }") - -echo "Create Congress endpoint" -openstack endpoint create $CONGRESS_SERVICE \ - --region $OS_REGION_NAME \ - --publicurl http://$CONGRESS_HOST:1789/ \ - --adminurl http://$CONGRESS_HOST:1789/ \ - --internalurl http://$CONGRESS_HOST:1789/ - -echo "Start the Congress service" -ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no heat-admin@$CONGRESS_HOST "~/congress/congress/bin/congress-server &>/dev/null &" - -echo "Wait 30 seconds for Congress service to startup" -sleep 30 - -echo "Create data sources" -# To remove datasources: openstack congress datasource delete <name> -openstack congress datasource create nova "nova" \ - --config username=$OS_USERNAME \ - --config tenant_name=$OS_TENANT_NAME \ - --config password=$OS_PASSWORD \ - --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 -openstack congress datasource create neutronv2 "neutronv2" \ - --config username=$OS_USERNAME \ - --config tenant_name=$OS_TENANT_NAME \ - --config password=$OS_PASSWORD \ - --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 -openstack congress datasource create ceilometer "ceilometer" \ - --config username=$OS_USERNAME \ - --config tenant_name=$OS_TENANT_NAME \ - --config password=$OS_PASSWORD \ - --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 -openstack congress datasource create cinder "cinder" \ - --config username=$OS_USERNAME \ - --config tenant_name=$OS_TENANT_NAME \ - --config password=$OS_PASSWORD \ - --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 -openstack congress datasource create glancev2 "glancev2" \ - --config username=$OS_USERNAME \ - --config tenant_name=$OS_TENANT_NAME \ - --config password=$OS_PASSWORD \ - --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 -openstack congress datasource create keystone "keystone" \ - --config username=$OS_USERNAME \ - --config tenant_name=$OS_TENANT_NAME \ - --config password=$OS_PASSWORD \ - --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 - -echo "Install tox test dependencies" -sudo yum install -y libffi-devel openssl-devel - -echo "Run Congress tox Tests" -cd ~/congress/congress -tox -epy27 - -set +x #echo off diff --git a/components/congress/install/bash/clean_congress.sh b/components/congress/install/bash/clean_congress.sh new file mode 100644 index 0000000..59a2b5f --- /dev/null +++ b/components/congress/install/bash/clean_congress.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# CCopyright 2015-2016 AT&T Intellectual Property, Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This is a cleanup script for installation of Congress on the OPNFV Controller +# node as installed via JOID or Apex (Fuel and Compass not yet verified). +# Presumably something has failed, and any record of the Congress feature +# in OpenStack needs to be removed, so you can try the install again. +# Prerequisites: +# - OPFNV installed via JOID or Apex +# - For Apex installs, on the jumphost, ssh to the undercloud VM and +# $ su stack +# - For JOID installs, admin-openrc.sh saved from Horizon to ~/admin-openrc.sh +# - Retrieve the copper remova script as below +# $ cd ~ +# $ wget https://git.opnfv.org/cgit/copper/tree/components/congress/install/bash/clean_congress.sh + +echo "OS-specific prerequisite steps" +dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'` + +if [ "$dist" == "Ubuntu" ]; then + # Ubuntu + echo "Ubuntu-based install" + export CTLUSER="ubuntu" + echo "Stop the Congress service" + # Have to use "python" here as congress-server does not show up in the process list (?) + ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONGRESS_HOST "pkill python; exit" + source ~/admin-openrc.sh <<EOF +openstack +EOF +else + export CTLUSER="heat-admin" + echo "Stop the Congress service" + ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONGRESS_HOST "pkill congress-server; exit" + source ~/admin-openrc.sh +fi + +cd ~ + +echo "Remove the Congress virtualenv and code" +ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONGRESS_HOST "rm -rf ~/congress; exit" + +echo "Delete Congress user" +export CONGRESS_USER=$(openstack user list | awk "/ congress / { print \$2 }") +if [ "$CONGRESS_USER" != "" ]; then + openstack user delete $CONGRESS_USER +fi + +echo "Delete Congress service" +export CONGRESS_SERVICE=$(openstack service list | awk "/ congress / { print \$2 }") +if [ "$CONGRESS_SERVICE" != "" ]; then + openstack service delete $CONGRESS_SERVICE +fi + +echo "Deactivate virtualenv" +deactivate + +echo "Delete Congress and other installed code in virtualenv" +rm -rf ~/congress + diff --git a/components/congress/install/bash/install_congress_1.sh b/components/congress/install/bash/install_congress_1.sh new file mode 100644 index 0000000..4190173 --- /dev/null +++ b/components/congress/install/bash/install_congress_1.sh @@ -0,0 +1,221 @@ +#!/bin/bash +# Copyright 2015-2016 AT&T Intellectual Property, Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This is script 1 of 2 for installation of Congress on the OPNFV Controller +# node as installed via JOID or Apex (Fuel and Compass not yet verified). +# Prerequisites: +# - OPFNV installed via JOID or Apex +# - For Apex installs, on the jumphost, ssh to the undercloud VM and +# $ su stack +# - For JOID installs, admin-openrc.sh saved from Horizon to ~/admin-openrc.sh +# - Retrieve the copper install script as below, optionally specifying the +# branch to use as a URL parameter, e.g. ?h=stable%2Fbrahmaputra +# $ cd ~ +# $ wget https://git.opnfv.org/cgit/copper/tree/components/congress/install/bash/install_congress_1.sh +# $ wget https://git.opnfv.org/cgit/copper/tree/components/congress/install/bash/install_congress_2.sh +# $ source install_congress_1.sh [openstack-branch] +# optionally specifying the branch identifier to use for OpenStack +# + +set -x + +if [ $# -eq 1 ]; then osbranch=$1; fi + +if [ -d ~/congress ]; then rm -rf ~/congress; fi +mkdir ~/congress + +echo "OS-specific prerequisite steps" +dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'` + +if [ "$dist" == "Ubuntu" ]; then + # Ubuntu + echo "Ubuntu-based install" + echo "Create the environment file and copy to the congress server" + cat <<EOF >~/congress/env.sh +export CONGRESS_HOST=$(juju status --format=short | awk "/openstack-dashboard/ { print \$3 }") +export HORIZON_HOST=$(juju status --format=short | awk "/openstack-dashboard/ { print \$3 }") +export KEYSTONE_HOST=$(juju status --format=short | awk "/keystone\/0/ { print \$3 }") +export CEILOMETER_HOST=$(juju status --format=short | awk "/ceilometer\/0/ { print \$3 }") +export CINDER_HOST=$(juju status --format=short | awk "/cinder\/0/ { print \$3 }") +export GLANCE_HOST=$(juju status --format=short | awk "/glance\/0/ { print \$3 }") +export NEUTRON_HOST=$(juju status --format=short | awk "/neutron-api\/0/ { print \$3 }") +export NOVA_HOST=$(juju status --format=short | awk "/nova-cloud-controller\/0/ { print \$3 }") +EOF + source ~/congress/env.sh + export CTLUSER="ubuntu" + ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONGRESS_HOST "mkdir ~/congress; exit" + juju scp ~/admin-openrc.sh ubuntu@$CONGRESS_HOST:/home/$CTLUSER/congress + juju scp ~/congress/env.sh ubuntu@$CONGRESS_HOST:/home/$CTLUSER/congress + echo "Copy install_congress_2.sh to the congress server and execute" + juju scp ~/install_congress_2.sh $CTLUSER@$CONGRESS_HOST:/home/ubuntu/congress + ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONGRESS_HOST "source ~/congress/install_congress_2.sh; exit" + echo "Install jumphost dependencies" + echo "Update package repos" + sudo apt-get update + echo "install pip" + sudo apt-get install python-pip -y + echo "install other dependencies" + sudo apt-get install apg git gcc python-dev libxml2 libxslt1-dev libzip-dev -y + sudo pip install --upgrade pip virtualenv setuptools pbr tox + source ~/admin-openrc.sh <<EOF +openstack +EOF +else + # Centos + echo "Centos-based install" + echo "Setup undercloud environment so we can get overcloud Controller server address" + source ~/stackrc + echo "Get address of Controller node" + export CONTROLLER_HOST1=$(openstack server list | awk "/overcloud-controller-0/ { print \$8 }" | sed 's/ctlplane=//g') + echo "Create the environment file and copy to the congress server" + cat <<EOF >~/congress/env.sh +export CONGRESS_HOST=$CONTROLLER_HOST1 +export KEYSTONE_HOST=$CONTROLLER_HOST1 +export CEILOMETER_HOST=$CONTROLLER_HOST1 +export CINDER_HOST=$CONTROLLER_HOST1 +export GLANCE_HOST=$CONTROLLER_HOST1 +export NEUTRON_HOST=$CONTROLLER_HOST1 +export NOVA_HOST=$CONTROLLER_HOST1 +EOF + source ~/congress/env.sh + CTLUSER="heat-admin" + ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONTROLLER_HOST1 "mkdir ~/congress; exit" + scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ~/congress/env.sh $CTLUSER@$CONTROLLER_HOST1:/home/$CTLUSER/congress + echo "Setup env for overcloud API access and copy to congress server" + source ~/overcloudrc + export OS_REGION_NAME=$(openstack endpoint list | awk "/ nova / { print \$4 }") + cp ~/overcloudrc ~/congress/admin-openrc.sh + # sed command below is a workaound for a bug - region shows up twice for some reason + cat <<EOF | sed '$d' >>~/admin-openrc.sh +export OS_REGION_NAME=$OS_REGION_NAME +EOFif [ "$dist" == "Ubuntu" ]; then + scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ~/admin-openrc.sh $CTLUSER@$CONTROLLER_HOST1:/home/$CTLUSER/congress + echo "Copy install_congress_2.sh to the congress server and execute" + scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ~/install_congress_2.sh $CTLUSER@$CONTROLLER_HOST1:/home/$CTLUSER/congress + ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONTROLLER_HOST1 "source ~/congress/install_congress_2.sh; exit" + echo "Install jumphost dependencies" + 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 + sudo pip install --upgrade pip virtualenv setuptools pbr tox + source ~/admin-openrc.sh +fi + +echo "Create virtualenv" +virtualenv ~/congress/venv +cd ~/congress/venv +source bin/activate + +echo "Clone congress" +cd ~/congress +git clone https://github.com/openstack/congress.git +cd congress +if [ $# -eq 1 ]; then git checkout $1; fi + +echo "Install OpenStack client" +cd ~/congress +git clone https://github.com/openstack/python-openstackclient.git +cd python-openstackclient +if [ $# -eq 1 ]; then git checkout $1; fi +pip install -r requirements.txt +pip install . + +echo "Install Congress client" +cd ~/congress +git clone https://github.com/openstack/python-congressclient.git +cd python-congressclient +if [ $# -eq 1 ]; then git checkout $1; fi +pip install -r requirements.txt +pip install . + +echo "Install Keystone client" +cd ~/congress +git clone https://github.com/openstack/python-keystoneclient.git +cd python-keystoneclient +if [ $# -eq 1 ]; then git checkout $1; fi +pip install -r requirements.txt +pip install . + +echo "setup Congress user. TODO: needs update in http://congress.readthedocs.org/en/latest/readme.html#installing-congress" +pip install cliff --upgrade +export ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }") +export SERVICE_TENANT=$(openstack project list | awk "/ admin / { print \$2 }") +openstack user create --password congress --project admin --email "congress@example.com" congress +export CONGRESS_USER=$(openstack user list | awk "/ congress / { print \$2 }") +openstack role add --user $CONGRESS_USER --project $SERVICE_TENANT $ADMIN_ROLE + +echo "Create Congress service" +openstack service create congress --type "policy" --description "Congress Service" +export CONGRESS_SERVICE=$(openstack service list | awk "/ congress / { print \$2 }") + +echo "Create Congress endpoint" +openstack endpoint create $CONGRESS_SERVICE \ + --region $OS_REGION_NAME \ + --publicurl http://$CONGRESS_HOST:1789/ \ + --adminurl http://$CONGRESS_HOST:1789/ \ + --internalurl http://$CONGRESS_HOST:1789/ + +echo "Start the Congress service" +ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONGRESS_HOST "source ~/congress/venv/bin/activate; ~/congress/congress/bin/congress-server &>/dev/null &" + +echo "Wait 30 seconds for Congress service to startup" +sleep 30 + +echo "Create data sources" +# To remove datasources: openstack congress datasource delete <name> +openstack congress datasource create nova "nova" \ + --config username=$OS_USERNAME \ + --config tenant_name=$OS_TENANT_NAME \ + --config password=$OS_PASSWORD \ + --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 +openstack congress datasource create neutronv2 "neutronv2" \ + --config username=$OS_USERNAME \ + --config tenant_name=$OS_TENANT_NAME \ + --config password=$OS_PASSWORD \ + --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 +openstack congress datasource create ceilometer "ceilometer" \ + --config username=$OS_USERNAME \ + --config tenant_name=$OS_TENANT_NAME \ + --config password=$OS_PASSWORD \ + --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 +openstack congress datasource create cinder "cinder" \ + --config username=$OS_USERNAME \ + --config tenant_name=$OS_TENANT_NAME \ + --config password=$OS_PASSWORD \ + --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 +openstack congress datasource create glancev2 "glancev2" \ + --config username=$OS_USERNAME \ + --config tenant_name=$OS_TENANT_NAME \ + --config password=$OS_PASSWORD \ + --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 +openstack congress datasource create keystone "keystone" \ + --config username=$OS_USERNAME \ + --config tenant_name=$OS_TENANT_NAME \ + --config password=$OS_PASSWORD \ + --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 + +echo "Install tox test dependencies" +if [ "$dist" == "Ubuntu" ]; then + sudo apt-get install -y libffi-dev libssl-dev +else + sudo yum install -y libffi-devel openssl-devel +fi + +echo "Run Congress tox Tests" +cd ~/congress/congress +tox -epy27 + +set +x #echo off diff --git a/components/congress/install/bash/centos/install_congress_2.sh b/components/congress/install/bash/install_congress_2.sh index a41c4a5..b4b129d 100644 --- a/components/congress/install/bash/centos/install_congress_2.sh +++ b/components/congress/install/bash/install_congress_2.sh @@ -13,61 +13,104 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# This is script 2 of 2 for installation of Congress on the Centos 7 based -# OPNFV Controller node as installed per the OPNFV Apex project. -# Prequisites: -# OPFNV install per https://wiki.opnfv.org/display/copper/Apex -# On the jumphost, logged in as stack on the undercloud VM: -# su stack -# Clone the Copper repo and run the install script: -# mkdir ~/git; cd git; git clone https://gerrit.opnfv.org/gerrit/copper -# cd copper -# source components/congress/install/bash/centos/install_congress_1.sh +# This is script 2 of 2 for installation of Congress on the OPNFV Controller +# node as installed via JOID or Apex (Fuel and Compass not yet verified). +# Prerequisites: +# - OPFNV installed via JOID or Apex +# - For Apex installs, on the jumphost, ssh to the undercloud VM and +# $ su stack +# - For JOID installs, admin-openrc.sh saved from Horizon to ~/admin-openrc.sh +# - Retrieve the copper install script as below, optionally specifying the +# branch to use as a URL parameter, e.g. ?h=stable%2Fbrahmaputra +# $ cd ~ +# $ wget https://git.opnfv.org/cgit/copper/tree/components/congress/install/bash/install_congress_1.sh +# $ wget https://git.opnfv.org/cgit/copper/tree/components/congress/install/bash/install_congress_2.sh +# $ source install_congress_1.sh [openstack-branch] +# optionally specifying the branch identifier to use for OpenStack +# set -x -source ~/congress/admin-openrc.sh -source ~/congress/env.sh -echo "install pip" -sudo yum install python-pip -y +if [ $# -eq 1 ]; then osbranch=$1; fi + +echo "OS-specific prerequisite steps" +dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'` + +if [ "$dist" == "Ubuntu" ]; then + # Ubuntu + echo "Ubuntu-based install" + export CTLUSER="ubuntu" + source ~/congress/admin-openrc.sh <<EOF +openstack +EOF + source ~/congress/env.sh + echo "Update/upgrade package repos" + sudo apt-get update + echo "install pip" + sudo apt-get install python-pip -y + echo "install java" + sudo apt-get install default-jre -y + echo "install other dependencies" + sudo apt-get install apg git gcc python-dev libxml2 libxslt1-dev libzip-dev -y + sudo pip install --upgrade pip virtualenv setuptools pbr tox + echo "set mysql root user password and install mysql" + export MYSQL_PASSWORD=$(/usr/bin/apg -n 1 -m 16 -c cl_seed) + sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password '$MYSQL_PASSWORD + sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password '$MYSQL_PASSWORD + sudo -E apt-get -q -y install mysql-server python-mysqldb + echo "install tox dependencies (detected by errors during 'tox -egenconfig')" + sudo apt-get install libffi-dev openssl libssl-dev -y +else + # Centos + echo "Centos-based install" + export CTLUSER="heat-admin" + source ~/congress/admin-openrc.sh + source ~/congress/env.sh + 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 + sudo pip install --upgrade pip virtualenv setuptools pbr tox + echo "install tox dependencies (detected by errors during 'tox -egenconfig')" + sudo yum install libffi-devel openssl openssl-devel -y +fi -echo "install java" -# sudo yum install default-jre -y -# No package default-jre available. - -echo "install other dependencies" -sudo yum install apg git gcc libxml2 python-devel libzip-devel libxslt-devel -y -sudo pip install --upgrade pip virtualenv setuptools pbr tox +echo "Create virtualenv" +virtualenv ~/congress/venv +cd ~/congress/venv +source bin/activate echo "Clone congress" cd ~/congress git clone https://github.com/openstack/congress.git cd congress -git checkout stable/liberty +if [ $# -eq 1 ]; then git checkout $1; fi -echo "Create virtualenv" -virtualenv ~/congress/congress -source bin/activate +echo "Install OpenStack client" +cd ~/congress +git clone https://github.com/openstack/python-openstackclient.git +cd python-openstackclient +if [ $# -eq 1 ]; then git checkout $1; fi +pip install -r requirements.txt +pip install . echo "Setup Congress" +cd ~/congress/congress sudo mkdir -p /etc/congress -sudo chown heat-admin /etc/congress -mkdir -p /etc/congress/snapshot +sudo chown $CTLUSER /etc/congress +sudo mkdir -p /etc/congress/snapshot sudo mkdir /var/log/congress -sudo chown heat-admin /var/log/congress +sudo chown $CTLUSER /var/log/congress cp etc/api-paste.ini /etc/congress cp etc/policy.json /etc/congress -echo "install requirements.txt and tox dependencies (detected by errors during 'tox -egenconfig')" -sudo yum install libffi-devel openssl openssl-devel -y - echo "install dependencies of Congress" cd ~/congress/congress -bin/pip install -r requirements.txt -bin/pip install . +pip install -r requirements.txt +pip install . echo "install tox" -bin/pip install tox +pip install tox echo "generate congress.conf.sample" tox -egenconfig @@ -95,7 +138,8 @@ echo "create congress database" sudo mysql -e "CREATE DATABASE congress; GRANT ALL PRIVILEGES ON congress.* TO 'congress';" echo "install congress-db-manage dependencies (detected by errors)" -bin/pip install MySQL-python +if [ "$dist" == "Ubuntu" ]; then sudo apt-get build-dep python-mysqldb -y; fi +pip install MySQL-python echo "create database schema" congress-db-manage --config-file /etc/congress/congress.conf upgrade head @@ -104,10 +148,15 @@ echo "Install Congress client" cd ~/congress git clone https://github.com/openstack/python-congressclient.git cd python-congressclient -git checkout stable/liberty -../congress/bin/pip install -r requirements.txt -../congress/bin/pip install . +if [ $# -eq 1 ]; then git checkout $1; fi +pip install -r requirements.txt +pip install . + +# Fix error found during startup of congress server +echo "Install python fixtures" +pip install fixtures +# TODO: The rest of this script is not yet tested function _congress_setup_horizon { local HORIZON_DIR="/usr/share/openstack-dashboard" local CONGRESS_HORIZON_DIR="/home/heat-admin/git/congress/contrib/horizon" diff --git a/components/congress/test-webapp/setup/install_congress_testserver_1.sh b/components/congress/test-webapp/setup/install_congress_testserver_1.sh deleted file mode 100644 index dfb2a4b..0000000 --- a/components/congress/test-webapp/setup/install_congress_testserver_1.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/bash -# Copyright 2015-2016 AT&T Intellectual Property, Inc -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# What this is: script 1 of 2 for installation of a test server for Congress. -# Status: this is a work in progress, under test. -# -# Prequisite: OPFNV installed per JOID or Apex installer -# On jumphost: -# - Congress installed through 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 -# (the parameter is not used for Apex-based installs) - -set -x - -echo "Install prerequisites" -dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'` - -if [ "$dist" == "Ubuntu" ]; then - # 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 - - if [ $# -lt 1 ]; then - echo 1>&2 "$0: arguments required <controller_hostname>" - set +x - return 2 - 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 - - 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 ~/congress/env.sh - - echo "Get copper address" - sleep 5 - 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 >~/congress/env.sh -export COPPER_HOST=$COPPER_HOST -export CONGRESS_HOST=$CONGRESS_HOST -export KEYSTONE_HOST=$KEYSTONE_HOST -export CEILOMETER_HOST=$CEILOMETER_HOST -export CINDER_HOST=$CINDER_HOST -export GLANCE_HOST=$GLANCE_HOST -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" - -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 service docker start - - echo "Setup webapp files" - if [ ! -d /tmp/copper ]; then mkdir /tmp/copper; fi - if [ ! -d /tmp/copper/log ]; then mkdir /tmp/copper/log; fi - sudo scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no stack@192.0.2.1:/home/stack/congress/*.sh /tmp/copper - source /tmp/copper/env.sh - cp -r ~/git/copper/components/congress/test-webapp/* /tmp/copper/ - if [ ! -d /tmp/copper/tests ]; then mkdir /tmp/copper/tests; fi - cp -r ~/git/copper/tests/* /tmp/copper/tests - echo "Point proxy.php to the Congress server" - source /tmp/copper/env.sh - sed -i -- "s/CONGRESS_HOST/$CONGRESS_HOST/g" /tmp/copper/www/proxy/index.php - - echo "Start webapp container" - sudo docker build -t copper-webapp /tmp/copper - CID=$(sudo docker run -p 8080:80 -d copper-webapp) - CIP=$(sudo docker inspect $CID | grep IPAddress | cut -d '"' -f 4 | tail -1) - echo "Copper Webapp ID address: $CIP" - - echo "Start Centos container" - sudo docker pull centos - echo "Attach to the Centos container" - echo "Once logged in, enter the command 'source /opt/copper/setup/install_congress_testserver_2.sh'" - sudo docker run -i -t -P --name copper-cli -v /tmp/copper:/opt/copper centos /bin/bash -# sudo docker attach $CID -# sudo docker run -it -P --name copper -v /tmp/copper:/opt/copper centos /opt/copper/setup/install_congress_testserver_2.sh -# sudo docker ps -a -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 deleted file mode 100644 index 1f50be3..0000000 --- a/components/congress/test-webapp/setup/install_congress_testserver_2.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash -# Copyright 2015-2016 AT&T Intellectual Property, Inc -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# What this is: script 2 of 2 for installation of a test server for Congress. -# Status: this is a work in progress, under test. -# -# Prequisite: OPFNV installed per JOID or Apex installer -# On jumphost: -# - Congress installed through install_congress_1.sh -# How to use: -# $ source install_congress_testserver_1.sh - -set -x - -echo "Setup OpenStack environment variables per your OPNFV install" -source /opt/copper/env.sh -source /opt/copper/admin-openrc.sh - -echo "Install prerequisites" -dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'` - -if [ "$dist" == "Ubuntu" ]; then - echo "Update the base server" - set -x - apt-get update - #apt-get -y upgrade - - echo "Install pip" - apt-get install -y python-pip - - echo "Install java" - 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 - - echo "Install Apache, PHP" - apt-get install -y apache2 php5 libapache2-mod-php5 - - echo "Setup the Congress Test Webappp" - - echo "Copy the Apache config" - cp /opt/copper/www/ubuntu-apache2.conf /etc/apache2/apache2.conf - - echo "Copy the webapp to the Apache root directory and fix permissions" - cp -R /opt/copper/www/html /var/www - chmod 755 /var/www/html -R - - echo "Point copper.js to the trusty-copper server per your install" - sed -i -- "s/COPPER_HOST/$COPPER_HOST/g" /var/www/html/copper.js - - echo "Point proxy.php to the Congress server per your install" - sed -i -- "s/CONGRESS_HOST/$CONGRESS_HOST/g" /var/www/html/proxy/index.php - - echo "Make webapp log directory" - mkdir /tmp/copper/log - - /etc/init.d/apache2 restart - -else - echo "Add epel repo" - yum install epel-release -y - - echo "install pip" - yum install python-pip -y - - echo "install other dependencies" - yum install apg git gcc libxml2 python-devel libzip-devel libxslt-devel -y - -fi - -echo "Install python dependencies" -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 -pip install -r requirements.txt -pip install . - -echo "Install Congress client" -cd /opt/copper/git -git clone https://github.com/openstack/python-congressclient.git -cd python-congressclient -git checkout stable/liberty -pip install -r requirements.txt -pip install . - -echo "Install Glance client" -cd /opt/copper/git -git clone https://github.com/openstack/python-glanceclient.git -cd python-glanceclient -git checkout stable/liberty -pip install -r requirements.txt -pip install . - -echo "Install Neutron client" -cd /opt/copper/git -git clone https://github.com/openstack/python-neutronclient.git -cd python-neutronclient -git checkout stable/liberty -pip install -r requirements.txt -pip install . - -echo "Install Nova client" -cd /opt/copper/git -git clone https://github.com/openstack/python-novaclient.git -cd python-novaclient -git checkout stable/liberty -pip install -r requirements.txt -pip install . - -echo "Install Keystone client" -cd /opt/copper/git -git clone https://github.com/openstack/python-keystoneclient.git -cd python-keystoneclient -git checkout stable/liberty -pip install -r requirements.txt -pip install . - -set +x - |