From e7679b6dde7d85daf758f3fc6b4675f9f862b14b Mon Sep 17 00:00:00 2001 From: Pavol Mederly <mederly@evolveum.com> Date: Fri, 5 Oct 2018 12:57:58 +0200 Subject: [PATCH] Add TIMEZONE parameter --- Dockerfile | 2 ++ container_files/usr-local-bin/setup-timezone.sh | 13 +++++++++++++ container_files/usr-local-bin/start-midpoint.sh | 1 - container_files/usr-local-bin/startup.sh | 2 ++ demo/complex/.env | 1 + demo/complex/docker-compose.yml | 1 + demo/extrepo/.env | 1 + demo/extrepo/docker-compose.yml | 1 + demo/postgresql/.env | 1 + demo/postgresql/docker-compose.yml | 1 + demo/shibboleth/.env | 2 ++ demo/shibboleth/docker-compose.yml | 1 + demo/simple/.env | 1 + demo/simple/docker-compose.yml | 1 + 14 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 container_files/usr-local-bin/setup-timezone.sh diff --git a/Dockerfile b/Dockerfile index aceaac1..f1476a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,7 @@ COPY container_files/opt-tier/* /opt/tier/ RUN chmod 755 /opt/tier/setenv.sh \ && chmod 755 /usr/local/bin/sendtierbeacon.sh \ && chmod 755 /usr/local/bin/setup-cron.sh \ + && chmod 755 /usr/local/bin/setup-timezone.sh \ && chmod 755 /usr/local/bin/start-midpoint.sh \ && chmod 755 /usr/local/bin/start-httpd.sh \ && chmod 755 /usr/local/bin/startup.sh \ @@ -93,6 +94,7 @@ ENV LOGOUT_URL https://localhost:8443/Shibboleth.sso/Logout ENV MP_KEYSTORE_PASSWORD_FILE /run/secrets/mp_keystore_password.txt ENV MP_MEM_MAX 2048m ENV MP_MEM_INIT 1024m +ENV TIMEZONE UTC ENV TIER_RELEASE not-released-yet ENV TIER_MAINTAINER tier diff --git a/container_files/usr-local-bin/setup-timezone.sh b/container_files/usr-local-bin/setup-timezone.sh new file mode 100755 index 0000000..b01eb8e --- /dev/null +++ b/container_files/usr-local-bin/setup-timezone.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [[ -n $TIMEZONE ]]; then + echo "*** Setting timezone to '$TIMEZONE'" + if [[ -e /usr/share/zoneinfo/$TIMEZONE ]]; then + unlink /etc/localtime + ln -s /usr/share/zoneinfo/$TIMEZONE /etc/localtime + echo "date (UTC) is: $(date -u)" + echo "date (current timezone) is $(date)" + else + echo "Error: time zone '$TIMEZONE' is unknown; not setting it." + fi +fi diff --git a/container_files/usr-local-bin/start-midpoint.sh b/container_files/usr-local-bin/start-midpoint.sh index ddc377b..043f97c 100755 --- a/container_files/usr-local-bin/start-midpoint.sh +++ b/container_files/usr-local-bin/start-midpoint.sh @@ -39,7 +39,6 @@ java -Xmx$MP_MEM_MAX -Xms$MP_MEM_INIT -Dfile.encoding=UTF8 \ -Dmidpoint.keystore.keyStorePassword_FILE=$MP_KEYSTORE_PASSWORD_FILE \ -Dmidpoint.logging.alt.enabled=true \ -Dmidpoint.logging.alt.filename=/tmp/logmidpoint \ - -Dmidpoint.logging.alt.timezone=UTC \ -Dspring.profiles.active="`$MP_DIR/active-spring-profiles`" \ $(if [ "$AUTHENTICATION" = "shibboleth" ]; then echo "-Dauth.logout.url=$LOGOUT_URL -Dauth.sso.header=$SSO_HEADER"; fi) \ -Dserver.tomcat.ajp.enabled=$AJP_ENABLED \ diff --git a/container_files/usr-local-bin/startup.sh b/container_files/usr-local-bin/startup.sh index fe880d0..9f11831 100755 --- a/container_files/usr-local-bin/startup.sh +++ b/container_files/usr-local-bin/startup.sh @@ -4,6 +4,8 @@ export ENV=${ENV//[; ]/_} export USERTOKEN=${USERTOKEN//[; ]/_} +/usr/local/bin/setup-timezone.sh + # this is to be executed at run time, not at build time -- to ensure sufficient variability of execution times /usr/local/bin/setup-cron.sh diff --git a/demo/complex/.env b/demo/complex/.env index eccc9c9..75949b1 100644 --- a/demo/complex/.env +++ b/demo/complex/.env @@ -11,3 +11,4 @@ REPO_UPGRADEABLE_SCHEMA_ACTION=stop MP_MEM_MAX=2048m MP_MEM_INIT=1024m SSO_HEADER=uid +TIMEZONE=UTC diff --git a/demo/complex/docker-compose.yml b/demo/complex/docker-compose.yml index 7080c66..9a1408f 100644 --- a/demo/complex/docker-compose.yml +++ b/demo/complex/docker-compose.yml @@ -157,6 +157,7 @@ services: - MP_JAVA_OPTS - SSO_HEADER - TIER_BEACON_OPT_OUT + - TIMEZONE networks: - net secrets: diff --git a/demo/extrepo/.env b/demo/extrepo/.env index a29d2b2..589cfcf 100644 --- a/demo/extrepo/.env +++ b/demo/extrepo/.env @@ -7,3 +7,4 @@ REPO_MISSING_SCHEMA_ACTION=create REPO_UPGRADEABLE_SCHEMA_ACTION=stop MP_MEM_MAX=2048m MP_MEM_INIT=1024m +TIMEZONE=UTC diff --git a/demo/extrepo/docker-compose.yml b/demo/extrepo/docker-compose.yml index 43c1d5d..ae4ad6a 100644 --- a/demo/extrepo/docker-compose.yml +++ b/demo/extrepo/docker-compose.yml @@ -22,6 +22,7 @@ services: - MP_MEM_INIT - MP_JAVA_OPTS - TIER_BEACON_OPT_OUT + - TIMEZONE networks: - net secrets: diff --git a/demo/postgresql/.env b/demo/postgresql/.env index a92b22a..06d99ad 100644 --- a/demo/postgresql/.env +++ b/demo/postgresql/.env @@ -5,3 +5,4 @@ REPO_MISSING_SCHEMA_ACTION=create REPO_UPGRADEABLE_SCHEMA_ACTION=stop MP_MEM_MAX=2048m MP_MEM_INIT=1024m +TIMEZONE=UTC diff --git a/demo/postgresql/docker-compose.yml b/demo/postgresql/docker-compose.yml index 60879d7..cfb4970 100644 --- a/demo/postgresql/docker-compose.yml +++ b/demo/postgresql/docker-compose.yml @@ -35,6 +35,7 @@ services: - MP_MEM_INIT - MP_JAVA_OPTS - TIER_BEACON_OPT_OUT + - TIMEZONE networks: - net secrets: diff --git a/demo/shibboleth/.env b/demo/shibboleth/.env index 21ec0af..f41f626 100644 --- a/demo/shibboleth/.env +++ b/demo/shibboleth/.env @@ -12,3 +12,5 @@ REPO_MISSING_SCHEMA_ACTION=create REPO_UPGRADEABLE_SCHEMA_ACTION=stop MP_MEM_MAX=2048m MP_MEM_INIT=1024m +TIMEZONE=UTC + diff --git a/demo/shibboleth/docker-compose.yml b/demo/shibboleth/docker-compose.yml index c656fe4..f1acebd 100644 --- a/demo/shibboleth/docker-compose.yml +++ b/demo/shibboleth/docker-compose.yml @@ -36,6 +36,7 @@ services: - MP_MEM_INIT - MP_JAVA_OPTS - TIER_BEACON_OPT_OUT + - TIMEZONE networks: - net secrets: diff --git a/demo/simple/.env b/demo/simple/.env index 2ae3222..c4cb989 100644 --- a/demo/simple/.env +++ b/demo/simple/.env @@ -11,3 +11,4 @@ REPO_MISSING_SCHEMA_ACTION=create REPO_UPGRADEABLE_SCHEMA_ACTION=stop MP_MEM_MAX=2048m MP_MEM_INIT=1024m +TIMEZONE=UTC diff --git a/demo/simple/docker-compose.yml b/demo/simple/docker-compose.yml index 2d1788c..c098dae 100644 --- a/demo/simple/docker-compose.yml +++ b/demo/simple/docker-compose.yml @@ -34,6 +34,7 @@ services: - MP_MEM_INIT - MP_JAVA_OPTS - TIER_BEACON_OPT_OUT + - TIMEZONE networks: - net secrets: