From 0463ba3e33eae03d80aacfc3e3a8fd16873748c4 Mon Sep 17 00:00:00 2001 From: Michael Lescisin Date: Tue, 24 Oct 2023 16:42:39 -0400 Subject: [PATCH 01/11] CARDS-2317: Split CARDS into multiple projects In docker_entry.sh, add the project codename specified by the /external_project/project_code.txt file to the VALID_CARDS_PROJECTS list if such file exists --- distribution/docker_entry.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/distribution/docker_entry.sh b/distribution/docker_entry.sh index 64135626e2..5e202fcc3d 100644 --- a/distribution/docker_entry.sh +++ b/distribution/docker_entry.sh @@ -41,6 +41,7 @@ PROJECT_ARTIFACTID=$1 PROJECT_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="" From 65d70739329ca61ee8d4bfc27f9fa9497fde79bc Mon Sep 17 00:00:00 2001 From: Michael Lescisin Date: Wed, 25 Oct 2023 14:46:44 -0400 Subject: [PATCH 02/11] CARDS-2317: Split CARDS into multiple projects Add the generic CARDS logo as /metadata/logo.png in the built Docker images --- distribution/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/distribution/Dockerfile b/distribution/Dockerfile index 4ad7627696..3e7708c33e 100644 --- a/distribution/Dockerfile +++ b/distribution/Dockerfile @@ -87,6 +87,9 @@ COPY --from=0 /root/.m2 /root/.m2 # Copy in the build metadata COPY --from=0 /metadata /metadata +# Copy in the generic CARDS logo +COPY --from=0 /cards/modules/homepage/src/main/media/SLING-INF/content/libs/cards/resources/media/default/logo_light_bg.png /metadata/logo.png + # This is the default command executed when starting the container COPY docker_entry.sh /docker_entry.sh RUN chmod +x /docker_entry.sh From 58f2a7649a7580bdf51c1b5ea1136ebdc027039b Mon Sep 17 00:00:00 2001 From: Michael Lescisin Date: Wed, 22 Nov 2023 12:29:54 -0500 Subject: [PATCH 03/11] CARDS-2317: Split CARDS into multiple projects When CARDS is starting, it should also look for required JARs in the /root/.cards-generic-m2/repository directory. This directory, by default, is empty but can be volume-mounted with the JARs from the generic CARDS platform (--cards_generic_jars_repo flag for generate_compose_yaml.py) --- distribution/Dockerfile | 3 +++ distribution/docker_entry.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/distribution/Dockerfile b/distribution/Dockerfile index 3e7708c33e..211f90b404 100644 --- a/distribution/Dockerfile +++ b/distribution/Dockerfile @@ -90,6 +90,9 @@ COPY --from=0 /metadata /metadata # Copy in the generic CARDS logo COPY --from=0 /cards/modules/homepage/src/main/media/SLING-INF/content/libs/cards/resources/media/default/logo_light_bg.png /metadata/logo.png +# Create the ~/.cards-generic-m2/repository empty directory +RUN mkdir -p /root/.cards-generic-m2/repository + # This is the default command executed when starting the container COPY docker_entry.sh /docker_entry.sh RUN chmod +x /docker_entry.sh diff --git a/distribution/docker_entry.sh b/distribution/docker_entry.sh index 5e202fcc3d..ad685ce159 100644 --- a/distribution/docker_entry.sh +++ b/distribution/docker_entry.sh @@ -229,4 +229,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),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}${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 ./${PROJECT_ARTIFACTID}-${PROJECT_VERSION}-core_${STORAGE}_far.far${EXT_MONGO_VARIABLES}${SMTPS_VARIABLES}${featureFlagString} From 0fb9f0a0fa439cfb335f5f2ba9ac42aa1b067f8a Mon Sep 17 00:00:00 2001 From: Michael Lescisin Date: Thu, 11 Jan 2024 11:18:48 -0500 Subject: [PATCH 04/11] CARDS-2317: Split CARDS into multiple projects distribution/docker_entry.sh: Rename PROJECT_ARTIFACTID variable to CARDS_ARTIFACTID --- distribution/docker_entry.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/distribution/docker_entry.sh b/distribution/docker_entry.sh index ad685ce159..3507c0634d 100644 --- a/distribution/docker_entry.sh +++ b/distribution/docker_entry.sh @@ -37,7 +37,7 @@ then PERMISSIONS="${PERMISSIONS:-trusted}" fi -PROJECT_ARTIFACTID=$1 +CARDS_ARTIFACTID=$1 PROJECT_VERSION=$2 VALID_CARDS_PROJECTS="||cards4kids|cards4lfs|cards4proms|cards4prems|cards4heracles|" @@ -151,7 +151,7 @@ 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 "PROJECT_VERSION = $PROJECT_VERSION" #Are we using an external MongoDB service for data storage? @@ -229,4 +229,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}${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}-${PROJECT_VERSION}-core_${STORAGE}_far.far${EXT_MONGO_VARIABLES}${SMTPS_VARIABLES}${featureFlagString} From d83fc348bea115f0216ece48fdcb388298f26c57 Mon Sep 17 00:00:00 2001 From: Michael Lescisin Date: Thu, 11 Jan 2024 11:25:59 -0500 Subject: [PATCH 05/11] CARDS-2317: Split CARDS into multiple projects distribution/docker_entry.sh: Rename PROJECT_VERSION variable to CARDS_VERSION --- distribution/docker_entry.sh | 52 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/distribution/docker_entry.sh b/distribution/docker_entry.sh index 3507c0634d..85e40ac3bd 100644 --- a/distribution/docker_entry.sh +++ b/distribution/docker_entry.sh @@ -38,7 +38,7 @@ then fi CARDS_ARTIFACTID=$1 -PROJECT_VERSION=$2 +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')|" @@ -47,7 +47,7 @@ echo "${VALID_CARDS_PROJECTS}" | grep -q "|${CARDS_PROJECT}|" || { echo "Invalid featureFlagString="" if [ ! -z $CARDS_PROJECT ] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/${CARDS_PROJECT}/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/${CARDS_PROJECT}/${CARDS_VERSION}/slingosgifeature" fi [[ "${CARDS_PROJECT}" == 'cards4proms' || "${CARDS_PROJECT}" == 'cards4prems' ]] && SMTPS_ENABLED="true" @@ -57,33 +57,33 @@ 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 @@ -105,25 +105,25 @@ do STORAGE=mongo elif [[ ${legacyRunMode} == '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" elif [[ ${legacyRunMode} == 'kids' ]] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards4kids/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards4kids/${CARDS_VERSION}/slingosgifeature" elif [[ ${legacyRunMode} == 'lfs' ]] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards4lfs/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards4lfs/${CARDS_VERSION}/slingosgifeature" elif [[ ${legacyRunMode} == 'proms' ]] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards4proms/${PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards4proms/${CARDS_VERSION}/slingosgifeature" SMTPS_ENABLED="true" elif [[ ${legacyRunMode} == 'test' ]] 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" 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" + 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" elif [[ ${legacyRunMode} == 'permissions_open' ]] then PERMISSIONS="open" @@ -137,7 +137,7 @@ do done # Read /sling-features.json and enable the features required for this project -PROJECT_REQUIRED_FEATURES=$(CARDS_VERSION=${PROJECT_VERSION} PROJECT_NAME=${CARDS_PROJECT} PROJECT_VERSION=${PROJECT_VERSION} PERMISSIONS=${PERMISSIONS} python3 /get_project_dependency_features.py /sling-features.json) +PROJECT_REQUIRED_FEATURES=$(CARDS_VERSION=${CARDS_VERSION} PROJECT_NAME=${CARDS_PROJECT} PROJECT_VERSION=${CARDS_VERSION} PERMISSIONS=${PERMISSIONS} python3 /get_project_dependency_features.py /sling-features.json) if [ ! -z $PROJECT_REQUIRED_FEATURES ] then featureFlagString="$featureFlagString -f $PROJECT_REQUIRED_FEATURES" @@ -152,7 +152,7 @@ echo "PERMISSIONS = $PERMISSIONS" echo "ADDITIONAL_RUN_MODES = $ADDITIONAL_RUN_MODES" echo "ADDITIONAL_SLING_FEATURES = $ADDITIONAL_SLING_FEATURES" echo "CARDS_ARTIFACTID = $CARDS_ARTIFACTID" -echo "PROJECT_VERSION = $PROJECT_VERSION" +echo "CARDS_VERSION = $CARDS_VERSION" #Are we using an external MongoDB service for data storage? EXT_MONGO_VARIABLES="" @@ -179,31 +179,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" ]] @@ -229,4 +229,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 ./${CARDS_ARTIFACTID}-${PROJECT_VERSION}-core_${STORAGE}_far.far${EXT_MONGO_VARIABLES}${SMTPS_VARIABLES}${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}${featureFlagString} From 8b2529800d649ccabd0fe012056318b142b83f31 Mon Sep 17 00:00:00 2001 From: Michael Lescisin Date: Thu, 11 Jan 2024 11:38:42 -0500 Subject: [PATCH 06/11] CARDS-2317: Split CARDS into multiple projects distribution/docker_entry.sh: The version of the CARDS-based project (eg. HERACLES, SPARC, etc...), as opposed to the version of the CARDS core platform, to be launched is now determined by the CARDS_PROJECT_VERSION environment variable and not the CARDS_VERSION environment variable --- distribution/docker_entry.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distribution/docker_entry.sh b/distribution/docker_entry.sh index 85e40ac3bd..2abe66aecb 100644 --- a/distribution/docker_entry.sh +++ b/distribution/docker_entry.sh @@ -45,9 +45,9 @@ VALID_CARDS_PROJECTS="||cards4kids|cards4lfs|cards4proms|cards4prems|cards4herac 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 $CARDS_PROJECT ] && [ ! -z $CARDS_PROJECT_VERSION ] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/${CARDS_PROJECT}/${CARDS_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/${CARDS_PROJECT}/${CARDS_PROJECT_VERSION}/slingosgifeature" fi [[ "${CARDS_PROJECT}" == 'cards4proms' || "${CARDS_PROJECT}" == 'cards4prems' ]] && SMTPS_ENABLED="true" From e6ba1dbcecff63764dd0a02791ea7a3a7db049f8 Mon Sep 17 00:00:00 2001 From: Michael Lescisin Date: Thu, 11 Jan 2024 11:42:25 -0500 Subject: [PATCH 07/11] CARDS-2317: Split CARDS into multiple projects distribution/docker_entry.sh: Display the values of the CARDS_PROJECT and CARDS_PROJECT_VERSION environment variables upon startup --- distribution/docker_entry.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/distribution/docker_entry.sh b/distribution/docker_entry.sh index 2abe66aecb..42e75f0d46 100644 --- a/distribution/docker_entry.sh +++ b/distribution/docker_entry.sh @@ -153,6 +153,8 @@ echo "ADDITIONAL_RUN_MODES = $ADDITIONAL_RUN_MODES" echo "ADDITIONAL_SLING_FEATURES = $ADDITIONAL_SLING_FEATURES" echo "CARDS_ARTIFACTID = $CARDS_ARTIFACTID" echo "CARDS_VERSION = $CARDS_VERSION" +echo "CARDS_PROJECT = $CARDS_PROJECT" +echo "CARDS_PROJECT_VERSION = $CARDS_PROJECT_VERSION" #Are we using an external MongoDB service for data storage? EXT_MONGO_VARIABLES="" From f375fab16766a74ee0c8846788955a4515b810f0 Mon Sep 17 00:00:00 2001 From: Sergiu Dumitriu Date: Mon, 5 Feb 2024 13:57:19 -0500 Subject: [PATCH 08/11] CARDS-2317: Split CARDS into multiple projects Rename CARDS_PROJECT_VERSION to PROJECT_VERSION --- distribution/docker_entry.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/distribution/docker_entry.sh b/distribution/docker_entry.sh index 42e75f0d46..b65bc9c080 100644 --- a/distribution/docker_entry.sh +++ b/distribution/docker_entry.sh @@ -45,9 +45,9 @@ VALID_CARDS_PROJECTS="||cards4kids|cards4lfs|cards4proms|cards4prems|cards4herac echo "${VALID_CARDS_PROJECTS}" | grep -q "|${CARDS_PROJECT}|" || { echo "Invalid project specified - defaulting to generic CARDS."; unset CARDS_PROJECT; } featureFlagString="" -if [ ! -z $CARDS_PROJECT ] && [ ! -z $CARDS_PROJECT_VERSION ] +if [ ! -z $CARDS_PROJECT ] && [ ! -z $PROJECT_VERSION ] then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/${CARDS_PROJECT}/${CARDS_PROJECT_VERSION}/slingosgifeature" + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/${CARDS_PROJECT}/${PROJECT_VERSION}/slingosgifeature" fi [[ "${CARDS_PROJECT}" == 'cards4proms' || "${CARDS_PROJECT}" == 'cards4prems' ]] && SMTPS_ENABLED="true" @@ -137,7 +137,7 @@ do done # Read /sling-features.json and enable the features required for this project -PROJECT_REQUIRED_FEATURES=$(CARDS_VERSION=${CARDS_VERSION} PROJECT_NAME=${CARDS_PROJECT} PROJECT_VERSION=${CARDS_VERSION} PERMISSIONS=${PERMISSIONS} python3 /get_project_dependency_features.py /sling-features.json) +PROJECT_REQUIRED_FEATURES=$(CARDS_VERSION=${CARDS_VERSION} PROJECT_NAME=${CARDS_PROJECT} PROJECT_VERSION=${PROJECT_VERSION} PERMISSIONS=${PERMISSIONS} python3 /get_project_dependency_features.py /sling-features.json) if [ ! -z $PROJECT_REQUIRED_FEATURES ] then featureFlagString="$featureFlagString -f $PROJECT_REQUIRED_FEATURES" @@ -154,7 +154,7 @@ echo "ADDITIONAL_SLING_FEATURES = $ADDITIONAL_SLING_FEATURES" echo "CARDS_ARTIFACTID = $CARDS_ARTIFACTID" echo "CARDS_VERSION = $CARDS_VERSION" echo "CARDS_PROJECT = $CARDS_PROJECT" -echo "CARDS_PROJECT_VERSION = $CARDS_PROJECT_VERSION" +echo "PROJECT_VERSION = $PROJECT_VERSION" #Are we using an external MongoDB service for data storage? EXT_MONGO_VARIABLES="" From 0163d448e603abe4df28e5894b75de4f46a339bc Mon Sep 17 00:00:00 2001 From: Sergiu Dumitriu Date: Fri, 1 Dec 2023 17:57:18 -0500 Subject: [PATCH 09/11] CARDS-2317: Split CARDS into multiple projects Allow interpreting $PROJECT_VERSION variables in the ADDITIONAL_SLING_FEATURES env variable --- distribution/Dockerfile | 3 ++- distribution/docker_entry.sh | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/distribution/Dockerfile b/distribution/Dockerfile index 211f90b404..56379bbe91 100644 --- a/distribution/Dockerfile +++ b/distribution/Dockerfile @@ -51,7 +51,8 @@ RUN apk upgrade --available RUN apk add \ openjdk11-jre \ python3 \ - tzdata + tzdata \ + bash # Optional: enable remote debugging at port 5005 ENV DEBUG= diff --git a/distribution/docker_entry.sh b/distribution/docker_entry.sh index b65bc9c080..7c2baf577b 100644 --- a/distribution/docker_entry.sh +++ b/distribution/docker_entry.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file @@ -89,7 +89,7 @@ fi if [ ! -z $ADDITIONAL_SLING_FEATURES ] then - featureFlagString="$featureFlagString -f $ADDITIONAL_SLING_FEATURES" + 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 From 41b965979aea1cdcc2ab670d9b1b9d3b8bf35fa3 Mon Sep 17 00:00:00 2001 From: Sergiu Dumitriu Date: Mon, 4 Dec 2023 14:40:49 -0500 Subject: [PATCH 10/11] CARDS-2317: Split CARDS into multiple projects Allow interpreting variables in the passed arguments, and allow definining a separate PROJECT_VERSION variable as the version for external projects --- start_cards.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/start_cards.sh b/start_cards.sh index 47d2c7cc5e..ed80da29b3 100755 --- a/start_cards.sh +++ b/start_cards.sh @@ -353,7 +353,8 @@ do ARGS[$ARGS_LENGTH]=mvn:io.uhndata.cards/cards-slack-notifications/${CARDS_VERSION}/slingosgifeature ARGS_LENGTH=${ARGS_LENGTH}+1 else - ARGS[$i]=${ARGS[$i]/VERSION/${CARDS_VERSION}} + ARGS[$i]=${ARGS[$i]@P} + ARGS[$i]=${ARGS[$i]//VERSION/${CARDS_VERSION}} fi done From 8be2419e946c2f24ec6e11e5b1d9227415811c81 Mon Sep 17 00:00:00 2001 From: Sergiu Dumitriu Date: Tue, 5 Dec 2023 13:56:48 -0500 Subject: [PATCH 11/11] CARDS-2317: Split CARDS into multiple projects Add support for separate versions for the base CARDS platform and the specific project on top of it Remove support for the deprecated run modes handling Remove custom support for specific projects --- compose-cluster/generate_compose_yaml.py | 2 +- distribution/docker_entry.sh | 68 +++++------------------- 2 files changed, 13 insertions(+), 57 deletions(-) diff --git a/compose-cluster/generate_compose_yaml.py b/compose-cluster/generate_compose_yaml.py index 036db93e50..7b865aef08 100644 --- a/compose-cluster/generate_compose_yaml.py +++ b/compose-cluster/generate_compose_yaml.py @@ -714,7 +714,7 @@ def newListIfEmpty(yaml_object, *keys): newListIfEmpty(yaml_obj, 'services', 'cardsinitial', 'ports').append("127.0.0.1:5005:5005") if args.cards_project: - yaml_obj['services']['cardsinitial']['environment'].append("CARDS_PROJECT={}".format(args.cards_project)) + yaml_obj['services']['cardsinitial']['environment'].append("PROJECT_NAME={}".format(args.cards_project)) if args.composum: yaml_obj['services']['cardsinitial']['environment'].append("DEV=true") diff --git a/distribution/docker_entry.sh b/distribution/docker_entry.sh index 7c2baf577b..f010f022d1 100644 --- a/distribution/docker_entry.sh +++ b/distribution/docker_entry.sh @@ -40,20 +40,20 @@ fi 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 ] && [ ! -z $PROJECT_VERSION ] +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 ] && [ ! -z $PROJECT_VERSION ] +then + featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/${PROJECT_NAME}/${PROJECT_VERSION}/slingosgifeature" +fi if [ ! -z $DEV ] then @@ -92,52 +92,8 @@ 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/${CARDS_VERSION}/slingosgifeature/composum" - elif [[ ${legacyRunMode} == 'kids' ]] - then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards4kids/${CARDS_VERSION}/slingosgifeature" - elif [[ ${legacyRunMode} == 'lfs' ]] - then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards4lfs/${CARDS_VERSION}/slingosgifeature" - elif [[ ${legacyRunMode} == 'proms' ]] - then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards4proms/${CARDS_VERSION}/slingosgifeature" - SMTPS_ENABLED="true" - elif [[ ${legacyRunMode} == 'test' ]] - then - featureFlagString="$featureFlagString -f mvn:io.uhndata.cards/cards-modules-test-forms/${CARDS_VERSION}/slingosgifeature" - elif [[ ${legacyRunMode} == 'demo' ]] - then - 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" - elif [[ ${legacyRunMode} == 'permissions_open' ]] - then - PERMISSIONS="open" - elif [[ ${legacyRunMode} == 'permissions_trusted' ]] - then - PERMISSIONS="trusted" - elif [[ ${legacyRunMode} == 'permissions_ownership' ]] - then - PERMISSIONS="ownership" - fi -done - # Read /sling-features.json and enable the features required for this project -PROJECT_REQUIRED_FEATURES=$(CARDS_VERSION=${CARDS_VERSION} PROJECT_NAME=${CARDS_PROJECT} PROJECT_VERSION=${PROJECT_VERSION} PERMISSIONS=${PERMISSIONS} python3 /get_project_dependency_features.py /sling-features.json) +PROJECT_REQUIRED_FEATURES=$(CARDS_VERSION=${CARDS_VERSION} PROJECT_NAME=${PROJECT_NAME} PROJECT_VERSION=${PROJECT_VERSION} PERMISSIONS=${PERMISSIONS} python3 /get_project_dependency_features.py /sling-features.json) if [ ! -z $PROJECT_REQUIRED_FEATURES ] then featureFlagString="$featureFlagString -f $PROJECT_REQUIRED_FEATURES" @@ -153,7 +109,7 @@ echo "ADDITIONAL_RUN_MODES = $ADDITIONAL_RUN_MODES" echo "ADDITIONAL_SLING_FEATURES = $ADDITIONAL_SLING_FEATURES" echo "CARDS_ARTIFACTID = $CARDS_ARTIFACTID" echo "CARDS_VERSION = $CARDS_VERSION" -echo "CARDS_PROJECT = $CARDS_PROJECT" +echo "PROJECT_NAME = $PROJECT_NAME" echo "PROJECT_VERSION = $PROJECT_VERSION" #Are we using an external MongoDB service for data storage?