From a068a65818db2889ae30ca024caa5986321037e7 Mon Sep 17 00:00:00 2001 From: Till Skrodzki Date: Sat, 18 Jan 2025 19:02:29 +0100 Subject: [PATCH 1/3] Add DB_APPENDIX to support additional parameters With https://github.com/Mailu/Mailu/pull/3701 the remark was left to set the DB collation for MariaDB setups. However, the Helm chart has no option to overwrite the SQLAlchemy URI really. It selfs DB_USER, DB_PW, DB_NAME and DB_HOST and thus triggers the Alchemy URI to be overwritten (and it overwrites it statically as well...). This commit adds the parameter / environment variable DB_APPENDIX allowing for, e.g., '?collation=utf8mb4_unicode_ci' to be set using an environment variable which the Helm chart can then set. --- core/admin/mailu/configuration.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py index e568deb98..abc9a7e4d 100644 --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -25,6 +25,7 @@ 'DB_PW': None, 'DB_HOST': 'database', 'DB_NAME': 'mailu', + 'DB_APPENDIX': '', 'SQLITE_DATABASE_FILE': 'data/main.db', 'SQLALCHEMY_DATABASE_URI': 'sqlite:////data/main.db', 'SQLALCHEMY_DATABASE_URI_ROUNDCUBE': 'sqlite:////data/roundcube.db', @@ -102,8 +103,8 @@ class ConfigManager: DB_TEMPLATES = { 'sqlite': 'sqlite:////{SQLITE_DATABASE_FILE}', - 'postgresql': 'postgresql://{DB_USER}:{DB_PW}@{DB_HOST}/{DB_NAME}', - 'mysql': 'mysql+mysqlconnector://{DB_USER}:{DB_PW}@{DB_HOST}/{DB_NAME}', + 'postgresql': 'postgresql://{DB_USER}:{DB_PW}@{DB_HOST}/{DB_NAME}{DB_APPENDIX}', + 'mysql': 'mysql+mysqlconnector://{DB_USER}:{DB_PW}@{DB_HOST}/{DB_NAME}{DB_APPENDIX}', } def __init__(self): From da10c88a2f2142d08eb6037228c3973ef4ac3196 Mon Sep 17 00:00:00 2001 From: Till Skrodzki Date: Sat, 18 Jan 2025 19:03:31 +0100 Subject: [PATCH 2/3] Add uvloop for prod execution postfix-mta-sts-resolver can optionally use uvloop speeding up asyncio execution --- core/base/requirements-prod.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/core/base/requirements-prod.txt b/core/base/requirements-prod.txt index 40b97bc4c..81f322898 100644 --- a/core/base/requirements-prod.txt +++ b/core/base/requirements-prod.txt @@ -78,6 +78,7 @@ tabulate==0.9.0 tenacity==8.2.3 typing_extensions==4.11.0 urllib3==2.2.1 +uvloop==0.21.0 validators==0.28.1 visitor==0.1.3 vobject==0.9.7 From a5cdf27534fdfefc11cbcf5a5b7da5e6825c2b3c Mon Sep 17 00:00:00 2001 From: Till Skrodzki Date: Sat, 18 Jan 2025 21:24:49 +0100 Subject: [PATCH 3/3] Update docs for DB_APPENDIX --- docs/faq.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/faq.rst b/docs/faq.rst index 5b4c153f6..5caa5be9c 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -992,6 +992,7 @@ Admin container fails to connect to external MariaDB database ````````````````````````````````````````````````````````````` If the admin container is `unable to connect to an external MariaDB database due to incompatible collation`_, you may need to change the ``SQLALCHEMY_DATABASE_URI`` setting to ensure the right connector is used. +Alternatively, you may set ``DB_APPENDIX`` accordingly. For example: ``?collation=utf8mb4_unicode_ci`` is appended as is just after the database name in case DB_TYPE and related values are set. MariaDB has no support for utf8mb4_0900_ai_ci which is the new default since MySQL version 8.0.