public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[MySQL, PHP, DockerAPI] Move mysql_tzinfo_to_sql trigger to php-fpm-mailcow to prevent race condition on slow disks (known bug @ MariaDB)
6565e994
data/Dockerfiles/dockerapi/dockerapi.py | 8 ++++++++
data/Dockerfiles/phpfpm/docker-entrypoint.sh | 7 ++++++-
docker-compose.yml | 6 +++---
3 files changed, 17 insertions(+), 4 deletions(-)
Diff
diff --git a/data/Dockerfiles/dockerapi/dockerapi.py b/data/Dockerfiles/dockerapi/dockerapi.py
index ede9433c..135244b1 100644
--- a/data/Dockerfiles/dockerapi/dockerapi.py
+++ b/data/Dockerfiles/dockerapi/dockerapi.py
@@ -230,6 +230,14 @@ class container_post(Resource):
else:
return jsonify(type='error', msg='mysql_upgrade: error running command', text=sql_return.output.decode('utf-8'))
+ # api call: container_post - post_action: exec - cmd: system - task: mysql_tzinfo_to_sql
+ def container_post__exec__system__mysql_tzinfo_to_sql(self, container_id):
+ for container in docker_client.containers.list(filters={"id": container_id}):
+ sql_return = container.exec_run(["/bin/bash", "-c", "/usr/bin/mysql_tzinfo_to_sql /usr/share/zoneinfo | /bin/sed 's/Local time zone must be set--see zic manual page/FCTY/' | /usr/bin/mysql -uroot -p'" + os.environ['DBROOT'].replace("'", "'\\''") + "' mysql \n"], user='mysql')
+ if sql_return.exit_code == 0:
+ return jsonify(type='info', msg='mysql_tzinfo_to_sql: command completed successfully', text=sql_return.output.decode('utf-8'))
+ else:
+ return jsonify(type='error', msg='mysql_tzinfo_to_sql: error running command', text=sql_return.output.decode('utf-8'))
# api call: container_post - post_action: exec - cmd: reload - task: dovecot
def container_post__exec__reload__dovecot(self, container_id):
diff --git a/data/Dockerfiles/phpfpm/docker-entrypoint.sh b/data/Dockerfiles/phpfpm/docker-entrypoint.sh
index 546cb430..9c686518 100755
--- a/data/Dockerfiles/phpfpm/docker-entrypoint.sh
+++ b/data/Dockerfiles/phpfpm/docker-entrypoint.sh
@@ -25,7 +25,7 @@ if [[ -z $(redis-cli --raw -h redis-mailcow GET Q_MAX_AGE) ]]; then
redis-cli --raw -h redis-mailcow SET Q_MAX_AGE 365
fi
-# Check of mysql_upgrade
+# Check mysql_upgrade
CONTAINER_ID=
until [[ ! -z "${CONTAINER_ID}" ]] && [[ "${CONTAINER_ID}" =~ ^[[:alnum:]]*$ ]]; do
@@ -75,6 +75,11 @@ if [ ${SQL_CHANGED} -eq 1 ]; then
fi
fi
+# Check mysql tz import
+SQL_FULL_TZINFO_IMPORT_RETURN=$(curl --silent --insecure -XPOST https://dockerapi/containers/${CONTAINER_ID}/exec -d '{"cmd":"system", "task":"mysql_tzinfo_to_sql"}' --silent -H 'Content-type: application/json')
+echo "MySQL mysql_tzinfo_to_sql - debug output:"
+echo ${SQL_FULL_TZINFO_IMPORT_RETURN}
+
# Trigger db init
echo "Running DB init..."
php -c /usr/local/etc/php -f /web/inc/init_db.inc.php
diff --git a/docker-compose.yml b/docker-compose.yml
index 47d8e1e0..2d306846 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -30,7 +30,7 @@ services:
- MYSQL_DATABASE=${DBNAME}
- MYSQL_USER=${DBUSER}
- MYSQL_PASSWORD=${DBPASS}
-# - MYSQL_INITDB_SKIP_TZINFO=1
+ - MYSQL_INITDB_SKIP_TZINFO=1
restart: always
ports:
- "${SQL_PORT:-127.0.0.1:13306}:3306"
@@ -97,7 +97,7 @@ services:
- rspamd
php-fpm-mailcow:
- image: mailcow/phpfpm:1.52
+ image: mailcow/phpfpm:1.53
build: ./data/Dockerfiles/phpfpm
command: "php-fpm -d date.timezone=${TZ} -d expose_php=0"
depends_on:
@@ -401,7 +401,7 @@ services:
- watchdog
dockerapi-mailcow:
- image: mailcow/dockerapi:1.35
+ image: mailcow/dockerapi:1.36
restart: always
build: ./data/Dockerfiles/dockerapi
oom_kill_disable: true