Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discussion: New configuration system #65

Closed
langimike opened this issue Aug 13, 2020 · 3 comments
Closed

Discussion: New configuration system #65

langimike opened this issue Aug 13, 2020 · 3 comments

Comments

@langimike
Copy link

I have been trying to deploy papermerge on Podman containers and came to the point, where it would be necessary to customize a few settings and override config settings in the configuration files within the containers. I know this is possible via a volume mounts, but feels a bit cumbersome to me (maybe I have overlooked something, and this is possible in some more elegant way - in this case please simply close and forget this issue 😉 ).

Since I have used Django Environ in a few projects, I asked myself, if you would be interested in discussing an adoption of this configuration method in papermerge.

This way, you could use sensible defaults in a simple settings.py and in case of running on a docker/podman container have all necessary settings overridden using environment variables and in case of running under systemd with an environment file. I know, this would be quite a breaking change.

If you are interested, I am really interested in helping out and creating a pull request.

Nonetheless, it's just an idea.

@ciur
Copy link
Owner

ciur commented Aug 13, 2020

Hi @langimike

Thank you for opening this discussion.

The thing is, Papermerge used to have a configuration system very similar to django environ that you mentioned. To be honest, I really love that approach (.env file + read settings from environment variables)!

But in practice, those approaches (dotenv, django environ) have drawbacks.
One drawback (and least problematic) is that .env file limits variables syntax. I encountered this issue when I introduced metadata plugins. Metadata plugins are declared as list. IMHO python syntax is very user friendly in that regard - while .env syntax, well, it depends...

Another drawback, which I find as very is serious one - it is when it comes to deploying Papermerge/Django project in production under Apache (mod_wsgi + apache2). Passing environment variables from under apache is, to say the least - not as flexible as compared to deploying from nginx + gunicorn (or even docker containers). Apache Web server has little bit weird way of working with environment variables and it does not pass to django application variables as say gunicorn does.

So, my point is that I won't mess around with configuration system at this moment - as it is flexible enough to work in different environments (development, test, production: gunicorn, uwsgi, apache2 + mod_wsgi).

@langimike
Copy link
Author

I definitely understand your points.

I think, it's primarily a matter of taste, because for the first drawback django-environ supports all sorts of python datatypes and the second drawback comes from one's preferred way of deployment (apache2+mod_wsgi vs. nginx+uwsgi or nginx+daphne).

My ideas/suggestions source in me trying to configure database settings (host, user, password) within the containers. The only way I found to override them, is mounting modified app.production.py and worker.production.py to /opt/app/config/settings/production.py.

But don't mind, I got it running.

Thank you!

@ciur
Copy link
Owner

ciur commented Aug 14, 2020

Great that you have Papermerge up and running!
I will close this issue then.
Thank you!

@ciur ciur closed this as completed Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants