summaryrefslogtreecommitdiffstats
path: root/tools/kingbird
diff options
context:
space:
mode:
authorDimitri Mazmanov <dimitri.mazmanov@ericsson.com>2016-07-19 09:10:30 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-07-19 09:10:30 +0000
commit78a64bc6c69b00c88ffee55e3f6077d876e7a4e7 (patch)
tree7586b5f519257c3e6cc749991c0efcb5b42c6cdd /tools/kingbird
parent93b952a14863d35dc15b9f03ef45aac2ef69abcf (diff)
parenta4544eab3da82cd1f3351d0577c54be6080616be (diff)
Merge "Fix endpoint URLs"
Diffstat (limited to 'tools/kingbird')
-rwxr-xr-xtools/kingbird/deploy.sh13
-rw-r--r--tools/kingbird/install_kingbird.sh65
2 files changed, 43 insertions, 35 deletions
diff --git a/tools/kingbird/deploy.sh b/tools/kingbird/deploy.sh
index 5a8c6a8..9cca95e 100755
--- a/tools/kingbird/deploy.sh
+++ b/tools/kingbird/deploy.sh
@@ -1,9 +1,13 @@
#!/bin/bash
+set -o xtrace
+set -o nounset
+set -o pipefail
+
INSTALLER_IP=10.20.0.2
usage() {
- echo "usage: $0 -a <installer_ip>" >&2
+ echo "usage: $0 -a <installer_ip>" >&2
}
@@ -42,7 +46,10 @@ sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
"ssh $ssh_options ${controller_ip} \"cd /root/ && chmod +x install_kingbird.sh\"" &> /dev/null
sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
-"ssh $ssh_options ${controller_ip} \"cd /root/ && nohup /root/install_kingbird.sh \"" &> /dev/null
+"ssh $ssh_options ${controller_ip} \"cd /root/ && nohup /root/install_kingbird.sh > install.log 2> /dev/null\"" &> /dev/null
+# Output here
+sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
+"ssh $ssh_options ${controller_ip} \"cd /root/ && cat install.log\""
engine_pid=$(sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} "ssh $ssh_options ${controller_ip} \"pgrep kingbird-engine || echo dead\"") &> /dev/null
api_pid=$(sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} "ssh $ssh_options ${controller_ip} \"pgrep kingbird-api || echo dead\"") &> /dev/null
@@ -53,4 +60,4 @@ fi
if [ "$api_pid" == "dead" ]; then
error "Kingbird API is not running."
-fi \ No newline at end of file
+fi
diff --git a/tools/kingbird/install_kingbird.sh b/tools/kingbird/install_kingbird.sh
index c936aa3..5e716fe 100644
--- a/tools/kingbird/install_kingbird.sh
+++ b/tools/kingbird/install_kingbird.sh
@@ -12,7 +12,8 @@ source openrc
KINGBIRD_PUBLIC_URL=$(openstack endpoint list --long | grep keystone | cut -d '|' -f 6 | cut -d '/' -f 3 | cut -d ':' -f 1)
KINGBIRD_ADMIN_URL=$(openstack endpoint list --long | grep keystone | cut -d '|' -f 7 | cut -d '/' -f 3 | cut -d ':' -f 1)
KINGBIRD_INTERNAL_URL=$(openstack endpoint list --long | grep keystone | cut -d '|' -f 7 | cut -d '/' -f 3 | cut -d ':' -f 1)
-
+KINGBIRD_PORT=8118
+KINGBIRD_VERSION='v1.0'
# MySQL
mysql_host=$(mysql -uroot -se "SELECT SUBSTRING_INDEX(USER(), '@', -1);")
mysql_user='kingbird'
@@ -94,8 +95,8 @@ if [ $? -eq 0 ]; then
echo "User already exists. Skipping.."
else
echo "Creating Kingbird user.."
- openstack user create --project=$admin_tenant_name --password=$admin_password $admin_user
- openstack role add --user=$admin_user --project=$admin_tenant_name admin
+ openstack user create --project=${admin_tenant_name} --password=${admin_password} ${admin_user}
+ openstack role add --user=${admin_user} --project=${admin_tenant_name} admin
fi
#Configure kingbird endpoints
@@ -106,10 +107,10 @@ else
echo "Creating Kingbird endpoints.."
openstack service create --name=kingbird --description="Kingbird" multisite
openstack endpoint create kingbird \
- --publicurl $KINGBIRD_PUBLIC_URL \
- --adminurl $KINGBIRD_ADMIN_URL \
- --internalurl $KINGBIRD_INTERNAL_URL \
- --region $OS_REGION_NAME
+ --publicurl http://${KINGBIRD_PUBLIC_URL}:${KINGBIRD_PORT}/${KINGBIRD_VERSION} \
+ --adminurl http://${KINGBIRD_ADMIN_URL}:${KINGBIRD_PORT}/${KINGBIRD_VERSION} \
+ --internalurl http://${KINGBIRD_INTERNAL_URL}:${KINGBIRD_PORT}/${KINGBIRD_VERSION} \
+ --region ${OS_REGION_NAME}
fi
#Setup Kingbird
@@ -119,43 +120,43 @@ pip install -r requirements.txt
pip install .
mkdir -p /etc/kingbird/
-oslo-config-generator --config-file tools/config-generator.conf --output-file $KINGBIRD_CONF_FILE
+oslo-config-generator --config-file tools/config-generator.conf --output-file ${KINGBIRD_CONF_FILE}
# Delete previous repo clone
cd ..
rm -rf kingbird/
# Configure host section
-iniset $KINGBIRD_CONF_FILE DEFAULT bind_host $bind_host
-iniset $KINGBIRD_CONF_FILE DEFAULT bind_port 8118
-iniset $KINGBIRD_CONF_FILE host_details host $bind_host
+iniset ${KINGBIRD_CONF_FILE} DEFAULT bind_host ${bind_host}
+iniset ${KINGBIRD_CONF_FILE} DEFAULT bind_port ${KINGBIRD_PORT}
+iniset ${KINGBIRD_CONF_FILE} host_details host ${bind_host}
# Configure cache section. Ideally should be removed
-iniset $KINGBIRD_CONF_FILE cache admin_tenant $admin_tenant_name
-iniset $KINGBIRD_CONF_FILE cache admin_username $admin_user
-iniset $KINGBIRD_CONF_FILE cache admin_password $admin_password
-iniset $KINGBIRD_CONF_FILE cache auth_uri $auth_uri
-iniset $KINGBIRD_CONF_FILE cache identity_uri $OS_AUTH_URL
+iniset ${KINGBIRD_CONF_FILE} cache admin_tenant ${admin_tenant_name}
+iniset ${KINGBIRD_CONF_FILE} cache admin_username ${admin_user}
+iniset ${KINGBIRD_CONF_FILE} cache admin_password ${admin_password}
+iniset ${KINGBIRD_CONF_FILE} cache auth_uri ${auth_uri}
+iniset ${KINGBIRD_CONF_FILE} cache identity_uri ${OS_AUTH_URL}
# Configure keystone_authtoken section
-iniset $KINGBIRD_CONF_FILE keystone_authtoken admin_tenant_name $admin_tenant_name
-iniset $KINGBIRD_CONF_FILE keystone_authtoken admin_user $admin_user
-iniset $KINGBIRD_CONF_FILE keystone_authtoken admin_password $admin_password
-iniset $KINGBIRD_CONF_FILE keystone_authtoken auth_uri $auth_uri
-iniset $KINGBIRD_CONF_FILE keystone_authtoken identity_uri $OS_AUTH_URL
+iniset ${KINGBIRD_CONF_FILE} keystone_authtoken admin_tenant_name ${admin_tenant_name}
+iniset ${KINGBIRD_CONF_FILE} keystone_authtoken admin_user ${admin_user}
+iniset ${KINGBIRD_CONF_FILE} keystone_authtoken admin_password ${admin_password}
+iniset ${KINGBIRD_CONF_FILE} keystone_authtoken auth_uri ${auth_uri}
+iniset ${KINGBIRD_CONF_FILE} keystone_authtoken identity_uri ${OS_AUTH_URL}
# Configure RabbitMQ credentials
-iniset $KINGBIRD_CONF_FILE oslo_messaging_rabbit rabbit_userid $rabbit_user
-iniset $KINGBIRD_CONF_FILE oslo_messaging_rabbit rabbit_password $rabbit_password
-iniset $KINGBIRD_CONF_FILE oslo_messaging_rabbit rabbit_hosts $rabbit_hosts
-iniset $KINGBIRD_CONF_FILE oslo_messaging_rabbit rabbit_virtual_host /
-iniset $KINGBIRD_CONF_FILE oslo_messaging_rabbit rabbit_ha_queues False
+iniset ${KINGBIRD_CONF_FILE} oslo_messaging_rabbit rabbit_userid ${rabbit_user}
+iniset ${KINGBIRD_CONF_FILE} oslo_messaging_rabbit rabbit_password ${rabbit_password}
+iniset ${KINGBIRD_CONF_FILE} oslo_messaging_rabbit rabbit_hosts ${rabbit_hosts}
+iniset ${KINGBIRD_CONF_FILE} oslo_messaging_rabbit rabbit_virtual_host /
+iniset ${KINGBIRD_CONF_FILE} oslo_messaging_rabbit rabbit_ha_queues False
# Configure the database.
-iniset $KINGBIRD_CONF_FILE database connection "mysql://$mysql_user:$mysql_pass@$mysql_host/$mysql_db?charset=utf8"
-iniset $KINGBIRD_CONF_FILE database max_overflow -1
-iniset $KINGBIRD_CONF_FILE database max_pool_size 1000
+iniset ${KINGBIRD_CONF_FILE} database connection "mysql://$mysql_user:$mysql_pass@$mysql_host/$mysql_db?charset=utf8"
+iniset ${KINGBIRD_CONF_FILE} database max_overflow -1
+iniset ${KINGBIRD_CONF_FILE} database max_pool_size 1000
# Kill kingbird
if pgrep kingbird-api &> /dev/null ; then pkill -f kingbird-api ; fi
@@ -163,7 +164,7 @@ if pgrep kingbird-engine &> /dev/null ; then pkill -f kingbird-engine ; fi
# Run kingbird
mkdir -p /var/log/kingbird
-kingbird-manage --config-file $KINGBIRD_CONF_FILE db_sync
-nohup kingbird-engine --config-file $KINGBIRD_CONF_FILE --log-file /var/log/kingbird/kingbird-engine.log &
-nohup kingbird-api --config-file $KINGBIRD_CONF_FILE --log-file /var/log/kingbird/kingbird-api.log &
+kingbird-manage --config-file ${KINGBIRD_CONF_FILE} db_sync
+nohup kingbird-engine --config-file ${KINGBIRD_CONF_FILE} --log-file /var/log/kingbird/kingbird-engine.log &
+nohup kingbird-api --config-file ${KINGBIRD_CONF_FILE} --log-file /var/log/kingbird/kingbird-api.log &