From 1491a35b4577aebaf5f4533a1d62a31f2e9c90d4 Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Thu, 26 Jun 2025 12:43:35 -0500 Subject: [PATCH 1/4] Added docker build and quick-start (without entrypoint and oieserver scripts) Signed-off-by: Mitch Gaffigan --- .dockerignore | 62 +++++++++++++++++++++++++++++++++++++ DEVELOPERS.md | 33 ++++++++++++++++++++ Dockerfile | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 .dockerignore create mode 100644 DEVELOPERS.md create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..8893889f6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,62 @@ +# Include any files or directories that you don't want to be copied to your +# container here (e.g., local build artifacts, temporary files, etc.). +# +# For more help, visit the .dockerignore file reference guide at +# https://docs.docker.com/go/build-context-dockerignore/ + +**/.DS_Store +**/.classpath +**/.dockerignore +**/.env +**/.factorypath +**/.git +**/.gitignore +**/.idea +**/.project +**/.sts4-cache +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.next +**/.cache +**/*.dbmdl +**/*.jfm +**/charts +**/docker-compose* +**/compose.y*ml +**/Dockerfile* +**/secrets.dev.yaml +**/values.dev.yaml +**/vendor +LICENSE +README.md +**/*.class +**/*.iml +**/*.ipr +**/*.iws +**/*.log +**/.apt_generated +**/.gradle +**/.gradletasknamecache +**/.nb-gradle +**/.springBeans +**/build +**/dist +**/gradle-app.setting +**/nbbuild +**/nbdist +**/nbproject/private +**/target +*.ctxt +.mtj.tmp +.mvn/timing.properties +buildNumber.properties +dependency-reduced-pom.xml +hs_err_pid* +pom.xml.next +pom.xml.releaseBackup +pom.xml.tag +pom.xml.versionsBackup +release.properties +replay_pid* \ No newline at end of file diff --git a/DEVELOPERS.md b/DEVELOPERS.md new file mode 100644 index 000000000..589987697 --- /dev/null +++ b/DEVELOPERS.md @@ -0,0 +1,33 @@ +# For developers and contributors + +## "Easy Path" with docker + +```bash +# Build using docker +docker build -t oie-dev . +# Start an ephemeral image +# NOTE: All data will be deleted on stop due to --rm. Use a volume for "real" use. +docker run --rm -p 8443:8443 oie-dev +``` + +Then use [Ballista](https://github.com/kayyagari/ballista) to connect to +https://localhost:8443/ and login using admin admin. + +## Build Environment + +To build the solution, you must have a Java 1.8 JDK+FX and Apache Ant. This +can be installed by [sdkman](https://sdkman.io/) by executing `sdkman env install`. + +## Build Process + +From the `server/` directory, run `ant -f mirth-build.xml -DdisableSigning=true`. + +If you are using Mirth Connect Administrator Launcher, you may need to omit +`-DdisableSigning=true` to support JWS signatures. Launchers like +[Ballista](https://github.com/kayyagari/ballista) do not require signing, and +signing adds considerable time to the build process. + +## Run + +After build, run the server by invoking `server/mirth-server-launcher.jar`. An +example of how to do this is listed in `docker/mirth-connect.sh`. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..262eae281 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,85 @@ +# syntax=docker/dockerfile:1.7-labs + +# Stages: +# 1. Builder Stage: Compiles the application and resolves dependencies. Produces +# JAR files that can be deployed. +# 1a. Install dependencies +# 1b. Build the application +# 2. Runner Stage: Creates a lightweight image that runs the application using the JRE. + +FROM ubuntu:noble-20250415.1 AS builder +WORKDIR /app +# sdkman requires bash +SHELL ["/bin/bash", "-c"] + +# Stage 1a: Install dependencies +# Install necessary tools +COPY .sdkmanrc . +RUN apt-get update\ + && apt-get install -y zip curl\ + && curl -s "https://get.sdkman.io?ci=true" | bash \ + && source "$HOME/.sdkman/bin/sdkman-init.sh" && sdk env install \ + && rm -rf /var/lib/apt/lists/* + +# Stage 1b: Build the application +# Copy the entire source tree (excluding .dockerignore files), and build +COPY --exclude=docker . . +WORKDIR /app/server +RUN source "$HOME/.sdkman/bin/sdkman-init.sh" \ + && ANT_OPTS="-Dfile.encoding=UTF8" ant -f mirth-build.xml -DdisableSigning=true + +# Stage 2b: JDK runtime container +FROM eclipse-temurin:21.0.7_6-jdk-noble as jdk-run + +RUN groupadd mirth \ + && usermod -l mirth ubuntu \ + && adduser mirth mirth \ + && mkdir -p /opt/connect/appdata \ + && chown -R mirth:mirth /opt/connect + +WORKDIR /opt/connect +COPY --chown=mirth:mirth --from=builder \ + --exclude=cli-lib \ + --exclude=mirth-cli-launcher.jar \ + --exclude=mccommand \ + --exclude=manager-lib \ + --exclude=mirth-manager-launcher.jar \ + --exclude=mcmanager \ + /app/server/setup ./ + +VOLUME /opt/connect/appdata +VOLUME /opt/connect/custom-extensions +EXPOSE 8443 + +USER mirth +ENTRYPOINT [ "/opt/connect/entrypoint.sh" ] +CMD ["/opt/connect/mirth-connect.sh"] + +# Stage 2b: JRE runtime container +FROM eclipse-temurin:21.0.7_6-jre-alpine as jre-run + +# Alpine does not include bash by default, so we install it +RUN apk add --no-cache bash +# useradd and groupadd are not available in Alpine +RUN addgroup -S mirth \ + && adduser -S -g mirth mirth \ + && mkdir -p /opt/connect/appdata \ + && chown -R mirth:mirth /opt/connect + +WORKDIR /opt/connect +COPY --chown=mirth:mirth --from=builder \ + --exclude=cli-lib \ + --exclude=mirth-cli-launcher.jar \ + --exclude=mccommand \ + --exclude=manager-lib \ + --exclude=mirth-manager-launcher.jar \ + --exclude=mcmanager \ + /app/server/setup ./ + +VOLUME /opt/connect/appdata +VOLUME /opt/connect/custom-extensions +EXPOSE 8443 + +USER mirth +ENTRYPOINT [ "/opt/connect/entrypoint.sh" ] +CMD ["/opt/connect/mirth-connect.sh"] From 6b7246fe0c94a96e58f20513c502983b24a2137a Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Thu, 26 Jun 2025 12:49:03 -0500 Subject: [PATCH 2/4] Updated MCAL language to addresss self-signed certs Signed-off-by: Mitch Gaffigan --- DEVELOPERS.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DEVELOPERS.md b/DEVELOPERS.md index 589987697..7dd509f53 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -23,8 +23,9 @@ can be installed by [sdkman](https://sdkman.io/) by executing `sdkman env instal From the `server/` directory, run `ant -f mirth-build.xml -DdisableSigning=true`. If you are using Mirth Connect Administrator Launcher, you may need to omit -`-DdisableSigning=true` to support JWS signatures. Launchers like -[Ballista](https://github.com/kayyagari/ballista) do not require signing, and +`-DdisableSigning=true` to support JWS signatures and run MCAL passing `-k -d` +to make it ignore self-signed certificates. Launchers like +[Ballista](https://github.com/kayyagari/ballista) do not require signing, and signing adds considerable time to the build process. ## Run From 70e8e87acfdab1b8c882f94442272795da701c5f Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Thu, 26 Jun 2025 13:39:08 -0500 Subject: [PATCH 3/4] Match release dockerfile patterns in dev dockerfile Signed-off-by: Mitch Gaffigan --- Dockerfile | 63 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index 262eae281..c5d7c79a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,17 +28,23 @@ WORKDIR /app/server RUN source "$HOME/.sdkman/bin/sdkman-init.sh" \ && ANT_OPTS="-Dfile.encoding=UTF8" ant -f mirth-build.xml -DdisableSigning=true -# Stage 2b: JDK runtime container +########################################## +# +# Ubuntu JDK Image +# +########################################## + FROM eclipse-temurin:21.0.7_6-jdk-noble as jdk-run -RUN groupadd mirth \ - && usermod -l mirth ubuntu \ - && adduser mirth mirth \ - && mkdir -p /opt/connect/appdata \ - && chown -R mirth:mirth /opt/connect +RUN groupadd engine \ + && usermod -l engine ubuntu \ + && adduser engine engine \ + && mkdir -p /opt/engine/appdata \ + && chown -R engine:engine /opt/engine -WORKDIR /opt/connect -COPY --chown=mirth:mirth --from=builder \ +WORKDIR /opt/engine +COPY --chmod=0755 docker/entrypoint.sh ./ +COPY --chown=engine:engine --from=builder \ --exclude=cli-lib \ --exclude=mirth-cli-launcher.jar \ --exclude=mccommand \ @@ -47,27 +53,33 @@ COPY --chown=mirth:mirth --from=builder \ --exclude=mcmanager \ /app/server/setup ./ -VOLUME /opt/connect/appdata -VOLUME /opt/connect/custom-extensions +VOLUME /opt/engine/appdata +VOLUME /opt/engine/custom-extensions EXPOSE 8443 -USER mirth -ENTRYPOINT [ "/opt/connect/entrypoint.sh" ] -CMD ["/opt/connect/mirth-connect.sh"] +USER engine +ENTRYPOINT ["./entrypoint.sh"] +CMD ["./oieserver"] + +########################################## +# +# Alpine JRE Image +# +########################################## -# Stage 2b: JRE runtime container FROM eclipse-temurin:21.0.7_6-jre-alpine as jre-run # Alpine does not include bash by default, so we install it RUN apk add --no-cache bash # useradd and groupadd are not available in Alpine -RUN addgroup -S mirth \ - && adduser -S -g mirth mirth \ - && mkdir -p /opt/connect/appdata \ - && chown -R mirth:mirth /opt/connect +RUN addgroup -S engine \ + && adduser -S -g engine engine \ + && mkdir -p /opt/engine/appdata \ + && chown -R engine:engine /opt/engine -WORKDIR /opt/connect -COPY --chown=mirth:mirth --from=builder \ +WORKDIR /opt/engine +COPY --chmod=0755 docker/entrypoint.sh ./ +COPY --chown=engine:engine --from=builder \ --exclude=cli-lib \ --exclude=mirth-cli-launcher.jar \ --exclude=mccommand \ @@ -76,10 +88,11 @@ COPY --chown=mirth:mirth --from=builder \ --exclude=mcmanager \ /app/server/setup ./ -VOLUME /opt/connect/appdata -VOLUME /opt/connect/custom-extensions +VOLUME /opt/engine/appdata +VOLUME /opt/engine/custom-extensions + EXPOSE 8443 -USER mirth -ENTRYPOINT [ "/opt/connect/entrypoint.sh" ] -CMD ["/opt/connect/mirth-connect.sh"] +USER engine +ENTRYPOINT ["./entrypoint.sh"] +CMD ["./oieserver"] \ No newline at end of file From 25d21a6c9d1e76d836de50c95be3871447215cae Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Thu, 26 Jun 2025 17:54:32 -0500 Subject: [PATCH 4/4] Add former entrypoint.sh script, fix name in developers.md Signed-off-by: Mitch Gaffigan --- .dockerignore | 2 +- DEVELOPERS.md | 26 +- Dockerfile | 8 +- server/basedir-includes/configure-from-env.sh | 247 ++ server/build.xml | 2659 +++++++++-------- 5 files changed, 1593 insertions(+), 1349 deletions(-) create mode 100755 server/basedir-includes/configure-from-env.sh diff --git a/.dockerignore b/.dockerignore index 8893889f6..efd1ed272 100644 --- a/.dockerignore +++ b/.dockerignore @@ -59,4 +59,4 @@ pom.xml.releaseBackup pom.xml.tag pom.xml.versionsBackup release.properties -replay_pid* \ No newline at end of file +replay_pid* diff --git a/DEVELOPERS.md b/DEVELOPERS.md index 7dd509f53..0f281120e 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -1,6 +1,14 @@ # For developers and contributors -## "Easy Path" with docker +## Build and run locally + +To build the solution, you must have a Java 1.8 JDK+FX and Apache Ant. This +can be installed by [sdkman](https://sdkman.io/) by executing `sdk env install`. +From the `server/` directory, run `ant -f mirth-build.xml -DdisableSigning=true`. + +After build, run the server by invoking `server/setup/oieserver` in bash. + +## Build and run with docker ```bash # Build using docker @@ -10,25 +18,13 @@ docker build -t oie-dev . docker run --rm -p 8443:8443 oie-dev ``` +## Connect + Then use [Ballista](https://github.com/kayyagari/ballista) to connect to https://localhost:8443/ and login using admin admin. -## Build Environment - -To build the solution, you must have a Java 1.8 JDK+FX and Apache Ant. This -can be installed by [sdkman](https://sdkman.io/) by executing `sdkman env install`. - -## Build Process - -From the `server/` directory, run `ant -f mirth-build.xml -DdisableSigning=true`. - If you are using Mirth Connect Administrator Launcher, you may need to omit `-DdisableSigning=true` to support JWS signatures and run MCAL passing `-k -d` to make it ignore self-signed certificates. Launchers like [Ballista](https://github.com/kayyagari/ballista) do not require signing, and signing adds considerable time to the build process. - -## Run - -After build, run the server by invoking `server/mirth-server-launcher.jar`. An -example of how to do this is listed in `docker/mirth-connect.sh`. diff --git a/Dockerfile b/Dockerfile index c5d7c79a8..cc3803f28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,6 @@ RUN groupadd engine \ && chown -R engine:engine /opt/engine WORKDIR /opt/engine -COPY --chmod=0755 docker/entrypoint.sh ./ COPY --chown=engine:engine --from=builder \ --exclude=cli-lib \ --exclude=mirth-cli-launcher.jar \ @@ -58,7 +57,7 @@ VOLUME /opt/engine/custom-extensions EXPOSE 8443 USER engine -ENTRYPOINT ["./entrypoint.sh"] +ENTRYPOINT ["./configure-from-env.sh"] CMD ["./oieserver"] ########################################## @@ -78,7 +77,6 @@ RUN addgroup -S engine \ && chown -R engine:engine /opt/engine WORKDIR /opt/engine -COPY --chmod=0755 docker/entrypoint.sh ./ COPY --chown=engine:engine --from=builder \ --exclude=cli-lib \ --exclude=mirth-cli-launcher.jar \ @@ -94,5 +92,5 @@ VOLUME /opt/engine/custom-extensions EXPOSE 8443 USER engine -ENTRYPOINT ["./entrypoint.sh"] -CMD ["./oieserver"] \ No newline at end of file +ENTRYPOINT ["./configure-from-env.sh"] +CMD ["./oieserver"] diff --git a/server/basedir-includes/configure-from-env.sh b/server/basedir-includes/configure-from-env.sh new file mode 100755 index 000000000..3ab0ebbb7 --- /dev/null +++ b/server/basedir-includes/configure-from-env.sh @@ -0,0 +1,247 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: MPL-2.0 +# SPDX-FileCopyrightText: 2023 NextGen Healthcare +# + +set -e + +APP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +custom_extension_count=`ls -1 "$APP_DIR"/custom-extensions/*.zip 2>/dev/null | wc -l` +if [ $custom_extension_count != 0 ]; then + echo "Found ${custom_extension_count} custom extensions." + for extension in $(ls -1 "$APP_DIR"/custom-extensions/*.zip); do + unzip -o -q $extension -d "$APP_DIR/extensions" + done +fi + +# set storepass and keypass to 'changeme' so they aren't overwritten later +KEYSTORE_PASS=changeme +sed -i "s/^keystore\.storepass\s*=\s*.*\$/keystore.storepass = ${KEYSTORE_PASS//\//\\/}/" "$APP_DIR/conf/mirth.properties" +sed -i "s/^keystore\.keypass\s*=\s*.*\$/keystore.keypass = ${KEYSTORE_PASS//\//\\/}/" "$APP_DIR/conf/mirth.properties" + +# merge the environment variables into /opt/engine/conf/mirth.properties +# db type +if ! [ -z "${DATABASE+x}" ]; then + sed -i "s/^database\s*=\s*.*\$/database = ${DATABASE//\//\\/}/" "$APP_DIR/conf/mirth.properties" +fi + +# db username +if ! [ -z "${DATABASE_USERNAME+x}" ]; then + sed -i "s/^database\.username\s*=\s*.*\$/database.username = ${DATABASE_USERNAME//\//\\/}/" "$APP_DIR/conf/mirth.properties" +fi + +# db password +if ! [ -z "${DATABASE_PASSWORD+x}" ]; then + sed -i "s/^database\.password\s*=\s*.*\$/database.password = ${DATABASE_PASSWORD//\//\\/}/" "$APP_DIR/conf/mirth.properties" +fi + +# db url +if ! [ -z "${DATABASE_URL+x}" ]; then + sed -i "s/^database\.url\s*=\s*.*\$/database.url = ${DATABASE_URL//\//\\/}/" "$APP_DIR/conf/mirth.properties" +fi + +# database max connections +if ! [ -z "${DATABASE_MAX_CONNECTIONS+x}" ]; then + sed -i "s/^database\.max-connections\s*=\s*.*\$/database.max-connections = ${DATABASE_MAX_CONNECTIONS//\//\\/}/" "$APP_DIR/conf/mirth.properties" +fi + +# database max retries +if ! [ -z "${DATABASE_MAX_RETRY+x}" ]; then + sed -i "s/^database\.connection\.maxretry\s*=\s*.*\$/database.connection.maxretry = ${DATABASE_MAX_RETRY//\//\\/}/" "$APP_DIR/conf/mirth.properties" +fi + +# database retry wait time +if ! [ -z "${DATABASE_RETRY_WAIT+x}" ]; then + sed -i "s/^database\.connection\.retrywaitinmilliseconds\s*=\s*.*\$/database.connection.retrywaitinmilliseconds = ${DATABASE_RETRY_WAIT//\//\\/}/" "$APP_DIR/conf/mirth.properties" +fi + +# keystore storepass +if ! [ -z "${KEYSTORE_STOREPASS+x}" ]; then + sed -i "s/^keystore\.storepass\s*=\s*.*\$/keystore.storepass = ${KEYSTORE_STOREPASS//\//\\/}/" "$APP_DIR/conf/mirth.properties" +fi + +# keystore keypass +if ! [ -z "${KEYSTORE_KEYPASS+x}" ]; then + sed -i "s/^keystore\.keypass\s*=\s*.*\$/keystore.keypass = ${KEYSTORE_KEYPASS//\//\\/}/" "$APP_DIR/conf/mirth.properties" +fi + +if ! [ -z "${KEYSTORE_TYPE+x}" ]; then + sed -i "s/^keystore\.type\s*=\s*.*\$/keystore.type = ${KEYSTORE_TYPE//\//\\/}/" "$APP_DIR/conf/mirth.properties" +fi + +# session store +if ! [ -z "${SESSION_STORE+x}" ]; then + LINE_COUNT=`grep "server.api.sessionstore" "$APP_DIR/conf/mirth.properties" | wc -l` + if [ $LINE_COUNT -lt 1 ]; then + echo -e "\nserver.api.sessionstore = ${SESSION_STORE//\//\\/}" >> "$APP_DIR/conf/mirth.properties" + else + sed -i "s/^server\.api\.sessionstore\s*=\s*.*\$/server.api.sessionstore = ${SESSION_STORE//\//\\/}/" "$APP_DIR/conf/mirth.properties" + fi +fi + +#server ID +if ! [ -z "${SERVER_ID+x}" ]; then + echo -e "server.id = ${SERVER_ID//\//\\/}" > "$APP_DIR/appdata/server.id" +fi + +# merge extra environment variables starting with _MP_ into mirth.properties +while read -r keyvalue; do + KEY="${keyvalue%%=*}" + VALUE="${keyvalue#*=}" + VALUE=$(tr -dc '\40-\176' <<< "$VALUE") + + if ! [ -z "${KEY}" ] && ! [ -z "${VALUE}" ] && ! [[ ${VALUE} =~ ^\ +$ ]]; then + + # filter for variables starting with "_MP_" + if [[ ${KEY} == _MP_* ]]; then + + # echo "found property ${KEY}=${VALUE}" + + # example: _MP_DATABASE_MAX__CONNECTIONS -> database.max-connections + + # remove _MP_ + # example: DATABASE_MAX__CONNECTIONS + ACTUAL_KEY=${KEY:4} + + # switch '__' to '-' + # example: DATABASE_MAX-CONNECTIONS + ACTUAL_KEY="${ACTUAL_KEY//__/-}" + + # switch '_' to '.' + # example: DATABASE.MAX-CONNECTIONS + ACTUAL_KEY="${ACTUAL_KEY//_/.}" + + # lower case + # example: database.max-connections + ACTUAL_KEY="${ACTUAL_KEY,,}" + + # if key does not exist in mirth.properties append it at bottom + LINE_COUNT=`grep "^${ACTUAL_KEY}" "$APP_DIR/conf/mirth.properties" | wc -l` + if [ $LINE_COUNT -lt 1 ]; then + # echo "key ${ACTUAL_KEY} not found in mirth.properties, appending. Value = ${VALUE}" + echo -e "\n${ACTUAL_KEY} = ${VALUE//\//\\/}" >> "$APP_DIR/conf/mirth.properties" + else # otherwise key exists, overwrite it + # echo "key ${ACTUAL_KEY} exists, overwriting. Value = ${VALUE}" + ESCAPED_KEY="${ACTUAL_KEY//./\\.}" + sed -i "s/^${ESCAPED_KEY}\s*=\s*.*\$/${ACTUAL_KEY} = ${VALUE//\//\\/}/" "$APP_DIR/conf/mirth.properties" + fi + fi + fi +done <<< "`printenv`" + +# merge vmoptions into /opt/engine/oieserver.vmoptions +if ! [ -z "${VMOPTIONS+x}" ]; then + PREV_IFS="$IFS" + IFS="," + read -ra vmoptions <<< "$VMOPTIONS" + IFS="$PREV_IFS" + + for vmoption in "${vmoptions[@]}" + do + echo "${vmoption}" >> "$APP_DIR/oieserver.vmoptions" + done +fi + +# merge the user's secret mirth.properties +# takes a whole mirth.properties file and merges line by line with /opt/engine/conf/mirth.properties +if [ -f /run/secrets/mirth_properties ]; then + + # add new line in case /opt/engine/conf/mirth.properties doesn't end with one + echo "" >> "$APP_DIR/conf/mirth.properties" + + while read -r keyvalue; do + KEY="${keyvalue%%=*}" + VALUE="${keyvalue#*=}" + + # remove leading and trailing white space + KEY="$(echo -e "${KEY}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + VALUE="$(echo -e "${VALUE}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + + if ! [ -z "${KEY}" ] && ! [ -z "${VALUE}" ] && ! [[ ${VALUE} =~ ^\ +$ ]]; then + # if key does not exist in mirth.properties append it at bottom + LINE_COUNT=`grep "^${KEY}" "$APP_DIR/conf/mirth.properties" | wc -l` + if [ $LINE_COUNT -lt 1 ]; then + # echo "key ${KEY} not found in mirth.properties, appending. Value = ${VALUE}" + echo -e "${KEY} = ${VALUE//\//\\/}" >> "$APP_DIR/conf/mirth.properties" + else # otherwise key exists, overwrite it + # echo "key ${KEY} exists, overwriting. Value = ${VALUE}" + ESCAPED_KEY="${KEY//./\\.}" + sed -i "s/^${ESCAPED_KEY}\s*=\s*.*\$/${KEY} = ${VALUE//\//\\/}/" "$APP_DIR/conf/mirth.properties" + fi + fi + done <<< "`cat /run/secrets/mirth_properties`" +fi + +# merge the user's secret vmoptions +# takes a whole oieserver.vmoptions file and merges line by line with /opt/engine/oieserver.vmoptions +if [ -f /run/secrets/oieserver_vmoptions ]; then + (cat /run/secrets/oieserver_vmoptions ; echo "") >> "$APP_DIR/oieserver.vmoptions" +fi + +# download jars from this url "$CUSTOM_JARS_DOWNLOAD", set by user +if ! [ -z "${CUSTOM_JARS_DOWNLOAD+x}" ]; then + echo "Downloading Jars at ${CUSTOM_JARS_DOWNLOAD}" + if ! [ -z "${ALLOW_INSECURE}" ] && [ "${ALLOW_INSECURE}" == "true" ]; then + curl -ksSLf "${CUSTOM_JARS_DOWNLOAD}" -o userJars.zip || echo "problem with custom jars download" + else + curl -sSLf "${CUSTOM_JARS_DOWNLOAD}" -o userJars.zip || echo "problem with custom jars download" + fi + + # Unzipping contents of userJars.zip into /opt/engine/server-launcher-lib folder + if [ -e "userJars.zip" ]; then + echo "Unzipping contents of userJars.zip into $APP_DIR/server-launcher-lib" + unzip userJars.zip -d "$APP_DIR/server-launcher-lib" + # removing the downloaded zip file + rm userJars.zip + fi +fi + +# download extensions from this url "$EXTENSIONS_DOWNLOAD", set by user +if ! [ -z "${EXTENSIONS_DOWNLOAD+x}" ]; then + echo "Downloading extensions at ${EXTENSIONS_DOWNLOAD}" + if ! [ -z "${ALLOW_INSECURE}" ] && [ "${ALLOW_INSECURE}" == "true" ]; then + curl -ksSLf "${EXTENSIONS_DOWNLOAD}" -o userExtensions.zip || echo "problem with extensions download" + else + curl -sSLf "${EXTENSIONS_DOWNLOAD}" -o userExtensions.zip || echo "problem with extensions download" + fi + + # Unzipping contents of userExtensions.zip + if [ -e "userExtensions.zip" ]; then + echo "Unzipping contents of userExtensions.zip" + mkdir /tmp/userextensions + unzip userExtensions.zip -d /tmp/userextensions + # removing the downloaded zip file + rm userExtensions.zip + + # Unzipping contents of individual extension zip files into /opt/engine/extensions folder + zipFileCount=`ls -1 /tmp/userextensions/*.zip 2>/dev/null | wc -l` + if [ $zipFileCount != 0 ]; then + echo "Unzipping contents of /tmp/userextensions/ zips into $APP_DIR/extensions" + for f in /tmp/userextensions/*.zip; do unzip "$f" -d "$APP_DIR/extensions"; done + fi + # removing the tmp folder + rm -rf /tmp/userextensions + fi +fi + +# download keystore +if ! [ -z "${KEYSTORE_DOWNLOAD+x}" ]; then + echo "Downloading keystore at ${KEYSTORE_DOWNLOAD}" + if ! [ -z "${ALLOW_INSECURE}" ] && [ "${ALLOW_INSECURE}" == "true" ]; then + curl -ksSLf "${KEYSTORE_DOWNLOAD}" -o "$APP_DIR/appdata/keystore.jks" || echo "problem with keystore download" + else + curl -sSLf "${KEYSTORE_DOWNLOAD}" -o "$APP_DIR/appdata/keystore.jks" || echo "problem with keystore download" + fi +fi + +# if delay is set as an environment variable then wait that long in seconds +if ! [ -z "${DELAY+x}" ]; then + sleep $DELAY +fi + +# if there are any arguments, invoke them as a command +if [ $# -ne 0 ]; then + exec "$@" +fi diff --git a/server/build.xml b/server/build.xml index 9aa6606c1..f0546986c 100644 --- a/server/build.xml +++ b/server/build.xml @@ -1,1328 +1,1331 @@ - - - - - - - - - - Mirth Connect Build Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Sub-project files have been copied into setup - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + Mirth Connect Build Help + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sub-project files have been copied into setup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +