From a2652036a300458bbc6f25748a17fc2cd7940626 Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 11 Feb 2025 16:46:30 -0800 Subject: [PATCH 01/10] Best guess at modified entrypoint.sh Modified log4j2 config to only provide overrides --- entrypoint.sh | 5 +- log4j2.xml | 321 ++------------------------------------------------ 2 files changed, 12 insertions(+), 314 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 5665132..fed61fc 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -226,9 +226,7 @@ main() { if [ "$JSON_OUTPUT" = "true" ] && [ "$LOG4J_CONFIG_FILE" = "log4j2.xml" ]; then echo "JSON_OUTPUT==true && LOG4J_CONFIG_FILE==log4j2.xml, so updating application.properties and log4j2.xml to output JSON to console" - sed -i '//d' $LOG4J_CONFIG_FILE - sed -i 's///' $LOG4J_CONFIG_FILE - sed -i 's/^logging.pattern.console/# logging.pattern.console/' config/application.properties + cp $LOG4J_CONFIG_FILE "$LABKEY_HOME/classes/configs/01.log4j2.xml" else echo "saw JSON_OUTPUT=$JSON_OUTPUT and LOG4J_CONFIG_FILE=$LOG4J_CONFIG_FILE" fi @@ -296,7 +294,6 @@ main() { -Dlogback.debug="$debug_string" \ \ -Dlog4j.debug="$debug_string" \ - -Dlog4j.configurationFile="$LOG4J_CONFIG_FILE" \ \ -Dorg.apache.catalina.startup.EXIT_ON_INIT_FAILURE=true \ \ diff --git a/log4j2.xml b/log4j2.xml index 34c6d70..ea09063 100644 --- a/log4j2.xml +++ b/log4j2.xml @@ -3,342 +3,43 @@ - - - - - - + + - - - - - - %-5p %-24.24c{1} %d{ISO8601} %24.24t : %m%n - - - - - - - - - - - - - - - %m%n - - - - - - - - - - - - %m%n - - - - - - - - - - - - %-5p %-24.24c{1} %d{ISO8601} %24.24t : %m%n - - - - - - - - - - - %-5p %-24.24c{1} %d{ISO8601} %24.24t : %m%n - - - - - - - - - - %-5p %-24.24c{1} %d{ISO8601} %24.24t : %m%n - - - - - - - %d{yyyy-MM-dd HH:mm:ss}%m%n - - - - - - - - - - - %m%n - - - - - - - - - - - %-5p %-24.24c{1} %d{ISO8601} %24.24t : %m%n - - - - - - - - - - - %d{ISO8601} %m%n - - - - - - - - + + + - + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - + - + - - - - - - - - From 88e946820358687c43ee8f0d4997407cb137869c Mon Sep 17 00:00:00 2001 From: ian Date: Fri, 14 Feb 2025 11:45:41 -0800 Subject: [PATCH 02/10] adjust casing of CONSOLE logger, and remove extrea space --- log4j2.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/log4j2.xml b/log4j2.xml index ea09063..930baa6 100644 --- a/log4j2.xml +++ b/log4j2.xml @@ -3,7 +3,7 @@ - + @@ -13,7 +13,7 @@ - + @@ -26,20 +26,20 @@ - + - + - + From 58735fabc3ae51662fe036cdc1e0d54b6fa406c2 Mon Sep 17 00:00:00 2001 From: ian Date: Fri, 14 Feb 2025 11:52:25 -0800 Subject: [PATCH 03/10] Adjusting the path the log4j2.xml file is copied to. --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index fed61fc..d7ac311 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -226,7 +226,7 @@ main() { if [ "$JSON_OUTPUT" = "true" ] && [ "$LOG4J_CONFIG_FILE" = "log4j2.xml" ]; then echo "JSON_OUTPUT==true && LOG4J_CONFIG_FILE==log4j2.xml, so updating application.properties and log4j2.xml to output JSON to console" - cp $LOG4J_CONFIG_FILE "$LABKEY_HOME/classes/configs/01.log4j2.xml" + cp $LOG4J_CONFIG_FILE "$LABKEY_HOME/configs/01.log4j2.xml" else echo "saw JSON_OUTPUT=$JSON_OUTPUT and LOG4J_CONFIG_FILE=$LOG4J_CONFIG_FILE" fi From 45db8a99077eecce9b2e76bfcb477283c400f7b5 Mon Sep 17 00:00:00 2001 From: Will Mooreston Date: Fri, 14 Feb 2025 15:05:25 -0800 Subject: [PATCH 04/10] fix log4j copy path; update README with new log4j setup; set quickstart to 25.3 --- README.md | 3 +++ entrypoint.sh | 2 +- quickstart_envs.sh | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fcb2f7e..448f28a 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,9 @@ The policy itself can be overriden with an `optional.application.properties` fil CSP_REPORT and CSP_ENFORCE environment variables have been removed. +## log4j2.xml +March 2025 brings a new implementation of log4j2.xml. We're now using the default configuration from the [server repo](https://github.com/LabKey/server/blob/develop/server/embedded/src/main/resources/log4j2.xml), and overwriting that as needed with the local log4j2.xml file in this repo. During startup, entrypoint.sh copies the local file into the configs directory after the jar has been opened up. + ## Upgrading from 23.11 to 24.3 March 2024 saw [many changes](https://github.com/LabKey/Dockerfile/commits/24.3.0) in an effort to bring this repo in line with LabKey server versioning/releases, starting with v24.3, in which the embedded tomcat version has been upgraded from 9 to 10. diff --git a/entrypoint.sh b/entrypoint.sh index d7ac311..594227a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -226,7 +226,7 @@ main() { if [ "$JSON_OUTPUT" = "true" ] && [ "$LOG4J_CONFIG_FILE" = "log4j2.xml" ]; then echo "JSON_OUTPUT==true && LOG4J_CONFIG_FILE==log4j2.xml, so updating application.properties and log4j2.xml to output JSON to console" - cp $LOG4J_CONFIG_FILE "$LABKEY_HOME/configs/01.log4j2.xml" + cp $LOG4J_CONFIG_FILE "$LABKEY_HOME/config/01.log4j2.xml" else echo "saw JSON_OUTPUT=$JSON_OUTPUT and LOG4J_CONFIG_FILE=$LOG4J_CONFIG_FILE" fi diff --git a/quickstart_envs.sh b/quickstart_envs.sh index e7cde42..816e526 100644 --- a/quickstart_envs.sh +++ b/quickstart_envs.sh @@ -3,7 +3,7 @@ # example minimal set of environment variables to get started - see readme for additional envs you may wish to set # embedded tomcat LabKey .jar version to build container with -export LABKEY_VERSION="24.11" +export LABKEY_VERSION="25.3" # minimal SMTP settings export SMTP_HOST="localhost" From 1e219f2bdfaaf9e1215b1eae603c0783d579c2f5 Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 5 Mar 2025 15:52:19 -0800 Subject: [PATCH 05/10] use the override effect of the `log4j2.configurationFile` property --- Dockerfile | 7 +++++-- Makefile | 22 +++++++++++----------- docker-compose.yml | 4 ++++ entrypoint.sh | 8 +++++--- log4j2.xml | 19 ++++++++++--------- quickstart_envs.sh | 4 +++- 6 files changed, 38 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4592efc..33802ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,6 +72,8 @@ ENV DEBUG="${DEBUG}" \ LOG_LEVEL_SPRING_WEB="OFF" \ LOG_LEVEL_SQL="OFF" \ \ + LOG4J_CONFIG_OVERRIDE=\ + \ TOMCAT_KEYSTORE_FILENAME="labkey.p12" \ TOMCAT_KEYSTORE_FORMAT="PKCS12" \ TOMCAT_KEYSTORE_ALIAS="tomcat" \ @@ -80,7 +82,7 @@ ENV DEBUG="${DEBUG}" \ TOMCAT_SSL_ENABLED_PROTOCOLS="TLSv1.3,TLSv1.2" \ TOMCAT_SSL_PROTOCOL="TLS" \ \ - TOMCAT_ENABLE_ACCESS_LOG= + TOMCAT_ENABLE_ACCESS_LOG= ENV CERT_C="US" \ CERT_ST="Washington" \ @@ -212,7 +214,8 @@ COPY "startup/${LABKEY_DISTRIBUTION}.properties" \ startup/49_distribution.properties # add logging config files -COPY log4j2.xml log4j2.xml +#COPY log4j2.xml log4j2.xml +COPY "${LOG4J_CONFIG_OVERRIDE}" "config/${LOG4J_CONFIG_OVERRIDE}" # add aws cli & make it owned by labkey user so it can all be deleted after s3 downloads in entrypoint.sh RUN mkdir -p /usr/src/awsclizip "${LABKEY_HOME}/awsclibin" "${LABKEY_HOME}/aws-cli" \ diff --git a/Makefile b/Makefile index 2871718..bfe013d 100644 --- a/Makefile +++ b/Makefile @@ -101,27 +101,27 @@ push: up: $(call tc,bringing up compose) - docker-compose up --abort-on-container-exit ${BUILD_DISTRIBUTION} \ - || docker-compose stop ${BUILD_DISTRIBUTION} pg-${BUILD_DISTRIBUTION} + docker compose up --abort-on-container-exit ${BUILD_DISTRIBUTION} \ + || docker compose stop ${BUILD_DISTRIBUTION} pg-${BUILD_DISTRIBUTION} up-allpg: $(call tc,bringing up compose) - docker-compose up --abort-on-container-exit allpg \ - || docker-compose stop allpg pg-allpg + docker compose up --abort-on-container-exit allpg \ + || docker compose stop allpg pg-allpg up-enterprise: $(call tc,bringing up compose) - docker-compose up --abort-on-container-exit enterprise \ - || docker-compose stop enterprise pg-enterprise + docker compose up --abort-on-container-exit enterprise \ + || docker compose stop enterprise pg-enterprise up-lims_starter: $(call tc,bringing up compose) - docker-compose up --abort-on-container-exit lims_starter \ - || docker-compose stop lims_starter pg-lims_starter + docker compose up --abort-on-container-exit lims_starter \ + || docker compose stop lims_starter pg-lims_starter down: $(call tc,tearing down compose) - docker-compose down -v --remove-orphans + docker compose down -v --remove-orphans clean: docker images | grep -E '$(BUILD_REPO_NAME)|' \ @@ -131,13 +131,13 @@ clean: test: down $(call tc,running smoke tests) - IDENT=${BUILD_DISTRIBUTION} docker-compose up --detach ${BUILD_DISTRIBUTION}; + IDENT=${BUILD_DISTRIBUTION} docker compose up --detach ${BUILD_DISTRIBUTION}; @./smoke.bash \ && printf "##teamcity[progressMessage '%s']\n" 'smoke test succeeded' \ || printf "##teamcity[buildProblem description='%s' identity='%s']\n" \ 'smoke test failed' \ 'failure' - IDENT=${BUILD_DISTRIBUTION} docker-compose down -v + IDENT=${BUILD_DISTRIBUTION} docker compose down -v pull: login docker pull $(BUILD_REMOTE_REPO):$(PULL_TAG) diff --git a/docker-compose.yml b/docker-compose.yml index 10b6d0f..adfeedc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -83,6 +83,7 @@ services: - LABKEY_OPTIONAL_APP_PROPERTIES_S3_URI=${LABKEY_OPTIONAL_APP_PROPERTIES_S3_URI} - LABKEY_DEFAULT_PROPERTIES_S3_URI=${LABKEY_DEFAULT_PROPERTIES_S3_URI} - LOG4J_CONFIG_FILE=${LOG4J_CONFIG_FILE-log4j2.xml} + - LOG4J_CONFIG_OVERRIDE=${LOG4J_CONFIG_OVERRIDE} - JSON_OUTPUT=${JSON_OUTPUT-false} - DD_COLLECT_APM=${DD_COLLECT_APM-false} - SLEEP=${SLEEP:-0} @@ -196,6 +197,7 @@ services: - LABKEY_OPTIONAL_APP_PROPERTIES_S3_URI=${LABKEY_OPTIONAL_APP_PROPERTIES_S3_URI} - LABKEY_DEFAULT_PROPERTIES_S3_URI=${LABKEY_DEFAULT_PROPERTIES_S3_URI} - LOG4J_CONFIG_FILE=${LOG4J_CONFIG_FILE-log4j2.xml} + - LOG4J_CONFIG_OVERRIDE=${LOG4J_CONFIG_OVERRIDE} - JSON_OUTPUT=${JSON_OUTPUT-false} - DD_COLLECT_APM=${DD_COLLECT_APM-false} - SLEEP=${SLEEP:-0} @@ -307,6 +309,7 @@ services: - LABKEY_OPTIONAL_APP_PROPERTIES_S3_URI=${LABKEY_OPTIONAL_APP_PROPERTIES_S3_URI} - LABKEY_DEFAULT_PROPERTIES_S3_URI=${LABKEY_DEFAULT_PROPERTIES_S3_URI} - LOG4J_CONFIG_FILE=${LOG4J_CONFIG_FILE-log4j2.xml} + - LOG4J_CONFIG_OVERRIDE=${LOG4J_CONFIG_OVERRIDE} - JSON_OUTPUT=${JSON_OUTPUT-false} - DD_COLLECT_APM=${DD_COLLECT_APM-false} - SLEEP=${SLEEP:-0} @@ -419,6 +422,7 @@ services: - LABKEY_OPTIONAL_APP_PROPERTIES_S3_URI=${LABKEY_OPTIONAL_APP_PROPERTIES_S3_URI} - LABKEY_DEFAULT_PROPERTIES_S3_URI=${LABKEY_DEFAULT_PROPERTIES_S3_URI} - LOG4J_CONFIG_FILE=${LOG4J_CONFIG_FILE-log4j2.xml} + - LOG4J_CONFIG_OVERRIDE=${LOG4J_CONFIG_OVERRIDE} - JSON_OUTPUT=${JSON_OUTPUT-false} - DD_COLLECT_APM=${DD_COLLECT_APM-false} - SLEEP=${SLEEP:-0} diff --git a/entrypoint.sh b/entrypoint.sh index 594227a..32c036a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -224,11 +224,12 @@ main() { sed -i "s/@@encryptionKey@@/${LABKEY_EK}/" config/application.properties - if [ "$JSON_OUTPUT" = "true" ] && [ "$LOG4J_CONFIG_FILE" = "log4j2.xml" ]; then + if [ "$JSON_OUTPUT" = "true" ] && [ "$LOG4J_CONFIG_FILE" = "log4j2.xml" ] && [ -n "$LOG4J_CONFIG_OVERRIDE" ]; then echo "JSON_OUTPUT==true && LOG4J_CONFIG_FILE==log4j2.xml, so updating application.properties and log4j2.xml to output JSON to console" - cp $LOG4J_CONFIG_FILE "$LABKEY_HOME/config/01.log4j2.xml" + LOG4J_CONFIG_FILE="${LOG4J_CONFIG_FILE:=log4j2.xml},config/${LOG4J_CONFIG_OVERRIDE}" + echo "Log4j configuration files: $LOG4J_CONFIG_FILE" else - echo "saw JSON_OUTPUT=$JSON_OUTPUT and LOG4J_CONFIG_FILE=$LOG4J_CONFIG_FILE" + echo "saw JSON_OUTPUT=$JSON_OUTPUT and LOG4J_CONFIG_FILE=$LOG4J_CONFIG_FILE and LOG4J_CONFIG_OVERRIDE=$LOG4J_CONFIG_OVERRIDE" fi export DD_JAVA_AGENT="" @@ -294,6 +295,7 @@ main() { -Dlogback.debug="$debug_string" \ \ -Dlog4j.debug="$debug_string" \ + -Dlog4j.configurationFile="$LOG4J_CONFIG_FILE" \ \ -Dorg.apache.catalina.startup.EXIT_ON_INIT_FAILURE=true \ \ diff --git a/log4j2.xml b/log4j2.xml index 930baa6..8d03def 100644 --- a/log4j2.xml +++ b/log4j2.xml @@ -12,34 +12,35 @@ - - - - - + + + + + - - - - + + + + + diff --git a/quickstart_envs.sh b/quickstart_envs.sh index 816e526..d07a3cb 100644 --- a/quickstart_envs.sh +++ b/quickstart_envs.sh @@ -3,7 +3,7 @@ # example minimal set of environment variables to get started - see readme for additional envs you may wish to set # embedded tomcat LabKey .jar version to build container with -export LABKEY_VERSION="25.3" +export LABKEY_VERSION="25.3-SNAPSHOT" # minimal SMTP settings export SMTP_HOST="localhost" @@ -19,3 +19,5 @@ export LABKEY_CREATE_INITIAL_USER_APIKEY="" export LABKEY_DEFAULT_PROPERTIES_S3_URI="none" export LABKEY_CUSTOM_PROPERTIES_S3_URI="none" export LABKEY_OPTIONAL_APP_PROPERTIES_S3_URI="none" + +export LOG4J_CONFIG_OVERRIDE="override.log4j2.xml" From c4618fd30f5ab04e64551a26cfd16d986a576e6d Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 6 Mar 2025 14:28:19 -0800 Subject: [PATCH 06/10] update the Dockerfile and entrypoint.sh to use the override file as needed --- Dockerfile | 9 ++++----- Makefile | 3 +++ default.log4j2.xml | 0 entrypoint.sh | 7 +++++-- log4j2.xml => labkey.log4j2.xml | 0 quickstart_envs.sh | 2 +- 6 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 default.log4j2.xml rename log4j2.xml => labkey.log4j2.xml (100%) diff --git a/Dockerfile b/Dockerfile index 33802ab..8a41c33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,10 +14,11 @@ FROM base # this will assume whatever FROM_TAG was set in first stage above ARG FROM_TAG -ARG DEBUG= +ARG DEBUG ARG LABKEY_VERSION ARG LABKEY_DISTRIBUTION ARG LABKEY_EK +ARG LOG4J_CONFIG_OVERRIDE # dependent ENVs declared separately ENV POSTGRES_USER="postgres" \ @@ -72,8 +73,6 @@ ENV DEBUG="${DEBUG}" \ LOG_LEVEL_SPRING_WEB="OFF" \ LOG_LEVEL_SQL="OFF" \ \ - LOG4J_CONFIG_OVERRIDE=\ - \ TOMCAT_KEYSTORE_FILENAME="labkey.p12" \ TOMCAT_KEYSTORE_FORMAT="PKCS12" \ TOMCAT_KEYSTORE_ALIAS="tomcat" \ @@ -94,9 +93,9 @@ ENV CERT_C="US" \ SMTP_HOST="localhost" \ SMTP_USER="root" \ SMTP_PORT="25" \ - SMTP_PASSWORD= \ + SMTP_PASSWORD="" \ SMTP_FROM="${LABKEY_SYSTEM_EMAIL_ADDRESS}" \ - SMTP_STARTTLS= \ + SMTP_STARTTLS="" \ SMTP_AUTH="false" \ \ MAX_JVM_RAM_PERCENT="90.0" \ diff --git a/Makefile b/Makefile index bfe013d..85a85cf 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,8 @@ LABKEY_VERSION ?= 21.5-SNAPSHOT LABKEY_DISTRIBUTION ?= community LABKEY_EK ?= 123abc456 +LOG4J_CONFIG_OVERRIDE ?= default.log4j2.xml + BUILD_ARCHITECTURE ?= linux/amd64 # repo/image:tags must be lowercase @@ -69,6 +71,7 @@ build: --build-arg 'LABKEY_VERSION=$(LABKEY_VERSION)' \ --build-arg 'LABKEY_DISTRIBUTION=$(BUILD_DISTRIBUTION)' \ --build-arg 'LABKEY_EK=$(LABKEY_EK)' \ + --build-arg 'LOG4J_CONFIG_OVERRIDE=${LOG4J_CONFIG_OVERRIDE}' \ . login: diff --git a/default.log4j2.xml b/default.log4j2.xml new file mode 100644 index 0000000..e69de29 diff --git a/entrypoint.sh b/entrypoint.sh index 32c036a..bc18bf0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -224,8 +224,10 @@ main() { sed -i "s/@@encryptionKey@@/${LABKEY_EK}/" config/application.properties - if [ "$JSON_OUTPUT" = "true" ] && [ "$LOG4J_CONFIG_FILE" = "log4j2.xml" ] && [ -n "$LOG4J_CONFIG_OVERRIDE" ]; then - echo "JSON_OUTPUT==true && LOG4J_CONFIG_FILE==log4j2.xml, so updating application.properties and log4j2.xml to output JSON to console" + # TODO: do we need the JSON check anymore? should we just take the override if it is set? + # Check if we want JSON output, we are using the base log4j2.xml config, and have an override config to use + if [ "${JSON_OUTPUT}" = "true" ] && [ "${LOG4J_CONFIG_FILE}" = "log4j2.xml" ] && [ -s "config/${LOG4J_CONFIG_OVERRIDE}" ]; then + echo "JSON_OUTPUT==true && LOG4J_CONFIG_FILE==log4j2.xml && LOG4J_CONFIG_OVERRIDE is set, so updating application.properties and log4j2.xml to output JSON to console" LOG4J_CONFIG_FILE="${LOG4J_CONFIG_FILE:=log4j2.xml},config/${LOG4J_CONFIG_OVERRIDE}" echo "Log4j configuration files: $LOG4J_CONFIG_FILE" else @@ -296,6 +298,7 @@ main() { \ -Dlog4j.debug="$debug_string" \ -Dlog4j.configurationFile="$LOG4J_CONFIG_FILE" \ + -Ddevmode=true \ \ -Dorg.apache.catalina.startup.EXIT_ON_INIT_FAILURE=true \ \ diff --git a/log4j2.xml b/labkey.log4j2.xml similarity index 100% rename from log4j2.xml rename to labkey.log4j2.xml diff --git a/quickstart_envs.sh b/quickstart_envs.sh index d07a3cb..5a04459 100644 --- a/quickstart_envs.sh +++ b/quickstart_envs.sh @@ -20,4 +20,4 @@ export LABKEY_DEFAULT_PROPERTIES_S3_URI="none" export LABKEY_CUSTOM_PROPERTIES_S3_URI="none" export LABKEY_OPTIONAL_APP_PROPERTIES_S3_URI="none" -export LOG4J_CONFIG_OVERRIDE="override.log4j2.xml" +export LOG4J_CONFIG_OVERRIDE="default.log4j2.xml" From 1e9c59710090bc667706272fe0134e5e0c4d4413 Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 6 Mar 2025 14:40:25 -0800 Subject: [PATCH 07/10] Update the README --- README.md | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 448f28a..327efbb 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ The policy itself can be overriden with an `optional.application.properties` fil CSP_REPORT and CSP_ENFORCE environment variables have been removed. ## log4j2.xml -March 2025 brings a new implementation of log4j2.xml. We're now using the default configuration from the [server repo](https://github.com/LabKey/server/blob/develop/server/embedded/src/main/resources/log4j2.xml), and overwriting that as needed with the local log4j2.xml file in this repo. During startup, entrypoint.sh copies the local file into the configs directory after the jar has been opened up. +March 2025 brings a new implementation of log4j2.xml. We're now using the default configuration from the [server repo](https://github.com/LabKey/server/blob/develop/server/embedded/src/main/resources/log4j2.xml), and overriding that as needed with the local file identified in the `LOG4J_CONFIG_OVERRIDE` environment variable. By default this is an empty file that makes no changes, which is due to some complications of the Docker `COPY` command. During startup, entrypoint.sh copies the local files into the configs directory after the jar has been opened up. ## Upgrading from 23.11 to 24.3 March 2024 saw [many changes](https://github.com/LabKey/Dockerfile/commits/24.3.0) in an effort to bring this repo in line with LabKey server versioning/releases, starting with v24.3, in which the embedded tomcat version has been upgraded from 9 to 10. @@ -168,19 +168,21 @@ A better description of the LabKey settings can be found in the LabKey docs [her `LABKEY_GUID` is only relevant if you are attempting to created/run a container destined to connect to a pre-existing database belonging to a pre-existing LabKey. -| name | purpose | default | -| --------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------ | -| LABKEY_BASE_SERVER_URL | full URI LabKey will use to refer to itself | `https://localhost:8443` | -| LABKEY_COMPANY_NAME | name of your organization; appears in emails | `Sirius Cybernetics` | -| LABKEY_DEFAULT_DOMAIN | (DNS) domain where the LabKey server resides | `localhost` | -| LABKEY_DISTRIBUTION | "flavor" of labkey; | `community` | -| LABKEY_FILES_ROOT | path within which will serve as the root of the "files" directory | `/labkey/files` | -| LABKEY_GUID | LabKey [server GUID](https://www.labkey.org/Documentation/wiki-page.view?name=stagingServerTips#guid) | `` | -| LABKEY_EK | LabKey [encryption key](https://www.labkey.org/Documentation/wiki-page.view?name=cpasxml#encrypt) | `123abc456` | -| LABKEY_PORT | port to which labkey will bind within the container | `8443` | -| LABKEY_SYSTEM_DESCRIPTION | brief description of server; appears in emails | `Sirius Cybernetics` | -| LABKEY_SYSTEM_EMAIL_ADDRESS | email address system email will be sent "from" | `do_not_reply@localhost` | -| LABKEY_SYSTEM_SHORT_NAME | name of server displayed in header | `Sirius Cybernetics` | +| name | purpose | default | +|-----------------------------|-------------------------------------------------------------------------------------------------------|--------------------------| +| LABKEY_BASE_SERVER_URL | full URI LabKey will use to refer to itself | `https://localhost:8443` | +| LABKEY_COMPANY_NAME | name of your organization; appears in emails | `Sirius Cybernetics` | +| LABKEY_DEFAULT_DOMAIN | (DNS) domain where the LabKey server resides | `localhost` | +| LABKEY_DISTRIBUTION | "flavor" of labkey; | `community` | +| LABKEY_FILES_ROOT | path within which will serve as the root of the "files" directory | `/labkey/files` | +| LABKEY_GUID | LabKey [server GUID](https://www.labkey.org/Documentation/wiki-page.view?name=stagingServerTips#guid) | `` | +| LABKEY_EK | LabKey [encryption key](https://www.labkey.org/Documentation/wiki-page.view?name=cpasxml#encrypt) | `123abc456` | +| LABKEY_PORT | port to which labkey will bind within the container | `8443` | +| LABKEY_SYSTEM_DESCRIPTION | brief description of server; appears in emails | `Sirius Cybernetics` | +| LABKEY_SYSTEM_EMAIL_ADDRESS | email address system email will be sent "from" | `do_not_reply@localhost` | +| LABKEY_SYSTEM_SHORT_NAME | name of server displayed in header | `Sirius Cybernetics` | +| LOG4J_CONFIG_OVERRIDE | Filename for a file that provides logging configuration overrides | `default.log4j.xml` | + You can optionally bypass the initial user creation "wizard" by creating an initial user using the following environment variables. **At time of writing, there is no way to set the initial user's password.** Assuming valid SMTP configuration, the "forgot password" link can be used to accomplish this. Additionally, an API can be created for that user. If both `LABKEY_CREATE_INITIAL_USER` & `LABKEY_CREATE_INITIAL_USER_APIKEY` are set to a values other than empty strings, but `LABKEY_INITIAL_USER_APIKEY` is not set, a randomly generated string will be used. Setting `LABKEY_CREATE_INITIAL_USER_APIKEY` without having set `LABKEY_CREATE_INITIAL_USER` will result in NO initial user being added. From 1fd867b095004e7a62fcfa2a81b964f78fc35783 Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 6 Mar 2025 14:43:35 -0800 Subject: [PATCH 08/10] Cleanup the missing assignment errors --- Dockerfile | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8a41c33..edd43ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,11 +36,11 @@ ENV DEBUG="${DEBUG}" \ \ CATALINA_HOME="${TOMCAT_BASE_DIR}" \ \ - POSTGRES_PASSWORD= \ + POSTGRES_PASSWORD="" \ POSTGRES_HOST="localhost" \ POSTGRES_PORT="5432" \ POSTGRES_DB="${POSTGRES_USER}" \ - POSTGRES_PARAMETERS= \ + POSTGRES_PARAMETERS="" \ \ POSTGRES_MAX_TOTAL_CONNECTIONS=50 \ POSTGRES_MAX_IDLE_CONNECTIONS=10 \ @@ -58,16 +58,16 @@ ENV DEBUG="${DEBUG}" \ LABKEY_SYSTEM_DESCRIPTION="${LABKEY_SYSTEM_SHORT_NAME}" \ LABKEY_BASE_SERVER_URL="https://${LABKEY_DEFAULT_DOMAIN}:${LABKEY_PORT}" \ \ - LABKEY_STARTUP_BASIC_EXTRA= \ - LABKEY_STARTUP_DISTRIBUTION_EXTRA= \ + LABKEY_STARTUP_BASIC_EXTRA="" \ + LABKEY_STARTUP_DISTRIBUTION_EXTRA="" \ \ - LABKEY_CREATE_INITIAL_USER= \ + LABKEY_CREATE_INITIAL_USER="" \ LABKEY_INITIAL_USER_EMAIL="toor@localhost" \ LABKEY_INITIAL_USER_ROLE="SiteAdminRole" \ LABKEY_INITIAL_USER_GROUP="Administrators" \ \ - LABKEY_CREATE_INITIAL_USER_APIKEY= \ - LABKEY_INITIAL_USER_APIKEY= \ + LABKEY_CREATE_INITIAL_USER_APIKEY="" \ + LABKEY_INITIAL_USER_APIKEY="" \ \ LOG_LEVEL_TOMCAT="OFF" \ LOG_LEVEL_SPRING_WEB="OFF" \ @@ -81,7 +81,7 @@ ENV DEBUG="${DEBUG}" \ TOMCAT_SSL_ENABLED_PROTOCOLS="TLSv1.3,TLSv1.2" \ TOMCAT_SSL_PROTOCOL="TLS" \ \ - TOMCAT_ENABLE_ACCESS_LOG= + TOMCAT_ENABLE_ACCESS_LOG="" ENV CERT_C="US" \ CERT_ST="Washington" \ @@ -100,18 +100,18 @@ ENV CERT_C="US" \ \ MAX_JVM_RAM_PERCENT="90.0" \ \ - JAVA_PRE_JAR_EXTRA= \ - JAVA_POST_JAR_EXTRA= \ + JAVA_PRE_JAR_EXTRA="" \ + JAVA_POST_JAR_EXTRA="" \ JAVA_TMPDIR="/var/tmp" \ JAVA_TIMEZONE="America/Los_Angeles" \ \ LOGGER_PATTERN="%-40.40logger{39}" \ - LOG_LEVEL_DEFAULT= \ + LOG_LEVEL_DEFAULT="" \ \ - LOG_LEVEL_LABKEY_DEFAULT= \ - LOG_LEVEL_API_MODULELOADER= \ - LOG_LEVEL_API_SETTINGS= \ - LOG_LEVEL_API_PIPELINE= + LOG_LEVEL_LABKEY_DEFAULT="" \ + LOG_LEVEL_API_MODULELOADER="" \ + LOG_LEVEL_API_SETTINGS="" \ + LOG_LEVEL_API_PIPELINE="" COPY entrypoint.sh /entrypoint.sh From d98dd5f333fa3d3a103563a5aae7d9cc1d188739 Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 11 Mar 2025 14:52:15 -0700 Subject: [PATCH 09/10] Cleanup dev cruft --- entrypoint.sh | 1 - quickstart_envs.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index bc18bf0..702b67f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -298,7 +298,6 @@ main() { \ -Dlog4j.debug="$debug_string" \ -Dlog4j.configurationFile="$LOG4J_CONFIG_FILE" \ - -Ddevmode=true \ \ -Dorg.apache.catalina.startup.EXIT_ON_INIT_FAILURE=true \ \ diff --git a/quickstart_envs.sh b/quickstart_envs.sh index 5a04459..c03ca40 100644 --- a/quickstart_envs.sh +++ b/quickstart_envs.sh @@ -3,7 +3,7 @@ # example minimal set of environment variables to get started - see readme for additional envs you may wish to set # embedded tomcat LabKey .jar version to build container with -export LABKEY_VERSION="25.3-SNAPSHOT" +export LABKEY_VERSION="25.3" # minimal SMTP settings export SMTP_HOST="localhost" From c109690226fa69d5b50fd87ffc14c379c3c78734 Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 13 Mar 2025 11:46:14 -0700 Subject: [PATCH 10/10] remove unused action --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index edd43ea..488e960 100644 --- a/Dockerfile +++ b/Dockerfile @@ -213,7 +213,6 @@ COPY "startup/${LABKEY_DISTRIBUTION}.properties" \ startup/49_distribution.properties # add logging config files -#COPY log4j2.xml log4j2.xml COPY "${LOG4J_CONFIG_OVERRIDE}" "config/${LOG4J_CONFIG_OVERRIDE}" # add aws cli & make it owned by labkey user so it can all be deleted after s3 downloads in entrypoint.sh