diff options
Diffstat (limited to 'components/congress/install')
-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 |
5 files changed, 379 insertions, 276 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" |