diff options
Diffstat (limited to 'components/congress')
4 files changed, 73 insertions, 67 deletions
diff --git a/components/congress/install/bash/centos/install_congress_1.sh b/components/congress/install/bash/centos/install_congress_1.sh index 47137ae..19f3d29 100644 --- a/components/congress/install/bash/centos/install_congress_1.sh +++ b/components/congress/install/bash/centos/install_congress_1.sh @@ -18,6 +18,7 @@ # Prequisites: # OPFNV install per https://wiki.opnfv.org/display/copper/Apex # On the jumphost, logged in as stack on the undercloud VM: +# Download and save admin-openrc.sh from the overcloud Horizon at ~/ # su stack # Clone the Copper repo and run the install script: # git clone https://gerrit.opnfv.org/gerrit/copper @@ -27,15 +28,13 @@ 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') -# puppet apply -e "user { 'congress': ensure => present, password => sha1('congress'), }" -# ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ssh heat-admin@$CONTROLLER_HOST1 "useradd congress; exit" - echo "Create the environment file and copy to the congress server" cat <<EOF >~/env.sh export CONGRESS_HOST=$CONTROLLER_HOST1 @@ -47,23 +46,27 @@ export NEUTRON_HOST=$CONTROLLER_HOST1 export NOVA_HOST=$CONTROLLER_HOST1 EOF source ~/env.sh -scp ~/stackrc heat-admin@$CONTROLLER_HOST1:/home/heat-admin/admin-openrc.sh -scp ~/env.sh heat-admin@$CONTROLLER_HOST1:/home/heat-admin +scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ~/env.sh heat-admin@$CONTROLLER_HOST1:/home/heat-admin + +# Setup env for overcloud +source ~/overcloudrc +sed -i -- 's/echo "Please/# echo "Please/g' ~/admin-openrc.sh +sed -i -- 's/read -sr OS_PASSWORD_INPUT/# read -sr OS_PASSWORD_INPUT/g' ~/admin-openrc.sh +sed -i -- 's/export OS_PASSWORD=$OS_PASSWORD_INPUT/export OS_PASSWORD='$OS_PASSWORD'/g' ~/admin-openrc.sh +source ~/admin-openrc.sh +scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ~/admin-openrc.sh heat-admin@$CONTROLLER_HOST1:/home/heat-admin echo "Copy install_congress_2.sh to the congress server and execute" -scp ~/git/copper/components/congress/joid/install_congress_2.sh heat-admin@$CONTROLLER_HOST1:/home/heat-admin +scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ~/git/copper/components/congress/joid/install_congress_2.sh heat-admin@$CONTROLLER_HOST1:/home/heat-admin ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no heat-admin@$CONTROLLER_HOST1 "source ~/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 +sudo yum install python-pip -y echo "install other dependencies" -sudo apt-get install apg git gcc python-dev libxml2 libxslt1-dev libzip-dev -y +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" @@ -123,7 +126,7 @@ openstack endpoint create $CONGRESS_SERVICE \ --internalurl http://$CONGRESS_HOST:1789/ echo "Start the Congress service" -ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@$CONGRESS_HOST "~/git/congress/bin/congress-server &>/dev/null &" +ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no heat-admin@$CONGRESS_HOST "~/git/congress/bin/congress-server &>/dev/null &" echo "Wait 30 seconds for Congress service to startup" sleep 30 @@ -162,7 +165,7 @@ openstack congress datasource create keystone "keystone" \ --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 echo "Install tox test dependencies" -sudo apt-get install -y libffi-dev libssl-dev +sudo yum install -y libffi-devel openssl-devel echo "Run Congress tox Tests" cd ~/git/congress diff --git a/components/congress/install/bash/centos/install_congress_2.sh b/components/congress/install/bash/centos/install_congress_2.sh index 588c780..e98ca9b 100644 --- a/components/congress/install/bash/centos/install_congress_2.sh +++ b/components/congress/install/bash/centos/install_congress_2.sh @@ -31,22 +31,13 @@ echo "install pip" sudo yum install python-pip -y echo "install java" -sudo yum install default-jre -y +# sudo yum install default-jre -y # No package default-jre available. echo "install other dependencies" -sudo yum install apg git gcc python-dev libxml2 libxslt1-dev libzip-dev -y -# No package python-dev available. -# No package libxslt1-dev available. -# No package libzip-dev available. +sudo yum install apg git gcc libxml2 python-devel libzip-devel libxslt-devel -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 yum -q -y install mysql-server python-mysqldb - echo "Clone congress" mkdir ~/git cd ~/git @@ -60,17 +51,15 @@ source bin/activate echo "Setup Congress" sudo mkdir -p /etc/congress -sudo chown ubuntu /etc/congress +sudo chown heat-admin /etc/congress mkdir -p /etc/congress/snapshot sudo mkdir /var/log/congress -sudo chown ubuntu /var/log/congress +sudo chown heat-admin /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-dev -y -sudo yum install openssl -y -sudo yum install libssl-dev -y +sudo yum install libffi-devel openssl openssl-devel -y echo "install dependencies of Congress" cd ~/git/congress @@ -97,16 +86,15 @@ sed -i -- 's/#auth_protocol = https/auth_protocol = http/g' etc/congress.conf.sa sed -i -- 's/#admin_tenant_name = admin/admin_tenant_name = admin/g' etc/congress.conf.sample sed -i -- 's/#admin_user = <None>/admin_user = congress/g' etc/congress.conf.sample sed -i -- 's/#admin_password = <None>/admin_password = congress/g' etc/congress.conf.sample -sed -i -- 's/#connection = <None>/connection = mysql:\/\/ubuntu:'$MYSQL_PASSWORD'@localhost:3306\/congress/g' etc/congress.conf.sample +sed -i -- 's/#connection = <None>/connection = mysql:\/\/congress@localhost:3306\/congress/g' etc/congress.conf.sample echo "copy congress.conf.sample to /etc/congress" cp etc/congress.conf.sample /etc/congress/congress.conf echo "create congress database" -sudo mysql --user=root --password=$MYSQL_PASSWORD -e "CREATE DATABASE congress; GRANT ALL PRIVILEGES ON congress.* TO 'ubuntu@localhost' IDENTIFIED BY '"$MYSQL_PASSWORD"'; GRANT ALL PRIVILEGES ON congress.* TO 'ubuntu'@'%' IDENTIFIED BY '"$MYSQL_PASSWORD"';" +sudo mysql -e "CREATE DATABASE congress; GRANT ALL PRIVILEGES ON congress.* TO 'congress';" echo "install congress-db-manage dependencies (detected by errors)" -sudo yum build-dep python-mysqldb -y bin/pip install MySQL-python echo "create database schema" @@ -122,7 +110,7 @@ git checkout stable/liberty function _congress_setup_horizon { local HORIZON_DIR="/usr/share/openstack-dashboard" - local CONGRESS_HORIZON_DIR="/home/ubuntu/git/congress/contrib/horizon" + local CONGRESS_HORIZON_DIR="/home/heat-admin/git/congress/contrib/horizon" sudo cp -r $CONGRESS_HORIZON_DIR/datasources $HORIZON_DIR/openstack_dashboard/dashboards/admin/ sudo cp -r $CONGRESS_HORIZON_DIR/policies $HORIZON_DIR/openstack_dashboard/dashboards/admin/ sudo cp -r $CONGRESS_HORIZON_DIR/static $HORIZON_DIR/openstack_dashboard/dashboards/admin/ 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 b69cf3f..400d27e 100644 --- a/components/congress/test-webapp/setup/install_congress_testserver_1.sh +++ b/components/congress/test-webapp/setup/install_congress_testserver_1.sh @@ -16,51 +16,64 @@ # 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 install per https://wiki.opnfv.org/copper/academy/joid +# 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> -# <controller_hostname> is the name of the controller node in MAAS +# $ 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) -# Create and Activate the Container -# Earlier versions of the JOID installer installed lxc and created local templates -# but now we have to get the ubuntu template from the controller +set -x -if [ $# -lt 1 ]; then - echo 1>&2 "$0: arguments required <controller_hostname>" - return 2 -fi +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 [ $# -eq 2 ]; then - if [ $2 == "debug" ]; then set -x #echo on + 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 +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 "Install prerequisites" -sudo apt-get install -y lxc -echo "Copy lxc-ubuntu container from the controller" -juju scp ubuntu@$1:/usr/share/lxc/templates/lxc-ubuntu ~/lxc-ubuntu -sudo cp ~/lxc-ubuntu /usr/share/lxc/templates/lxc-ubuntu -echo "Create the trusty-copper container" -sudo lxc-create -n trusty-copper -t /usr/share/lxc/templates/lxc-ubuntu -l DEBUG -- -b $USER ~/$USER -echo "Start trusty-copper" -sudo lxc-start -n trusty-copper -d +echo "Start copper" +sudo lxc-start -n copper -d if (($? > 0)); then - echo Error starting trusty-copper lxc container + echo Error starting copper lxc container return fi echo "Get the CONGRESS_HOST value from env.sh" source ~/env.sh -echo "Get trusty-copper address" +echo "Get copper address" sleep 5 export COPPER_HOST="" while [ "$COPPER_HOST" == "" ]; do sleep 5 - export COPPER_HOST=$(sudo lxc-info --name trusty-copper | grep IP | awk "/ / { print \$2 }") + export COPPER_HOST=$(sudo lxc-info --name copper | grep IP | awk "/ / { print \$2 }") done echo COPPER_HOST = $COPPER_HOST @@ -68,15 +81,15 @@ echo "Create the environment file" cat <<EOF >~/env.sh export COPPER_HOST=$COPPER_HOST export CONGRESS_HOST=$CONGRESS_HOST -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 }") +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 trusty-copper" +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" 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 93d58d8..0f9ee57 100644 --- a/components/congress/test-webapp/setup/install_congress_testserver_2.sh +++ b/components/congress/test-webapp/setup/install_congress_testserver_2.sh @@ -16,12 +16,14 @@ # 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 install per https://wiki.opnfv.org/copper/academy/joid +# 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> -# <controller_hostname> is the name of the controller node in MAAS +# $ 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) echo "Setup OpenStack environment variables per your OPNFV install" source ~/env.sh |