diff options
author | MD IRSHAD SHEIKH <md.irshad.sheikh@huawei.com> | 2021-09-06 20:28:57 +0530 |
---|---|---|
committer | MD IRSHAD SHEIKH <md.irshad.sheikh@huawei.com> | 2021-09-08 19:11:35 +0530 |
commit | 9803fbbfa0649f471561dcc77582e00d9a9c7d19 (patch) | |
tree | bc0faf038633aa36e0af9195797225485fe81cbe | |
parent | 2f9df255cc2af42a0785bac1cb40747e28c1d802 (diff) |
Separated start-app.sh for bpmn-infra
Issue-ID: SO-3674
Signed-off-by: MD IRSHAD SHEIKH <md.irshad.sheikh@huawei.com>
Change-Id: I0c1ccc418091adbcf55931a32c1390468d90fdc8
4 files changed, 85 insertions, 78 deletions
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 @@ <includes> <include>org.onap.so:mso-infrastructure-bpmn:war</include> </includes> - <outputFileNameMapping>app.war</outputFileNameMapping> + <outputFileNameMapping>mso.war</outputFileNameMapping> </dependencySet> + <dependencySet> + <includes> + <include>org.mariadb.jdbc:mariadb-java-client:jar</include> + </includes> + </dependencySet> + <outputFileNameMapping>mariadb-java-client.jar</outputFileNameMapping> </dependencySets> </inline> </assembly> 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 |