Separated start-app.sh for bpmn-infra 96/123896/4
authorMD IRSHAD SHEIKH <md.irshad.sheikh@huawei.com>
Mon, 6 Sep 2021 14:58:57 +0000 (20:28 +0530)
committerMD IRSHAD SHEIKH <md.irshad.sheikh@huawei.com>
Wed, 8 Sep 2021 13:41:35 +0000 (19:11 +0530)
Issue-ID: SO-3674

Signed-off-by: MD IRSHAD SHEIKH <md.irshad.sheikh@huawei.com>
Change-Id: I0c1ccc418091adbcf55931a32c1390468d90fdc8

packages/docker/pom.xml
packages/docker/src/main/docker/docker-files/Dockerfile.so-bpmn-infra
packages/docker/src/main/docker/docker-files/scripts/bpmn-script/start-camunda-app.sh [new file with mode: 0755]
packages/docker/src/main/docker/docker-files/scripts/start-app.sh

index 8175eaf..fde5a81 100644 (file)
                         <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>
index 8c28e04..d317cac 100644 (file)
@@ -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 (executable)
index 0000000..ca1ff43
--- /dev/null
@@ -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
index b6938ae..abf753d 100755 (executable)
@@ -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