From b200819f2643fdb1190d6fc060012a599be39fad Mon Sep 17 00:00:00 2001
From: Stefan Haun <tux@netz39.de>
Date: Mon, 7 Nov 2022 16:35:41 +0100
Subject: [PATCH 1/5] =?UTF-8?q?:hammer:=20Rename=20ag=5Ftimezone=20?=
 =?UTF-8?q?=E2=86=92=20timezone?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Move from role-dependent to generic name for this variable
---
 group-all.yml           | 2 ++
 group_vars/all/vars.yml | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/group-all.yml b/group-all.yml
index 82c29ed..b3734cc 100644
--- a/group-all.yml
+++ b/group-all.yml
@@ -9,6 +9,8 @@
 
   roles:
     - role: ansible.timezone
+      vars:
+        ag_timezone: "{{ timezone }}"
 
   tasks:
     - name: Update and clean package cache
diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml
index 7c76ee4..8b8c893 100644
--- a/group_vars/all/vars.yml
+++ b/group_vars/all/vars.yml
@@ -1,7 +1,7 @@
 ---
 server_admin: "admin@netz39.de"
 
-ag_timezone: Europe/Berlin
+timezone: Europe/Berlin
 
 users:
   - logname: "alex"

From 6796e2f273549f195e20e32052c86ee9853a27a4 Mon Sep 17 00:00:00 2001
From: Stefan Haun <tux@netz39.de>
Date: Mon, 7 Nov 2022 16:43:12 +0100
Subject: [PATCH 2/5] :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:

From 5adb80503da2b42fc11368e2a5887dcd1e09ec6b Mon Sep 17 00:00:00 2001
From: Stefan Haun <tux@netz39.de>
Date: Mon, 7 Nov 2022 16:45:03 +0100
Subject: [PATCH 3/5] :wrench: Change env to yaml dict for gitea

---
 host-pottwal.yml | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/host-pottwal.yml b/host-pottwal.yml
index b8b96f0..b190836 100644
--- a/host-pottwal.yml
+++ b/host-pottwal.yml
@@ -61,15 +61,15 @@
           - 2222:2222
         env:
           TZ: "{{ timezone }}"
-          APP_NAME="Netz39 Gitea"
-          RUN_MODE="prod"
-          SSH_DOMAIN="gitea.n39.eu"
-          SSH_PORT="2222"
-          SSH_START_SERVER="false"
-          ROOT_URL="https://gitea.n39.eu"
-          DISABLE_REGISTRATION="true"
-          USER_UID=1000
-          USER_GID=1000
+          APP_NAME: "Netz39 Gitea"
+          RUN_MODE: "prod"
+          SSH_DOMAIN: "gitea.n39.eu"
+          SSH_PORT: "2222"
+          SSH_START_SERVER: "false"
+          ROOT_URL: "https://gitea.n39.eu"
+          DISABLE_REGISTRATION: "true"
+          USER_UID: "1000"
+          USER_GID: "1000"
         volumes:
           - "{{ data_dir }}/gitea:/data:rw"
 

From 83d1a646897def7aa718287ec29cd2eb65426a23 Mon Sep 17 00:00:00 2001
From: Stefan Haun <tux@netz39.de>
Date: Mon, 7 Nov 2022 16:46:04 +0100
Subject: [PATCH 4/5] :wrench: Change env to yaml dict for
 jabber-static-website

---
 host-pottwal.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/host-pottwal.yml b/host-pottwal.yml
index b190836..45c9764 100644
--- a/host-pottwal.yml
+++ b/host-pottwal.yml
@@ -158,8 +158,8 @@
         restart_policy: unless-stopped
         env:
           TZ: "{{ timezone }}"
-          SERVER_PORT=80
-          SERVER_ROOT=/public
+          SERVER_PORT: "80"
+          SERVER_ROOT: "/public"
         ports:
           - "127.0.0.1:{{ jabber_host_port }}:80"
         volumes:

From 0b83ee25cd7d2ffd698895a7265278ffa106d76c Mon Sep 17 00:00:00 2001
From: Stefan Haun <tux@netz39.de>
Date: Thu, 10 Nov 2022 17:54:25 +0100
Subject: [PATCH 5/5] :wrench: Add timezone info to cleanuri containers

---
 roles/cleanuri/tasks/main.yml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/roles/cleanuri/tasks/main.yml b/roles/cleanuri/tasks/main.yml
index 68ba2cf..b968729 100644
--- a/roles/cleanuri/tasks/main.yml
+++ b/roles/cleanuri/tasks/main.yml
@@ -11,6 +11,7 @@
       - "127.0.0.1:{{ cleanuri_ui_host_port }}:80"
     restart_policy: unless-stopped
     env:
+      TZ: "{{ timezone }}"
       REACT_APP_API_GATEWAY: "https://{{ cleanuri_api_domain }}"
 
 - name: Setup proxy site for the CleanURI WebUI
@@ -32,6 +33,7 @@
       - "127.0.0.1:{{ cleanuri_api_host_port }}:8080"
     restart_policy: unless-stopped
     env:
+      TZ: "{{ timezone }}"
       AMQP_HOST: "{{ cleanuri_amqp_host }}"
       AMQP_USER: "{{ cleanuri_amqp_user  }}"
       AMQP_PASS: "{{ cleanuri_amqp_pass }}"
@@ -48,6 +50,7 @@
     detach: yes
     restart_policy: unless-stopped
     env:
+      TZ: "{{ timezone }}"
       AMQP_HOST: "{{ cleanuri_amqp_host }}"
       AMQP_USER: "{{ cleanuri_amqp_user  }}"
       AMQP_PASS: "{{ cleanuri_amqp_pass }}"
@@ -64,6 +67,7 @@
     detach: yes
     restart_policy: unless-stopped
     env:
+      TZ: "{{ timezone }}"
       AMQP_HOST: "{{ cleanuri_amqp_host }}"
       AMQP_USER: "{{ cleanuri_amqp_user  }}"
       AMQP_PASS: "{{ cleanuri_amqp_pass }}"