1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-08-10 22:31:47 +02:00

Introduce connection string (database url) for roundcube.

Remove database choice from setup.
Remove the old *DB_* database env variables from the documentation.
The env vars are deprecated now. They will be removed after the upcoming
Mailu release.
This commit is contained in:
Dimitri Huisman
2023-03-26 12:21:00 +00:00
parent 6f3a01e31c
commit 709edb522b
10 changed files with 47 additions and 91 deletions

View File

@@ -1,8 +1,10 @@
Changing the database back-end
==============================
By default Mailu uses a SQLite database. We have changed the internals of Mailu
to enable the support of alternative database solutions such as PostgreSQL and MySQL/MariaDB.
By default Mailu uses a SQLite database. It is possible to use an alternative database solutions such as PostgreSQL and MySQL/MariaDB.
The Mailu database contains static data. SQLite is sufficient for any deployment scenario of Mailu. There is no need to use a different database system.
The Mailu development team recommends to use SQLite.
Migrating to a different database back-end
@@ -17,7 +19,7 @@ To switch to a different database back-end:
1. Run config-export to export the configuration. E.g. `docker compose exec admin flask mailu config-export --secrets --output mail-config.yml`
2. Set up your new database server. Refer to the subsequent sections for tips for creating the database.
3. Modify the database settings (DB_*) in mailu.env. Refer to the :ref:`configuration guide (link) <db_settings>` for the exact settings.
3. Modify the database settings (SQLAlchemy database URL) in mailu.env. Refer to the :ref:`configuration guide (link) <db_settings>` for the exact settings.
4. Start your Mailu deployment.
5. Run config-import to import the configuration. E.g. `docker exec -i $(docker compose ps -q admin) flask mailu config-import -v < mail-config.yml`
@@ -80,7 +82,7 @@ In ``pg_hba.conf`` there should be a line like this:
host mailu mailu <mailu_host>/32 md5
Note that this example is the bare-minimum to get Mailu working. Additional work needs to be
Note that this example is the bare-minimum to get Mailu working. Additional work needs to be
done by the database admin to setup their own means of backups and TLS encrypted connections.
Nowadays it is recommended to use the official PostgreSQL image from the PostgreSQL community. The repository is located `here <https://hub.docker.com/_/postgres>`_.
@@ -91,10 +93,10 @@ Mailu PostgreSQL
----------------
Mailu optionally came with a pre-configured PostgreSQL image which was deprecated in Mailu 1.8.
Since Mailu 1.9 it is removed from Mailu. The following section describes how to move to a different
Since Mailu 1.9 it is removed from Mailu. The following section describes how to move to a different
PostgreSQL image for novice administrators. The official PostgreSQL image (Postgres) will be used.
A Mailu deployment with the Mailu PostgreSQL image, will only use PostgreSQL for the Admin container
A Mailu deployment with the Mailu PostgreSQL image, will only use PostgreSQL for the Admin container
(Web administration interface). Roundcube uses SQLite as database back-end.
Mailu uses the following configuration for connecting to the database:
@@ -192,10 +194,7 @@ to
.. code-block:: docker
DB_HOST=database
DB_PORT=5432
DB_USER=mailu
DB_NAME=mailu
SQLALCHEMY_DATABASE_URI=postgresql://mailu:mailu@database/mailu
Mailu is now configured to use the official PostgreSQL docker image. Bring your new deployment online