🔧 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)
This commit is contained in:
Stefan Haun 2022-11-07 16:43:12 +01:00
parent b200819f26
commit 6796e2f273
5 changed files with 34 additions and 2 deletions

View file

@ -61,6 +61,7 @@
container_default_behavior: no_defaults container_default_behavior: no_defaults
pull: true pull: true
env: env:
TZ: "{{ timezone }}"
LDAP_LOG_LEVEL: "256" LDAP_LOG_LEVEL: "256"
LDAP_ORGANISATION: "{{ ldap_org }}" LDAP_ORGANISATION: "{{ ldap_org }}"
LDAP_DOMAIN: "{{ ldap_domain }}" LDAP_DOMAIN: "{{ ldap_domain }}"
@ -125,6 +126,8 @@
ports: ports:
- "127.0.0.1:{{ entities_validation_svc_host_port }}:8080" - "127.0.0.1:{{ entities_validation_svc_host_port }}:8080"
restart_policy: unless-stopped restart_policy: unless-stopped
env:
TZ: "{{ timezone }}"
- name: Setup proxy site entities-validation.svc.n39.eu - name: Setup proxy site entities-validation.svc.n39.eu
include_role: include_role:

View file

@ -60,6 +60,7 @@
- 127.0.0.1:{{ gitea_host_port }}:3000 - 127.0.0.1:{{ gitea_host_port }}:3000
- 2222:2222 - 2222:2222
env: env:
TZ: "{{ timezone }}"
APP_NAME="Netz39 Gitea" APP_NAME="Netz39 Gitea"
RUN_MODE="prod" RUN_MODE="prod"
SSH_DOMAIN="gitea.n39.eu" SSH_DOMAIN="gitea.n39.eu"
@ -89,6 +90,9 @@
detach: yes detach: yes
ports: ports:
- 3142:3142 - 3142:3142
env:
TZ: "{{ timezone }}"
- name: Ensure container for shlink is running - name: Ensure container for shlink is running
@ -102,6 +106,7 @@
- "127.0.0.1:{{ shlink_host_port }}:8080" - "127.0.0.1:{{ shlink_host_port }}:8080"
restart_policy: unless-stopped restart_policy: unless-stopped
env: env:
TZ: "{{ timezone }}"
SHORT_DOMAIN_HOST: "{{ shlink_domain_name }}" SHORT_DOMAIN_HOST: "{{ shlink_domain_name }}"
SHORT_DOMAIN_SCHEMA: https SHORT_DOMAIN_SCHEMA: https
GEOLITE_LICENSE_KEY: "{{ shlink_geolite_license_key }}" 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/lib/prosody:/var/lib/prosody:rw"
- "{{ prosody_data_dir }}/var/log/prosody:/var/log/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" - "{{ 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 - name: Ensure container for static XMPP website is running
docker_container: docker_container:
@ -149,6 +157,7 @@
detach: true detach: true
restart_policy: unless-stopped restart_policy: unless-stopped
env: env:
TZ: "{{ timezone }}"
SERVER_PORT=80 SERVER_PORT=80
SERVER_ROOT=/public SERVER_ROOT=/public
ports: ports:
@ -199,6 +208,7 @@
restart_policy: unless-stopped restart_policy: unless-stopped
detach: yes detach: yes
env: env:
TZ: "{{ timezone }}"
POSTGRES_USER: "hedgedoc" POSTGRES_USER: "hedgedoc"
POSTGRES_PASSWORD: "{{ hedgedoc_postgres_password }}" POSTGRES_PASSWORD: "{{ hedgedoc_postgres_password }}"
POSTGRES_DB: "hedgedoc" POSTGRES_DB: "hedgedoc"
@ -218,6 +228,7 @@
- "127.0.0.1:{{ hedgedoc_host_port }}:3000" - "127.0.0.1:{{ hedgedoc_host_port }}:3000"
restart_policy: unless-stopped restart_policy: unless-stopped
env: env:
TZ: "{{ timezone }}"
NODE_ENV: "production" NODE_ENV: "production"
CMD_PROTOCOL_USESSL: "true" CMD_PROTOCOL_USESSL: "true"
CMD_DOMAIN: "pad.n39.eu" CMD_DOMAIN: "pad.n39.eu"
@ -259,6 +270,7 @@
- "127.0.0.1:{{ influxdb_host_port }}:8086" - "127.0.0.1:{{ influxdb_host_port }}:8086"
restart_policy: unless-stopped restart_policy: unless-stopped
env: env:
TZ: "{{ timezone }}"
DOCKER_INFLUXDB_INIT_USERNAME: "{{ influxdb_init_username }}" DOCKER_INFLUXDB_INIT_USERNAME: "{{ influxdb_init_username }}"
DOCKER_INFLUXDB_INIT_PASSWORD: "{{ influxdb_init_password }}" DOCKER_INFLUXDB_INIT_PASSWORD: "{{ influxdb_init_password }}"
DOCKER_INFLUXDB_INIT_ORG: Netz39 DOCKER_INFLUXDB_INIT_ORG: Netz39
@ -302,6 +314,7 @@
restart_policy: unless-stopped restart_policy: unless-stopped
detach: yes detach: yes
env: env:
TZ: "{{ timezone }}"
MYSQL_ROOT_PASSWORD: "{{ redmine_database_password }}" MYSQL_ROOT_PASSWORD: "{{ redmine_database_password }}"
MYSQL_DATABASE: "{{ redmine_database }}" MYSQL_DATABASE: "{{ redmine_database }}"
volumes: volumes:
@ -320,6 +333,7 @@
ports: ports:
- "127.0.0.1:{{ redmine_host_port }}:3000" - "127.0.0.1:{{ redmine_host_port }}:3000"
env: env:
TZ: "{{ timezone }}"
REDMINE_DB_MYSQL: redminedb REDMINE_DB_MYSQL: redminedb
REDMINE_DB_PASSWORD: "{{ redmine_database_password }}" REDMINE_DB_PASSWORD: "{{ redmine_database_password }}"
volumes: volumes:
@ -354,6 +368,8 @@
ports: ports:
- "127.0.0.1:{{ uptimekuma_host_port }}:3001" - "127.0.0.1:{{ uptimekuma_host_port }}:3001"
restart_policy: unless-stopped restart_policy: unless-stopped
env:
TZ: "{{ timezone }}"
volumes: volumes:
- "{{ data_dir }}/uptime-kuma:/app/data" - "{{ data_dir }}/uptime-kuma:/app/data"

View file

@ -72,6 +72,8 @@
detach: yes detach: yes
keep_volumes: yes keep_volumes: yes
restart_policy: unless-stopped restart_policy: unless-stopped
env:
TZ: "{{ timezone }}"
- name: Check if nodered data dir exists - name: Check if nodered data dir exists
ansible.builtin.stat: ansible.builtin.stat:
@ -89,7 +91,7 @@
pull: true pull: true
state: started state: started
env: env:
TZ: Europe/Berlin TZ: "{{ timezone }}"
NODE_RED_ENABLE_PROJECTS: "true" NODE_RED_ENABLE_PROJECTS: "true"
ports: ports:
- 127.0.0.1:9002:1880 - 127.0.0.1:9002:1880
@ -131,6 +133,7 @@
- 25672:25672 - 25672:25672
- 127.0.0.1:15672:15672 - 127.0.0.1:15672:15672
env: env:
TZ: "{{ timezone }}"
RABBITMQ_SECURE_PASSWORD: "yes" RABBITMQ_SECURE_PASSWORD: "yes"
volumes: volumes:
- "{{ rabbitmq_data }}/bitnami:/bitnami:rw" - "{{ rabbitmq_data }}/bitnami:/bitnami:rw"
@ -154,6 +157,7 @@
# - 127.0.0.1:9003:8080 # - 127.0.0.1:9003:8080
- 9003:8080 - 9003:8080
env: env:
TZ: "{{ timezone }}"
AMQP_HOST: "rabbitmq.n39.eu" AMQP_HOST: "rabbitmq.n39.eu"
AMQP_USER: "{{ pwr_meter_amqp_user }}" AMQP_USER: "{{ pwr_meter_amqp_user }}"
AMQP_PASS: "{{ pwr_meter_amqp_pass }}" AMQP_PASS: "{{ pwr_meter_amqp_pass }}"
@ -181,6 +185,8 @@
- "127.0.0.1:{{ brotherql_host_port }}:8013" - "127.0.0.1:{{ brotherql_host_port }}:8013"
command: " ./brother_ql_web.py --model QL-720NW tcp://{{ brotherql_printer_ip }}" command: " ./brother_ql_web.py --model QL-720NW tcp://{{ brotherql_printer_ip }}"
detach: yes detach: yes
env:
TZ: "{{ timezone }}"
- name: Setup proxy site brotherql-web.n39.eu - name: Setup proxy site brotherql-web.n39.eu
include_role: include_role:

View file

@ -61,6 +61,7 @@
- name: dockernet - name: dockernet
restart_policy: always restart_policy: always
env: env:
TZ: "{{ timezone }}"
PMA_HOST: 192.168.0.1 PMA_HOST: 192.168.0.1
MYSQL_ROOT_PASSWORD: "{{ mysql_root_pw }}" MYSQL_ROOT_PASSWORD: "{{ mysql_root_pw }}"
PMA_ABSOLUTE_URI: "https://mysql.adm.netz39.de" PMA_ABSOLUTE_URI: "https://mysql.adm.netz39.de"
@ -101,6 +102,7 @@
ports: ports:
- 127.0.0.1:{{ docker_registry_port }}:{{ docker_registry_port }} - 127.0.0.1:{{ docker_registry_port }}:{{ docker_registry_port }}
env: env:
TZ: "{{ timezone }}"
REGISTRY_HTTP_HOST: "https://{{ docker_registry_domain }}" REGISTRY_HTTP_HOST: "https://{{ docker_registry_domain }}"
REGISTRY_AUTH_HTPASSWD_REALM: "Netz39 Docker Registry" REGISTRY_AUTH_HTPASSWD_REALM: "Netz39 Docker Registry"
REGISTRY_AUTH_HTPASSWD_PATH: "/auth/htpasswd" REGISTRY_AUTH_HTPASSWD_PATH: "/auth/htpasswd"
@ -145,6 +147,8 @@
# and the container will never be created from scratch. # and the container will never be created from scratch.
volumes: volumes:
- "{{ data_dir }}/dokuwiki:/bitnami/dokuwiki:rw" - "{{ data_dir }}/dokuwiki:/bitnami/dokuwiki:rw"
env:
TZ: "{{ timezone }}"
- name: Setup proxy site for Dokuwiki - name: Setup proxy site for Dokuwiki
include_role: include_role:
@ -164,3 +168,6 @@
detach: yes detach: yes
ports: ports:
- "53:53/udp" - "53:53/udp"
env:
TZ: "{{ timezone }}"

View file

@ -18,7 +18,7 @@
restart_policy: unless-stopped restart_policy: unless-stopped
container_default_behavior: no_defaults container_default_behavior: no_defaults
env: env:
TZ: "Europe/Berlin" TZ: "{{ timezone }}"
# These fixed ports are needed. # These fixed ports are needed.
# https://help.ui.com/hc/en-us/articles/218506997-UniFi-Ports-Used # https://help.ui.com/hc/en-us/articles/218506997-UniFi-Ports-Used
ports: ports: