From a2835f7abfb80249b486712b1a7b7c108acf59a3 Mon Sep 17 00:00:00 2001 From: "mukesh.paliwal" Date: Fri, 2 Apr 2021 15:59:42 +0530 Subject: docker create failed for so-nssmf-adapter Issue-ID: SO-3611 Signed-off-by: mukesh.paliwal Change-Id: I76d86cf4a14eb5711b2adf8cb09540ea7ac0d82a --- .../src/main/docker/docker-files/Dockerfile.so-app | 1 + .../configs/logging/logback-spring.xml | 8 +-- .../main/docker/docker-files/scripts/start-app.sh | 61 +++++++++++++--------- 3 files changed, 39 insertions(+), 31 deletions(-) (limited to 'packages') diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-app b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app index 1048027..f5ae534 100644 --- a/packages/docker/src/main/docker/docker-files/Dockerfile.so-app +++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app @@ -28,4 +28,5 @@ VOLUME /app/config VOLUME /app/ca-certificates WORKDIR /app +RUN ["chmod", "+x", "/app/start-app.sh"] ENTRYPOINT ["/app/start-app.sh"] diff --git a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml index 693d8c4..492420f 100644 --- a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml +++ b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml @@ -173,15 +173,11 @@ - - - - - + - + diff --git a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh index 54ed9ed..28a3f07 100644 --- a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh +++ b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh @@ -1,36 +1,49 @@ #!/bin/sh -#temprary condition + if [ `id -u` = 0 ] then - # Install certificates found in the /app/ca-certificates volume, if any. + # Install certificates found in the /app/ca-certificates volume, if any. + + needUpdate=FALSE - needUpdate=FALSE + for certificate in `ls -1 /app/ca-certificates`; do + echo "Installing $certificate in /usr/local/share/ca-certificates" + cp /app/ca-certificates/$certificate /usr/local/share/ca-certificates/$certificate + needUpdate=TRUE + done - for certificate in `ls -1 /app/ca-certificates`; do - echo "Installing $certificate in /usr/local/share/ca-certificates" - # cp /app/ca-certificates/$certificate /usr/local/share/ca-certificates/$certificate - needUpdate=FALSE - done + if [ $needUpdate = TRUE ]; then + update-ca-certificates --fresh + fi - # Re-exec this script as the 'onap' user. - this=`readlink -f $0` - # exec su so -c "$this" + # Re-exec this script as the 'onap' user. + this=`readlink -f $0` + exec su so -c "$this" fi touch /app/app.jar +if [ -z "$APP" ]; then + echo "CONFIG ERROR: APP environment variable not set" + exit 1 +fi + if [ ! -z "$DB_HOST" -a -z "$DB_PORT" ]; then - export DB_PORT=3306 + export DB_PORT=3306 fi if [ -z "${CONFIG_PATH}" ]; then - export CONFIG_PATH=/app/config/override.yaml + export CONFIG_PATH=/app/config/override.yaml +fi + +if [ -z "${LOG_PATH}" ]; then + export LOG_PATH="logs/${APP}" fi if [ "${SSL_DEBUG}" = "log" ]; then - export SSL_DEBUG="-Djavax.net.debug=all" + export SSL_DEBUG="-Djavax.net.debug=all" else - export SSL_DEBUG= + export SSL_DEBUG= fi # Set java keystore and truststore options, if specified in the environment. @@ -38,18 +51,18 @@ fi jksargs= if [ ! -z "${KEYSTORE}" ]; then - jksargs="$jksargs -Dmso.load.ssl.client.keystore=true" - jksargs="$jksargs -Djavax.net.ssl.keyStore=$KEYSTORE" - jksargs="$jksargs -Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASSWORD}" + jksargs="$jksargs -Dmso.load.ssl.client.keystore=true" + jksargs="$jksargs -Djavax.net.ssl.keyStore=$KEYSTORE" + jksargs="$jksargs -Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASSWORD}" fi if [ ! -z "${TRUSTSTORE}" ]; then - jksargs="$jksargs -Djavax.net.ssl.trustStore=${TRUSTSTORE}" - jksargs="$jksargs -Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWORD}" + jksargs="$jksargs -Djavax.net.ssl.trustStore=${TRUSTSTORE}" + jksargs="$jksargs -Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWORD}" fi if [ -z "${ACTIVE_PROFILE}" ]; then - export ACTIVE_PROFILE="basic" + export ACTIVE_PROFILE="basic" fi jvmargs="${JVM_ARGS} -Dspring.profiles.active=${ACTIVE_PROFILE} -Djava.security.egd=file:/dev/./urandom -Dlogs_dir=${LOG_PATH} -Dlogging.config=/app/logback-spring.xml $jksargs -Dspring.config.additional-location=$CONFIG_PATH ${SSL_DEBUG} ${DISABLE_SNI}" @@ -68,8 +81,6 @@ read_properties(){ EOF } - - if [ -n "${AAF_SSL_CERTS_ENABLED}" ]; then read_properties "$(head -n 4 /app/certs/.passphrases)" fi @@ -82,8 +93,8 @@ rc=$? echo "Application exiting with status code $rc" if [ ! -z "${EXIT_DELAY}" -a "${EXIT_DELAY}" != 0 ]; then - echo "Delaying $APP exit for $EXIT_DELAY seconds" - sleep $EXIT_DELAY + echo "Delaying $APP exit for $EXIT_DELAY seconds" + sleep $EXIT_DELAY fi exit $rc -- cgit 1.2.3-korg