[GH-ISSUE #76] Does it support Mariadb/MySQL #56

Closed
opened 2026-02-25 21:31:06 +03:00 by kerem · 11 comments
Owner

Originally created by @BobWs on GitHub (Aug 19, 2020).
Original GitHub issue: https://github.com/ciur/papermerge/issues/76

Originally assigned to: @ciur on GitHub.

Hi,
I would love to try your program, but at the moment I’m only using Docker Mariadb for all my DB related containers. So I was wondering if your app supports Mariadb, I couldn’t find anything about that.

Originally created by @BobWs on GitHub (Aug 19, 2020). Original GitHub issue: https://github.com/ciur/papermerge/issues/76 Originally assigned to: @ciur on GitHub. Hi, I would love to try your program, but at the moment I’m only using Docker Mariadb for all my DB related containers. So I was wondering if your app supports Mariadb, I couldn’t find anything about that.
kerem 2026-02-25 21:31:06 +03:00
Author
Owner

@ciur commented on GitHub (Aug 19, 2020):

Good point !

I never tried it, but in theory it should. Application code uses a layer of abstraction over DB - django's ORM system. So in theory you can configure it with Mariadb/MySql as well. However there is no documentation about this yet. I will handle this.

I will keep this ticket for reference to update documentation and try it myself with mariadb.
Thank you for opening this issue!

<!-- gh-comment-id:675915898 --> @ciur commented on GitHub (Aug 19, 2020): Good point ! I never tried it, but in theory it should. Application code uses a layer of abstraction over DB - django's ORM system. So in theory you can configure it with Mariadb/MySql as well. However there is no documentation about this yet. I will handle this. I will keep this ticket for reference to update documentation and try it myself with mariadb. Thank you for opening this issue!
Author
Owner

@BobWs commented on GitHub (Aug 19, 2020):

Good to know thanks for the opportunity. If you need someone for testing let me know, I’m glad to help. All the Docker container I’m running at the moment are running on Synology NAS.

<!-- gh-comment-id:676535023 --> @BobWs commented on GitHub (Aug 19, 2020): Good to know thanks for the opportunity. If you need someone for testing let me know, I’m glad to help. All the Docker container I’m running at the moment are running on Synology NAS.
Author
Owner

@ciur commented on GitHub (Aug 21, 2020):

great!
Now there are around 10 new tickets. So it will take maybe a week until I will handle this one.

<!-- gh-comment-id:678053165 --> @ciur commented on GitHub (Aug 21, 2020): great! Now there are around 10 new tickets. So it will take maybe a week until I will handle this one.
Author
Owner

@Diablofan commented on GitHub (Aug 22, 2020):

I'd like to see MariaDB support as well as I would like to only have one database server installed for all my web applications. It would make it easier to integrate with backup scripts I already have setup as well.

But from what it looks like according to the documentation it appears to be hard coded that the DB type is either SQLite or PostgreSQL based off of the config options you provide without a way to specify a DB driver, which seems to be confirmed up by this section of code here.

I think the first thing that would need done is to the DB engine explicitly configurable so it would allow the use of other DB engines. Obviously you wouldn't want to break existing configurations, so one way to accomplish that could be that not specifying a DB engine type in the config would keep the existing behavior of SQLite or PostgreSQL.

<!-- gh-comment-id:678591311 --> @Diablofan commented on GitHub (Aug 22, 2020): I'd like to see MariaDB support as well as I would like to only have one database server installed for all my web applications. It would make it easier to integrate with backup scripts I already have setup as well. But from what it looks like according to the documentation it appears to be hard coded that the DB type is either SQLite or PostgreSQL based off of the config options you provide without a way to specify a DB driver, which seems to be confirmed up by [this section of code here](https://github.com/ciur/papermerge/blob/06e71ca9f1ec9d664f2a73a968e5885d0e4a43b1/config/settings/base.py#L254). I think the first thing that would need done is to the DB engine explicitly configurable so it would allow the use of other DB engines. Obviously you wouldn't want to break existing configurations, so one way to accomplish that could be that not specifying a DB engine type in the config would keep the existing behavior of SQLite or PostgreSQL.
Author
Owner

@mtonnie commented on GitHub (Aug 22, 2020):

@Diablofan guess you are almost right, but the file you mentioned is just the basic (default) settings.

You can provide your own settings file, as it's done for the docker images as well.
I'm using this method as well for the Synology package you just have to create your file an export the variable.
For sure you have to take care that all needed requirements are fulfilled, e.g. required python packages are installed.

Don't know what's the best for solution for docker, make your own image or modify the existing one?

<!-- gh-comment-id:678597865 --> @mtonnie commented on GitHub (Aug 22, 2020): @Diablofan guess you are almost right, but the file you mentioned is just the basic (default) settings. You can provide your own [settings file](https://github.com/ciur/papermerge/blob/master/docker/1.4/config/app.production.py#L19), as it's done for the docker images as well. I'm using this method as well for the Synology package you just have to create your file an [export the variable](https://github.com/ciur/papermerge/blob/master/docker/1.4/app.dockerfile#L32). For sure you have to take care that all needed requirements are fulfilled, e.g. required python packages are installed. Don't know what's the best for solution for docker, make your own image or modify the existing one?
Author
Owner

@ciur commented on GitHub (Aug 22, 2020):

Hi @Diablofan

@mtonnie is right.

Let me expand on what he said.
Papermerge is a Django based project - this means all django configurations apply, this includes django DATABASES settings..
The django settings files used in Papermerge is this file - as you can see, is pretty long - 400 lines of configurations is not a joke :) Look for word DATABASES in that files and you will understand immediately what's happening there.

@mtonnie point is (please correct me if I am wrong) that you can use django support for mariadb as described here - means just replace DATABASES current settings in base.py file with configs for mariadb.

Django supports Mariadb. Papermerge does not use any DB dependent features. Thus in theory it should work without any issue.

If you don't want to mess yourself with base.py, just wait couple of weeks and I will fix that. I will prioritize you request for mariadb support for minor release 1.4.1 (given the fact that there won't be any major issue...).

papermerge.conf.py is for convenience - so that people won't need to get lost in 400 lines (mixed with python logic) configuration file.

<!-- gh-comment-id:678602077 --> @ciur commented on GitHub (Aug 22, 2020): Hi @Diablofan @mtonnie is right. Let me expand on what he said. Papermerge is a Django based project - this means all django configurations apply, this includes [django DATABASES settings.](https://docs.djangoproject.com/en/3.1/ref/settings/#databases). The django settings files used in Papermerge is [this file](https://github.com/ciur/papermerge/blob/master/config/settings/base.py) - as you can see, is pretty long - 400 lines of configurations is not a joke :) Look for word DATABASES in that files and you will understand immediately what's happening there. @mtonnie point is (please correct me if I am wrong) that you can use [django support for mariadb as described here](https://docs.djangoproject.com/en/3.1/ref/databases/#mariadb-notes) - means just replace DATABASES current settings in [base.py](https://github.com/ciur/papermerge/blob/master/config/settings/base.py) file with configs for mariadb. Django supports Mariadb. Papermerge does not use any DB dependent features. Thus in theory it should work without any issue. If you don't want to mess yourself with base.py, just wait couple of weeks and I will fix that. I will prioritize you request for mariadb support for minor release 1.4.1 (given the fact that there won't be any major issue...). papermerge.conf.py is for convenience - so that people won't need to get lost in 400 lines (mixed with python logic) configuration file.
Author
Owner

@mtonnie commented on GitHub (Aug 22, 2020):

@ciur
I would suggest just to make a second version of app and worker.production.py file e.g. app.production-mysql.py.
This file contains the mysql specific DATABASE definition an will be copied as production-mysql.py to config/settings folder.
We have to include the additional requirements as well (guess it's just mysqlclient) we will change the environment variable names for DB to be able to reuse them (POSTGRES_USER -> DB_USER for example).

By default docker will use postgres config, because it is set in the docker file, but the user can override the value for DJANGO_SETTINGS_MODULE (-e "DJANGO_SETTINGS_MODULE=config.settings.production-mysql").

What do you think about this solution?

Let me add one thing, for bare metal installations I don't think we will need any adaption. because the user can or have to create his own config.settings.xxxxx file.

<!-- gh-comment-id:678609588 --> @mtonnie commented on GitHub (Aug 22, 2020): @ciur I would suggest just to make a second version of [app](https://github.com/ciur/papermerge/blob/master/docker/1.4/config/app.production.py) and [worker.production.py](https://github.com/ciur/papermerge/blob/master/docker/1.4/config/worker.production.py) file e.g. app.production-mysql.py. This file contains the mysql specific DATABASE definition an will be copied as production-mysql.py to config/settings folder. We have to include the additional requirements as well (guess it's just mysqlclient) we will change the environment variable names for DB to be able to reuse them (POSTGRES_USER -> DB_USER for example). By default docker will use postgres config, because it is set in the docker file, but the user can override the value for DJANGO_SETTINGS_MODULE (-e "DJANGO_SETTINGS_MODULE=config.settings.production-mysql"). What do you think about this solution? Let me add one thing, for bare metal installations I don't think we will need any adaption. because the user can or have to create his own config.settings.xxxxx file.
Author
Owner

@Diablofan commented on GitHub (Aug 22, 2020):

Ah, I see. I'll admit I'm not too familiar with how Django works so I didn't know that was possible, but thank you for the explanations @mtonnie and @ciur.

<!-- gh-comment-id:678641807 --> @Diablofan commented on GitHub (Aug 22, 2020): Ah, I see. I'll admit I'm not too familiar with how Django works so I didn't know that was possible, but thank you for the explanations @mtonnie and @ciur.
Author
Owner

@ciur commented on GitHub (Aug 22, 2020):

Hi @mtonnie,

thank you for your suggestion. Give me some time to think about your solution and eventually alternative approaches.

<!-- gh-comment-id:678671106 --> @ciur commented on GitHub (Aug 22, 2020): Hi @mtonnie, thank you for your suggestion. Give me some time to think about your solution and eventually alternative approaches.
Author
Owner

@francescocarzaniga commented on GitHub (Oct 10, 2020):

I opened #158 to address this. Please take a look if this approach is decent enough.

<!-- gh-comment-id:706608899 --> @francescocarzaniga commented on GitHub (Oct 10, 2020): I opened #158 to address this. Please take a look if this approach is decent enough.
Author
Owner

@ciur commented on GitHub (Oct 11, 2020):

@francescocarzaniga, thank you for your PR! I merged it into master !

<!-- gh-comment-id:706657973 --> @ciur commented on GitHub (Oct 11, 2020): @francescocarzaniga, thank you for your PR! I merged it into master !
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/papermerge#56
No description provided.