From 5b77bf9d7587f8f3c5add03285507e2368603353 Mon Sep 17 00:00:00 2001 From: "Kajur, Harish (vk250x)" Date: Thu, 29 Mar 2018 00:38:13 -0400 Subject: Update docker entrypoint to run independent Issue-ID: AAI-949 Change-Id: Ie8a2967c7db4d8632c2485389ab735c5420d6edd Signed-off-by: Kajur, Harish (vk250x) --- aai-resources/src/main/docker/docker-entrypoint.sh | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'aai-resources/src/main/docker/docker-entrypoint.sh') diff --git a/aai-resources/src/main/docker/docker-entrypoint.sh b/aai-resources/src/main/docker/docker-entrypoint.sh index d268888..6f9ed65 100644 --- a/aai-resources/src/main/docker/docker-entrypoint.sh +++ b/aai-resources/src/main/docker/docker-entrypoint.sh @@ -54,7 +54,33 @@ if [ -f ${APP_HOME}/aai.sh ]; then mv ${APP_HOME}/aai.sh /etc/profile.d/aai.sh chmod 755 /etc/profile.d/aai.sh - gosu aaiadmin /opt/app/aai-resources/scripts/createDBSchema.sh || exit 1 + scriptName=$1; + + if [ ! -z $scriptName ]; then + + if [ -f ${APP_HOME}/bin/${scriptName} ]; then + shift 1; + gosu aaiadmin ${APP_HOME}/bin/${scriptName} "$@" || { + echo "Failed to run the ${scriptName}"; + exit 1; + } + else + echo "Unable to find the script ${scriptName} in ${APP_HOME}/bin"; + exit 1; + fi; + + exit 0; + fi; + + + # If in the environment file skip create db schema there is a value set + # Then it will skip the create db schema at startup + # This is a workaround that will be there temporarily + # Ideally createDBSchema should be run from chef + # Or run without having to startup the application + if [ -z ${SKIP_CREATE_DB_SCHEMA_AT_STARTUP} ]; then + gosu aaiadmin /opt/app/aai-resources/scripts/createDBSchema.sh || exit 1 + fi; fi; JAVA_CMD="exec gosu aaiadmin java"; -- cgit 1.2.3-korg