diff --git a/distribution/docker_entry.sh b/distribution/docker_entry.sh index 7f403e6ba4..285bede392 100644 --- a/distribution/docker_entry.sh +++ b/distribution/docker_entry.sh @@ -39,53 +39,53 @@ else PERMISSIONS="${PERMISSIONS:-open}" fi -PROJECT_ARTIFACTID=$1 -PROJECT_VERSION=$2 +CARDS_ARTIFACTID=$1 +CARDS_VERSION=$2 -VALID_CARDS_PROJECTS="||cards4kids|cards4lfs|cards4proms|cards4prems|cards4heracles|" -[ -e /external_project/project_code.txt ] && VALID_CARDS_PROJECTS="${VALID_CARDS_PROJECTS}$(cat /external_project/project_code.txt | head -n 1 | tr -d '\n')|" -echo "${VALID_CARDS_PROJECTS}" | grep -q "|${CARDS_PROJECT}|" || { echo "Invalid project specified - defaulting to generic CARDS."; unset CARDS_PROJECT; } - -featureFlagString="" -if [ ! -z $CARDS_PROJECT ] +if [ -z $PROJECT_VERSION ] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/${CARDS_PROJECT}/${PROJECT_VERSION}/slingosgifeature" + PROJECT_VERSION=$CARDS_VERSION fi -[[ "${CARDS_PROJECT}" == 'cards4proms' || "${CARDS_PROJECT}" == 'cards4prems' ]] && SMTPS_ENABLED="true" +VALID_PROJECT_NAMES="||cards4kids|cards4lfs|cards4proms|cards4prems|cards4heracles|" +[ -e /external_project/project_code.txt ] && VALID_PROJECT_NAMES="${VALID_PROJECT_NAMES}$(cat /external_project/project_code.txt | head -n 1 | tr -d '\n')|" +echo "${VALID_PROJECT_NAMES}" | grep -q "|${PROJECT_NAME}|" || { echo "Invalid project specified - defaulting to generic CARDS."; unset PROJECT_NAME; } -[[ "${CARDS_PROJECT}" == 'cards4prems' ]] && CSV_EXPORT_ENABLED="true" -[[ "${CARDS_PROJECT}" == 'cards4proms' || "${CARDS_PROJECT}" == 'cards4prems' ]] && CLARITY_IMPORT_ENABLED="true" +featureFlagString="" +if [ ! -z $PROJECT_NAME ] +then + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/${PROJECT_NAME}/${PROJECT_VERSION}/slingosgifeature" +fi if [ ! -z $DEV ] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards/${PROJECT_VERSION}/slingosgifeature/composum" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards/${CARDS_VERSION}/slingosgifeature/composum" fi if [ ! -z $DEMO ] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-modules-demo-banner/${PROJECT_VERSION}/slingosgifeature," - featureFlagString="${featureFlagString}mvn:io.uhndata.cards/cards-modules-upgrade-marker/${PROJECT_VERSION}/slingosgifeature," - featureFlagString="${featureFlagString}mvn:io.uhndata.cards/cards-dataentry/${PROJECT_VERSION}/slingosgifeature/forms_demo" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-modules-demo-banner/${CARDS_VERSION}/slingosgifeature," + featureFlagString="${featureFlagString}mvn:io.uhndata.cards/cards-modules-upgrade-marker/${CARDS_VERSION}/slingosgifeature," + featureFlagString="${featureFlagString}mvn:io.uhndata.cards/cards-dataentry/${CARDS_VERSION}/slingosgifeature/forms_demo" else if [ ! -z $DEMO_BANNER ] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-modules-demo-banner/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-modules-demo-banner/${CARDS_VERSION}/slingosgifeature" fi fi if [ ! -z $ENABLE_TEST_FEATURES ] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-modules-test-forms/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-modules-test-forms/${CARDS_VERSION}/slingosgifeature" fi if [ ! -z $SAML_CLOUD_IAM_DEMO ] then if [[ ${BEHIND_SSL_PROXY} == 'true' ]] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-cloud-iam-demo-saml-support-ssl/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-cloud-iam-demo-saml-support-ssl/${CARDS_VERSION}/slingosgifeature" else - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-cloud-iam-demo-saml-support/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-cloud-iam-demo-saml-support/${CARDS_VERSION}/slingosgifeature" fi fi @@ -94,50 +94,6 @@ then featureFlagString="$featureFlagString -f ${ADDITIONAL_SLING_FEATURES@P}" fi -#Parse the (legacy) ADDITIONAL_RUN_MODES environment variable and determine the features that need to be enabled -legacyRunModes=$(echo $ADDITIONAL_RUN_MODES | tr "," "\n") -for legacyRunMode in $legacyRunModes -do - #Perform the translation - if [[ ${legacyRunMode} == 'oak_tar' ]] - then - STORAGE=tar - elif [[ ${legacyRunMode} == 'oak_mongo' ]] - then - STORAGE=mongo - elif [[ ${legacyRunMode} == 'dev' ]] - then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards/${PROJECT_VERSION}/slingosgifeature/composum" - elif [[ ${legacyRunMode} == 'kids' ]] - then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards4kids/${PROJECT_VERSION}/slingosgifeature" - elif [[ ${legacyRunMode} == 'lfs' ]] - then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards4lfs/${PROJECT_VERSION}/slingosgifeature" - elif [[ ${legacyRunMode} == 'proms' ]] - then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards4proms/${PROJECT_VERSION}/slingosgifeature" - SMTPS_ENABLED="true" - elif [[ ${legacyRunMode} == 'test' ]] - then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-modules-test-forms/${PROJECT_VERSION}/slingosgifeature" - elif [[ ${legacyRunMode} == 'demo' ]] - then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-modules-demo-banner/${PROJECT_VERSION}/slingosgifeature," - featureFlagString="${featureFlagString}mvn:io.uhndata.cards/cards-modules-upgrade-marker/${PROJECT_VERSION}/slingosgifeature," - featureFlagString="${featureFlagString}mvn:io.uhndata.cards/cards-dataentry/${PROJECT_VERSION}/slingosgifeature/forms_demo" - elif [[ ${legacyRunMode} == 'permissions_open' ]] - then - PERMISSIONS="open" - elif [[ ${legacyRunMode} == 'permissions_trusted' ]] - then - PERMISSIONS="trusted" - elif [[ ${legacyRunMode} == 'permissions_ownership' ]] - then - PERMISSIONS="ownership" - fi -done - echo "STORAGE = $STORAGE" echo "DEV = $DEV" echo "DEMO = $DEMO" @@ -146,7 +102,9 @@ echo "DEBUG = $DEBUG" echo "PERMISSIONS = $PERMISSIONS" echo "ADDITIONAL_RUN_MODES = $ADDITIONAL_RUN_MODES" echo "ADDITIONAL_SLING_FEATURES = $ADDITIONAL_SLING_FEATURES" -echo "PROJECT_ARTIFACTID = $PROJECT_ARTIFACTID" +echo "CARDS_ARTIFACTID = $CARDS_ARTIFACTID" +echo "CARDS_VERSION = $CARDS_VERSION" +echo "PROJECT_NAME = $PROJECT_NAME" echo "PROJECT_VERSION = $PROJECT_VERSION" #Are we using an external MongoDB service for data storage? @@ -174,31 +132,31 @@ fi #Should the SMTPS OSGi bundle be enabled? if [[ "$SMTPS_ENABLED" == "true" ]] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-email-notifications/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-email-notifications/${CARDS_VERSION}/slingosgifeature" fi #Should the SAML OSGi bundle be enabled? if [[ "$SAML_AUTH_ENABLED" == "true" ]] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-saml-support/${PROJECT_VERSION}/slingosgifeature/base -C io.dropwizard.metrics:metrics-core:ALL -f mvn:io.uhndata.cards/cards-fetch-requires-saml-login/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-saml-support/${CARDS_VERSION}/slingosgifeature/base -C io.dropwizard.metrics:metrics-core:ALL -f mvn:io.uhndata.cards/cards-fetch-requires-saml-login/${CARDS_VERSION}/slingosgifeature" fi #Should the scheduled-csv-export module be loaded? if [[ "$CSV_EXPORT_ENABLED" == "true" ]] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-scheduled-csv-export/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-scheduled-csv-export/${CARDS_VERSION}/slingosgifeature" fi #Should the clarity-integration module be loaded? if [[ "$CLARITY_IMPORT_ENABLED" == "true" ]] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-clarity-integration/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-clarity-integration/${CARDS_VERSION}/slingosgifeature" fi #Should the cards-slack-notifications module be loaded? if [[ "$SLACK_NOTIFICATIONS_ENABLED" == "true" ]] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-slack-notifications/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-slack-notifications/${CARDS_VERSION}/slingosgifeature" fi if [[ "$SMTPS_LOCALHOST_PROXY" == "true" ]] @@ -224,4 +182,4 @@ done #Execute the volume_mounted_init.sh script if it is present [ -e /volume_mounted_init.sh ] && /volume_mounted_init.sh -java -Djdk.xml.entityExpansionLimit=0 ${CARDS_JAVA_MEMORY_LIMIT_MB:+ -Xmx${CARDS_JAVA_MEMORY_LIMIT_MB}m} ${DEBUG:+ -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=*:5005} -jar org.apache.sling.feature.launcher.jar -p .cards-data -u "file://$(realpath ${HOME}/.m2/repository),file://$(realpath ${HOME}/.cards-generic-m2/repository),https://nexus.phenotips.org/nexus/content/groups/public,https://repo.maven.apache.org/maven2,https://repository.apache.org/content/groups/snapshots" -f ./${PROJECT_ARTIFACTID}-${PROJECT_VERSION}-core_${STORAGE}_far.far${EXT_MONGO_VARIABLES}${SMTPS_VARIABLES} -f mvn:io.uhndata.cards/cards-dataentry/${PROJECT_VERSION}/slingosgifeature/permissions_${PERMISSIONS}${featureFlagString} +java -Djdk.xml.entityExpansionLimit=0 ${CARDS_JAVA_MEMORY_LIMIT_MB:+ -Xmx${CARDS_JAVA_MEMORY_LIMIT_MB}m} ${DEBUG:+ -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=*:5005} -jar org.apache.sling.feature.launcher.jar -p .cards-data -u "file://$(realpath ${HOME}/.m2/repository),file://$(realpath ${HOME}/.cards-generic-m2/repository),https://nexus.phenotips.org/nexus/content/groups/public,https://repo.maven.apache.org/maven2,https://repository.apache.org/content/groups/snapshots" -f ./${CARDS_ARTIFACTID}-${CARDS_VERSION}-core_${STORAGE}_far.far${EXT_MONGO_VARIABLES}${SMTPS_VARIABLES} -f mvn:io.uhndata.cards/cards-dataentry/${CARDS_VERSION}/slingosgifeature/permissions_${PERMISSIONS}${featureFlagString}