From: Eduardo Sousa Date: Mon, 8 Oct 2018 11:49:14 +0000 (+0100) Subject: Updating Keystone installation X-Git-Tag: v5.0.0~82 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=07e8a24b07bd15fe06d823210bc9ca806811a1d1;p=osm%2Fdevops.git Updating Keystone installation Updating the Keystone installer script and dockerfile. Change-Id: I78b9b7f363a3dba0701754846dc4bbee2fa5e6e3 Signed-off-by: Eduardo Sousa --- diff --git a/docker/Keystone/Dockerfile b/docker/Keystone/Dockerfile index 91635626..263716a0 100644 --- a/docker/Keystone/Dockerfile +++ b/docker/Keystone/Dockerfile @@ -21,25 +21,12 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* && \ chmod +x start.sh -# DB Hostname -ENV DB_HOST keystone-db - -# DB Port -ENV DB_PORT 3306 - -# DB Root User -ENV ROOT_DB_USER root - -# DB Root Password -ENV ROOT_DB_PASSWORD admin - -# Keystone user password -ENV KEYSTONE_DB_PASSWORD admin - -# Admin password -ENV ADMIN_PASSWORD admin - -# NBI password -ENV NBI_PASSWORD nbi - -ENTRYPOINT ./start.sh \ No newline at end of file +ENV DB_HOST keystone-db # DB Hostname +ENV DB_PORT 3306 # DB Port +ENV ROOT_DB_USER root # DB Root User +ENV ROOT_DB_PASSWORD admin # DB Root Password +ENV KEYSTONE_DB_PASSWORD admin # Keystone user password +ENV ADMIN_PASSWORD admin # Admin password +ENV NBI_PASSWORD nbi # NBI password + +ENTRYPOINT ./start.sh diff --git a/docker/Keystone/scripts/start.sh b/docker/Keystone/scripts/start.sh index 4d95c609..1e3709e4 100755 --- a/docker/Keystone/scripts/start.sh +++ b/docker/Keystone/scripts/start.sh @@ -1,5 +1,7 @@ #!/bin/bash +DB_EXISTS="" + max_attempts=120 function wait_db(){ db_host=$1 @@ -27,8 +29,7 @@ function is_db_created() { db_pswd=$4 db_name=$5 - RESULT=`mysqlshow -h"$db_host" -P"$db_port" -u"$db_user" -p"$db_pswd" | grep -v Wildcard | grep -o $db_name` - if [ "$RESULT" == "$db_name" ]; then + if mysqlshow -h"$db_host" -P"$db_port" -u"$db_user" -p"$db_pswd" | grep -v Wildcard | grep -q $db_name; then echo "DB $db_name exists" return 0 else @@ -94,9 +95,11 @@ if [ -z $DB_EXISTS ]; then openstack role add --project service --user nbi admin fi -while [ $(ps -ef | grep -v grep | grep apache2 | wc -l) -ne 0 ] +while ps -ef | grep -v grep | grep -q apache2 do sleep 60 done +# Only reaches this point if apache2 stops running +# When this happens exits with error code exit 1