1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-03-03 14:52:36 +02:00
3699: Add the mariadb connector as per 3449 r=mergify[bot] a=nextgens

## What type of PR?

bug-fix

## What does this PR do?

Add the mariadb connector as per #3449.

MariaDB has no support for utf8mb4_0900_ai_ci which is the new default since MySQL version 8.0. In the current sqlalchemy version shipped with mailu, the mysqlconnector sets utf8mb4_0900_ai_ci as the collation to use when connecting. This causes all MariaDB connections to fail.

To fix the issue, either use the right connector or ensure it's configured with the right collation:
```
SQLALCHEMY_DATABASE_URI=mysql+mysqlconnector://<user>:<passwd>`@<host>/<database>?collation=utf8mb4_unicode_ci`
```

### Related issue(s)
- closes #3449

## Prerequisites
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [ ] In case of feature or enhancement: documentation updated accordingly
- [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file.


Co-authored-by: Florent Daigniere <nextgens@freenetproject.org>
This commit is contained in:
bors-mailu[bot] 2025-01-01 01:29:25 +00:00 committed by GitHub
commit fa8aa3a555
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 1 deletions

View File

@ -53,7 +53,7 @@ ENV \
RUN set -euxo pipefail \
; machine="$(uname -m)" \
; deps="build-base gcc libffi-dev python3-dev" \
; deps="build-base gcc libffi-dev python3-dev mariadb-dev" \
; [[ "${machine}" != x86_64 ]] && \
deps="${deps} cargo git libretls-dev mariadb-connector-c-dev postgresql-dev" \
; apk add --virtual .build-deps ${deps} \

View File

@ -22,6 +22,7 @@ gunicorn
idna
itsdangerous
limits
mariadb
marshmallow
marshmallow-sqlalchemy
mysql-connector-python

View File

@ -42,6 +42,7 @@ jsonschema==4.22.0
jsonschema-specifications==2023.12.1
limits==3.11.0
Mako==1.3.3
mariadb==1.1.11
MarkupSafe==2.1.5
marshmallow==3.21.2
marshmallow-sqlalchemy==1.0.0

View File

@ -986,3 +986,13 @@ Below are the steps for writing the postfix (mail) logs to a log file on the fil
if [ -d /run/systemd/system ]; then
systemctl kill -s HUP rsyslog.service
fi
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.
MariaDB has no support for utf8mb4_0900_ai_ci which is the new default since MySQL version 8.0.
.. _`unable to connect to an external MariaDB database due to incompatible collation`: https://github.com/Mailu/Mailu/issues/3449

View File

@ -0,0 +1 @@
Add the mariadb connector, as per #3449