aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdocker/base/service_hosts.sh4
-rwxr-xr-xdocker/fedora-rdo-base/wait_for85
-rwxr-xr-xdocker/glance/glance-api/start.sh27
-rw-r--r--docker/glance/glance-base/config-glance.sh4
-rw-r--r--docker/glance/glance-registry/Dockerfile3
-rwxr-xr-xdocker/glance/glance-registry/start.sh2
6 files changed, 119 insertions, 6 deletions
diff --git a/docker/base/service_hosts.sh b/docker/base/service_hosts.sh
index af8c643cf..c3006f720 100755
--- a/docker/base/service_hosts.sh
+++ b/docker/base/service_hosts.sh
@@ -20,9 +20,9 @@
: ${HEAT_API_SERVICE_PORT:=8004}
: ${HORIZON_SERVICE_HOST:=$HORIZON_PORT_80_TCP_ADDR}
: ${HORIZON_SERVICE_PORT:=80}
-: ${KEYSTONE_ADMIN_SERVICE_HOST:=$KEYSTONE_ADMIN_PORT_35357_TCP_ADDR}
+: ${KEYSTONE_ADMIN_SERVICE_HOST:=$KEYSTONE_PORT_35357_TCP_ADDR}
: ${KEYSTONE_ADMIN_SERVICE_PORT:=35357}
-: ${KEYSTONE_PUBLIC_SERVICE_HOST:=$KEYSTONE_PUBLIC_PORT_5000_TCP_ADDR}
+: ${KEYSTONE_PUBLIC_SERVICE_HOST:=$KEYSTONE_PORT_5000_TCP_ADDR}
: ${KEYSTONE_PUBLIC_SERVICE_PORT:=5000}
: ${MARIADB_SERVICE_HOST:=$MARIADB_PORT_3306_TCP_ADDR}
: ${MARIADB_SERVICE_PORT:=3306}
diff --git a/docker/fedora-rdo-base/wait_for b/docker/fedora-rdo-base/wait_for
new file mode 100755
index 000000000..16f2cc8c8
--- /dev/null
+++ b/docker/fedora-rdo-base/wait_for
@@ -0,0 +1,85 @@
+#!/bin/bash
+# Based on
+# https://raw.githubusercontent.com/openstack/tripleo-incubator/6931c1fc7ed98ce36998c5b82750a880b0365445/scripts/wait_for
+#
+# Copyright 2013 Red Hat
+# All Rights Reserved.
+#
+# 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.
+
+set -e # exit on the first non-zero status
+set -u # exit on unset variables
+#set -x # setting this actually breaks the scripts function
+
+SCRIPT_NAME=$(basename $0)
+
+
+function show_options() {
+ echo "Usage: $SCRIPT_NAME LOOPS_NUMBER SLEEP_TIME ARGS"
+ echo
+ echo "ARGS are read and concatenated together into a single command."
+ echo "Execute the command in a loop until it succeeds or the number"
+ echo "of attempts exceeds LOOPS_NUMBER value. After each failure"
+ echo "pause for SLEEP_TIME seconds."
+ echo
+ echo "An optional FAIL_MATCH_OUTPUT variable may also be set to control "
+ echo "if the loop exits early if the commands stdout/stderr matches the "
+ echo "supplied regex string."
+ echo
+ echo "Examples:"
+ echo " wait_for 30 10 ping -c 1 192.0.2.2"
+ echo " wait_for 10 1 ls file_we_are_waiting_for"
+ echo " wait_for 10 3 date \| grep 8"
+ echo " FAIL_MATCH_OUTPUT=CREATE_FAILED wait_for 30 10 heat stack-show undercloud"
+ echo " SUCCESSFUL_MATCH_OUTPUT=CREATE_COMPLETE wait_for 30 10 heat stack-show undercloud"
+ exit 1
+}
+
+
+LOOPS=${1:-""}
+SLEEPTIME=${2:-""}
+FAIL_MATCH_OUTPUT=${FAIL_MATCH_OUTPUT:-""}
+SUCCESSFUL_MATCH_OUTPUT=${SUCCESSFUL_MATCH_OUTPUT:-""}
+shift 2 || true
+COMMAND="$@"
+
+if [ -z "$LOOPS" -o -z "$SLEEPTIME" -o -z "$COMMAND" ]; then
+ show_options
+fi
+
+
+i=0
+while [ $i -lt $LOOPS ]; do
+ i=$((i + 1))
+ STATUS=0
+ OUTPUT=$(eval $COMMAND 2>&1) || STATUS=$?
+ if [[ -n "$SUCCESSFUL_MATCH_OUTPUT" ]] \
+ && [[ $OUTPUT =~ $SUCCESSFUL_MATCH_OUTPUT ]]; then
+ exit 0
+ elif [[ -n "$FAIL_MATCH_OUTPUT" ]] \
+ && [[ $OUTPUT =~ $FAIL_MATCH_OUTPUT ]]; then
+ echo "Command output matched '$FAIL_MATCH_OUTPUT'. Exiting..."
+ exit 1
+ elif [[ -z "$SUCCESSFUL_MATCH_OUTPUT" ]] && [[ $STATUS -eq 0 ]]; then
+ # The command successfully completed and we aren't testing against
+ # it's output so we have finished waiting.
+ exit 0
+ fi
+
+ sleep $SLEEPTIME
+done
+SECONDS=$((LOOPS * SLEEPTIME))
+printf 'Timing out after %d seconds:\nCOMMAND=%s\nOUTPUT=%s\n' \
+ "$SECONDS" "$COMMAND" "$OUTPUT"
+exit 1
+
diff --git a/docker/glance/glance-api/start.sh b/docker/glance/glance-api/start.sh
index c94db2ebc..851835449 100755
--- a/docker/glance/glance-api/start.sh
+++ b/docker/glance/glance-api/start.sh
@@ -4,11 +4,17 @@ set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-glance.sh
+: ${GLANCE_API_SERVICE_HOST:=$PUBLIC_IP}
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \
GLANCE_KEYSTONE_USER GLANCE_KEYSTONE_PASSWORD \
ADMIN_TENANT_NAME GLANCE_API_SERVICE_HOST \
PUBLIC_IP
+
+/opt/kolla/wait_for 30 1 keystone \
+ --os-auth-url=http://${KEYSTONE_PUBLIC_SERVICE_HOST}:35357/v2.0 \
+ --os-username=admin --os-tenant-name=${ADMIN_TENANT_NAME} \
+ --os-password=${KEYSTONE_ADMIN_PASSWORD} endpoint-list
check_for_keystone
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
@@ -26,4 +32,25 @@ crux endpoint-create --remove-all \
-P "http://${PUBLIC_IP}:9292" \
-A "http://${GLANCE_API_SERVICE_HOST}:9292"
+# turn on notification sending by glance
+crudini --set /etc/glance/glance-api.conf \
+ DEFAULT \
+ notification_driver \
+ "messaging"
+
+crudini --set /etc/glance/glance-api.conf \
+ DEFAULT \
+ rabbit_host \
+ "${RABBITMQ_SERVICE_HOST}"
+
+crudini --set /etc/glance/glance-api.conf \
+ DEFAULT \
+ registry_host \
+ "${GLANCE_REGISTRY_SERVICE_HOST}"
+
+crudini --set /etc/glance/glance-api.conf \
+ DEFAULT \
+ debug \
+ "True"
+
exec /usr/bin/glance-api
diff --git a/docker/glance/glance-base/config-glance.sh b/docker/glance/glance-base/config-glance.sh
index 2a6e54caa..a6380e5c8 100644
--- a/docker/glance/glance-base/config-glance.sh
+++ b/docker/glance/glance-base/config-glance.sh
@@ -11,9 +11,7 @@ set -e
: ${KEYSTONE_AUTH_PROTOCOL:=http}
: ${PUBLIC_IP:=$GLANCE_API_PORT_9292_TCP_ADDR}
-check_for_db
-check_required_vars GLANCE_DB_PASSWORD GLANCE_KEYSTONE_PASSWORD \
- KEYSTONE_PUBLIC_SERVICE_HOST
+check_required_vars GLANCE_DB_PASSWORD GLANCE_KEYSTONE_PASSWORD
dump_vars
cat > /openrc <<EOF
diff --git a/docker/glance/glance-registry/Dockerfile b/docker/glance/glance-registry/Dockerfile
index fc8442516..2510f8eb0 100644
--- a/docker/glance/glance-registry/Dockerfile
+++ b/docker/glance/glance-registry/Dockerfile
@@ -1,6 +1,7 @@
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%glance-base
MAINTAINER Kolla Project (https://launchpad.net/kolla)
+EXPOSE 9191
+
ADD ./start.sh /start.sh
CMD ["/start.sh"]
-
diff --git a/docker/glance/glance-registry/start.sh b/docker/glance/glance-registry/start.sh
index 5521d5b7e..865e60b87 100755
--- a/docker/glance/glance-registry/start.sh
+++ b/docker/glance/glance-registry/start.sh
@@ -6,6 +6,8 @@ set -e
. /opt/kolla/config-glance.sh
check_required_vars GLANCE_DB_NAME GLANCE_DB_USER GLANCE_DB_PASSWORD
+# lets wait for the DB to be available
+./opt/kolla/wait_for 25 1 mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" -e 'status;'
check_for_db
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF