From 6796e2f273549f195e20e32052c86ee9853a27a4 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Mon, 7 Nov 2022 16:43:12 +0100 Subject: [PATCH] :wrench: Add timezone information to docker containers Docker does not take the tzdata from host systems, so the timezone needs to be set individually. Otherwise dates without explicit timezone information or Z will be generated or interpreted in the wrong timezone (such as dokuwiki signatures) --- host-krypton.yml | 3 +++ host-pottwal.yml | 16 ++++++++++++++++ host-radon.yml | 8 +++++++- host-tau.yml | 7 +++++++ host-unicorn.yml | 2 +- 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/host-krypton.yml b/host-krypton.yml index 9d2a55d..e260480 100644 --- a/host-krypton.yml +++ b/host-krypton.yml @@ -61,6 +61,7 @@ container_default_behavior: no_defaults pull: true env: + TZ: "{{ timezone }}" LDAP_LOG_LEVEL: "256" LDAP_ORGANISATION: "{{ ldap_org }}" LDAP_DOMAIN: "{{ ldap_domain }}" @@ -125,6 +126,8 @@ ports: - "127.0.0.1:{{ entities_validation_svc_host_port }}:8080" restart_policy: unless-stopped + env: + TZ: "{{ timezone }}" - name: Setup proxy site entities-validation.svc.n39.eu include_role: diff --git a/host-pottwal.yml b/host-pottwal.yml index 88ab914..b8b96f0 100644 --- a/host-pottwal.yml +++ b/host-pottwal.yml @@ -60,6 +60,7 @@ - 127.0.0.1:{{ gitea_host_port }}:3000 - 2222:2222 env: + TZ: "{{ timezone }}" APP_NAME="Netz39 Gitea" RUN_MODE="prod" SSH_DOMAIN="gitea.n39.eu" @@ -89,6 +90,9 @@ detach: yes ports: - 3142:3142 + env: + TZ: "{{ timezone }}" + - name: Ensure container for shlink is running @@ -102,6 +106,7 @@ - "127.0.0.1:{{ shlink_host_port }}:8080" restart_policy: unless-stopped env: + TZ: "{{ timezone }}" SHORT_DOMAIN_HOST: "{{ shlink_domain_name }}" SHORT_DOMAIN_SCHEMA: https GEOLITE_LICENSE_KEY: "{{ shlink_geolite_license_key }}" @@ -139,6 +144,9 @@ - "{{ prosody_data_dir }}/var/lib/prosody:/var/lib/prosody:rw" - "{{ prosody_data_dir }}/var/log/prosody:/var/log/prosody:rw" - "{{ dehydrated_certs_dir }}/{{ prosody_domain_name }}:/var/lib/dehydrated/certs/{{ prosody_domain_name }}:ro" + env: + TZ: "{{ timezone }}" + - name: Ensure container for static XMPP website is running docker_container: @@ -149,6 +157,7 @@ detach: true restart_policy: unless-stopped env: + TZ: "{{ timezone }}" SERVER_PORT=80 SERVER_ROOT=/public ports: @@ -199,6 +208,7 @@ restart_policy: unless-stopped detach: yes env: + TZ: "{{ timezone }}" POSTGRES_USER: "hedgedoc" POSTGRES_PASSWORD: "{{ hedgedoc_postgres_password }}" POSTGRES_DB: "hedgedoc" @@ -218,6 +228,7 @@ - "127.0.0.1:{{ hedgedoc_host_port }}:3000" restart_policy: unless-stopped env: + TZ: "{{ timezone }}" NODE_ENV: "production" CMD_PROTOCOL_USESSL: "true" CMD_DOMAIN: "pad.n39.eu" @@ -259,6 +270,7 @@ - "127.0.0.1:{{ influxdb_host_port }}:8086" restart_policy: unless-stopped env: + TZ: "{{ timezone }}" DOCKER_INFLUXDB_INIT_USERNAME: "{{ influxdb_init_username }}" DOCKER_INFLUXDB_INIT_PASSWORD: "{{ influxdb_init_password }}" DOCKER_INFLUXDB_INIT_ORG: Netz39 @@ -302,6 +314,7 @@ restart_policy: unless-stopped detach: yes env: + TZ: "{{ timezone }}" MYSQL_ROOT_PASSWORD: "{{ redmine_database_password }}" MYSQL_DATABASE: "{{ redmine_database }}" volumes: @@ -320,6 +333,7 @@ ports: - "127.0.0.1:{{ redmine_host_port }}:3000" env: + TZ: "{{ timezone }}" REDMINE_DB_MYSQL: redminedb REDMINE_DB_PASSWORD: "{{ redmine_database_password }}" volumes: @@ -354,6 +368,8 @@ ports: - "127.0.0.1:{{ uptimekuma_host_port }}:3001" restart_policy: unless-stopped + env: + TZ: "{{ timezone }}" volumes: - "{{ data_dir }}/uptime-kuma:/app/data" diff --git a/host-radon.yml b/host-radon.yml index 33f9e13..4adf085 100644 --- a/host-radon.yml +++ b/host-radon.yml @@ -72,6 +72,8 @@ detach: yes keep_volumes: yes restart_policy: unless-stopped + env: + TZ: "{{ timezone }}" - name: Check if nodered data dir exists ansible.builtin.stat: @@ -89,7 +91,7 @@ pull: true state: started env: - TZ: Europe/Berlin + TZ: "{{ timezone }}" NODE_RED_ENABLE_PROJECTS: "true" ports: - 127.0.0.1:9002:1880 @@ -131,6 +133,7 @@ - 25672:25672 - 127.0.0.1:15672:15672 env: + TZ: "{{ timezone }}" RABBITMQ_SECURE_PASSWORD: "yes" volumes: - "{{ rabbitmq_data }}/bitnami:/bitnami:rw" @@ -154,6 +157,7 @@ # - 127.0.0.1:9003:8080 - 9003:8080 env: + TZ: "{{ timezone }}" AMQP_HOST: "rabbitmq.n39.eu" AMQP_USER: "{{ pwr_meter_amqp_user }}" AMQP_PASS: "{{ pwr_meter_amqp_pass }}" @@ -181,6 +185,8 @@ - "127.0.0.1:{{ brotherql_host_port }}:8013" command: " ./brother_ql_web.py --model QL-720NW tcp://{{ brotherql_printer_ip }}" detach: yes + env: + TZ: "{{ timezone }}" - name: Setup proxy site brotherql-web.n39.eu include_role: diff --git a/host-tau.yml b/host-tau.yml index aecb029..147ee7c 100644 --- a/host-tau.yml +++ b/host-tau.yml @@ -61,6 +61,7 @@ - name: dockernet restart_policy: always env: + TZ: "{{ timezone }}" PMA_HOST: 192.168.0.1 MYSQL_ROOT_PASSWORD: "{{ mysql_root_pw }}" PMA_ABSOLUTE_URI: "https://mysql.adm.netz39.de" @@ -101,6 +102,7 @@ ports: - 127.0.0.1:{{ docker_registry_port }}:{{ docker_registry_port }} env: + TZ: "{{ timezone }}" REGISTRY_HTTP_HOST: "https://{{ docker_registry_domain }}" REGISTRY_AUTH_HTPASSWD_REALM: "Netz39 Docker Registry" REGISTRY_AUTH_HTPASSWD_PATH: "/auth/htpasswd" @@ -145,6 +147,8 @@ # and the container will never be created from scratch. volumes: - "{{ data_dir }}/dokuwiki:/bitnami/dokuwiki:rw" + env: + TZ: "{{ timezone }}" - name: Setup proxy site for Dokuwiki include_role: @@ -164,3 +168,6 @@ detach: yes ports: - "53:53/udp" + env: + TZ: "{{ timezone }}" + diff --git a/host-unicorn.yml b/host-unicorn.yml index 67f5795..781a8bc 100644 --- a/host-unicorn.yml +++ b/host-unicorn.yml @@ -18,7 +18,7 @@ restart_policy: unless-stopped container_default_behavior: no_defaults env: - TZ: "Europe/Berlin" + TZ: "{{ timezone }}" # These fixed ports are needed. # https://help.ui.com/hc/en-us/articles/218506997-UniFi-Ports-Used ports: