From 9803fbbfa0649f471561dcc77582e00d9a9c7d19 Mon Sep 17 00:00:00 2001 From: MD IRSHAD SHEIKH Date: Mon, 6 Sep 2021 20:28:57 +0530 Subject: Separated start-app.sh for bpmn-infra Issue-ID: SO-3674 Signed-off-by: MD IRSHAD SHEIKH Change-Id: I0c1ccc418091adbcf55931a32c1390468d90fdc8 --- packages/docker/pom.xml | 8 +- .../docker/docker-files/Dockerfile.so-bpmn-infra | 5 +- .../scripts/bpmn-script/start-camunda-app.sh | 31 ++++++ .../main/docker/docker-files/scripts/start-app.sh | 119 ++++++++------------- 4 files changed, 85 insertions(+), 78 deletions(-) create mode 100755 packages/docker/src/main/docker/docker-files/scripts/bpmn-script/start-camunda-app.sh diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index 8175eafc43..fde5a81216 100644 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -239,8 +239,14 @@ org.onap.so:mso-infrastructure-bpmn:war - app.war + mso.war + + + org.mariadb.jdbc:mariadb-java-client:jar + + + mariadb-java-client.jar diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-bpmn-infra b/packages/docker/src/main/docker/docker-files/Dockerfile.so-bpmn-infra index 8c28e04d76..d317cac0da 100644 --- a/packages/docker/src/main/docker/docker-files/Dockerfile.so-bpmn-infra +++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-bpmn-infra @@ -22,6 +22,7 @@ USER $user # Springboot configuration (required) VOLUME /camunda/app/config -COPY maven/app.war /camunda/webapps/mso.war +COPY maven/mso.war /camunda/webapps COPY scripts/wait-for.sh /camunda -COPY scripts/start-app.sh /camunda +COPY scripts/bpmn-script/start-camunda-app.sh /camunda +COPY maven/mariadb-java-client.jar /camunda/lib \ No newline at end of file diff --git a/packages/docker/src/main/docker/docker-files/scripts/bpmn-script/start-camunda-app.sh b/packages/docker/src/main/docker/docker-files/scripts/bpmn-script/start-camunda-app.sh new file mode 100755 index 0000000000..ca1ff43a68 --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/scripts/bpmn-script/start-camunda-app.sh @@ -0,0 +1,31 @@ +#!/bin/sh +if [ `id -u` = 0 ] +then + # Install certificates found in the /app/ca-certificates volume, if any. + needUpdate=FALSE + + for certificate in `ls -1 /camunda/app/ca-certificates`; do + echo "Installing $certificate in /usr/local/share/ca-certificates" + cp /camunda/app/ca-certificates/$certificate /usr/local/share/ca-certificates/$certificate + needUpdate=TRUE + done + + if [ $needUpdate = TRUE ]; then + update-ca-certificates --fresh + fi + + # Re-exec this script as the 'so' user. + this=`readlink -f $0` + exec su so -c "$this" +fi + +if [ -z "${CONFIG_PATH}" ]; then + export CONFIG_PATH=/camunda/app/config/override.yaml +fi + +if [ -n "${AAF_SSL_CERTS_ENABLED}" ]; then + read_properties "$(head -n 4 /camunda/app/certs/.passphrases)" +fi + +# Running camunda.sh +./camunda.sh \ No newline at end of file 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 b6938ae951..abf753d0f9 100755 --- 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,84 +1,61 @@ #!/bin/sh -#Copying mariadb-java-client for connectivity to mariadb -if [ ${APP} = "bpmn-infra" ]; then - unzip /camunda/webapps/mso.war - cp /camunda/WEB-INF/lib/mariadb-java-client-2.6.2.jar /camunda/lib -fi - if [ `id -u` = 0 ] then - # Install certificates found in the /app/ca-certificates volume, if any. - - needUpdate=FALSE - if [ ${APP} = "bpmn-infra" ]; then - for certificate in `ls -1 /camunda/app/ca-certificates`; do - echo "Installing $certificate in /usr/local/share/ca-certificates" - cp /camunda/app/ca-certificates/$certificate /usr/local/share/ca-certificates/$certificate - needUpdate=TRUE - done - else - 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 - fi + # Install certificates found in the /app/ca-certificates volume, if any. + + needUpdate=FALSE - if [ $needUpdate = TRUE ]; then - update-ca-certificates --fresh - fi - - if [ ${APP} = "bpmn-infra" ]; then - # Re-exec this script as the 'camunda' user. - this=`readlink -f $0` - exec su camunda -c "$this" - else - # Re-exec this script as the 'onap' user. - this=`readlink -f $0` - exec su so -c "$this" + 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 + + 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" fi touch /app/app.jar if [ -z "$APP" ]; then - echo "CONFIG ERROR: APP environment variable not set" - exit 1 + 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}" + export LOG_PATH="logs/${APP}" fi if [ ${APP} = "sdc-controller" ]; then - ln -s ${LOG_PATH} ASDC -fi - -if [ ${APP} = "bpmn-infra" ]; then - ln -s ${LOG_PATH} BPMN + ln -s ${LOG_PATH} ASDC fi if [ ${APP} = "so-monitoring" ]; then - ln -s ${LOG_PATH} MONITORING + ln -s ${LOG_PATH} MONITORING fi if [ ${APP} = "openstack-adapter" ]; then - export DISABLE_SNI="-Djsse.enableSNIExtension=false" + export DISABLE_SNI="-Djsse.enableSNIExtension=false" 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. @@ -86,18 +63,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}" @@ -112,34 +89,26 @@ read_properties(){ export "$eKey"="$value" esac done <<-EOF - $1 - EOF + $1 +EOF } -if [ ${APP} = "bpmn-infra" ]; then - if [ -n "${AAF_SSL_CERTS_ENABLED}" ]; then - read_properties "$(head -n 4 /camunda/app/certs/.passphrases)" - fi -else - if [ -n "${AAF_SSL_CERTS_ENABLED}" ]; then - read_properties "$(head -n 4 /app/certs/.passphrases)" - fi + +if [ -n "${AAF_SSL_CERTS_ENABLED}" ]; then +read_properties "$(head -n 4 /app/certs/.passphrases)" fi echo "JVM Arguments: ${jvmargs}" -if [ ! ${APP} = "bpmn-infra" ]; then - java ${jvmargs} -jar app.jar - rc=$? - echo "Application exiting with status code $rc" +java ${jvmargs} -jar app.jar +rc=$? - if [ ! -z "${EXIT_DELAY}" -a "${EXIT_DELAY}" != 0 ]; then - echo "Delaying $APP exit for $EXIT_DELAY seconds" - sleep $EXIT_DELAY - fi +echo "Application exiting with status code $rc" - exit $rc -else - ./camunda.sh +if [ ! -z "${EXIT_DELAY}" -a "${EXIT_DELAY}" != 0 ]; then + echo "Delaying $APP exit for $EXIT_DELAY seconds" + sleep $EXIT_DELAY fi + +exit $rc \ No newline at end of file -- cgit 1.2.3-korg