mayan 3.0.3 on ubuntu 18.04 vm - change settings

Questions, comments, discussions. Over time certain topics might be moved to their own category.
Post Reply
btd
Posts: 4
Joined: Sun Aug 26, 2018 8:25 pm

mayan 3.0.3 on ubuntu 18.04 vm - change settings

Post by btd » Mon Aug 27, 2018 3:27 pm

Hi.
I have installed mayan 3.0.3 on ubuntu 18.04 using advanced deployment tutorial.
Now, I try to overwrite some settings, mainly language ones, but any of two ways mentioned in documentation works.
After tutorial mayan is installed in /opt/mayan-edms.

I tried first metod: using export

Code: Select all

export MAYAN_DOCUMENTS_LANGUAGE=pol
but after mayan restart it isn't picked up.

I can't try second because there is no manage.py to run

Code: Select all

python manage.py runserver --settings=media.mayan_settings.local
Then I tried to change in /etc/supervisor/conf.d/mayan.conf
from

Code: Select all

DJANGO_SETTINGS_MODULE=mayan.settings.production
to

Code: Select all

DJANGO_SETTINGS_MODULE=media.mayan_settings.local
and I have put file local.py in /opt/mayan-edms/media/mayan_settings/

file local.py contains

Code: Select all

from mayan.settings.production import *
DOCUMENTS_LANGUAGE=pol
DOCUMENTS_LANGUAGE_CODES=[pol,eng]	
but after restart mayan crashes


How I can overwrite settings?

User avatar
rosarior
Posts: 211
Joined: Tue Aug 21, 2018 3:28 am

Re: mayan 3.0.3 on ubuntu 18.04 vm - change settings

Post by rosarior » Tue Aug 28, 2018 1:04 am

The environment variables were added to allow making configuration changes without having to create Django/Python setting files. Python setting files are still available but they are not loaded by default, that is why you need to tell Mayan which Python setting file to import if it's not meant to import the default production.py module. To control which setting file will be imported use the environment variable DJANGO_SETTINGS_MODULE or use the --settings option when calling Mayan from the command line.

To use the new environment variable method, use export or prepend the environment variable before the command line calling. Don't mix environment variable passing and custom Python settings file. It can be done you with two levels of confiurations overriding each other is harder to debug.

Since many programs use environment variable you need to prepend "MAYAN_" to the normal configuration option name so that Mayan can find its own configuration options from the entire environment available.

Example:

Code: Select all

MAYAN_DOCUMENTS_LANGUAGE_CODES="[pol,eng]" MAYAN_DOCUMENTS_LANGUAGE=pol ./manage.py runserver
or

Code: Select all

export MAYAN_DOCUMENTS_LANGUAGE_CODES="[pol,eng]"
export MAYAN_DOCUMENTS_LANGUAGE=pol
./manage.py runserver
For supervisor add that at the end (no need to use export since it all is using the same context):

Code: Select all


[supervisord]
environment=
    MAYAN_ALLOWED_HOSTS="*",  # Allow access to other network hosts other than localhost
    MAYAN_CELERY_RESULT_BACKEND="redis://127.0.0.1:6379/0",
    MAYAN_BROKER_URL="redis://127.0.0.1:6379/0",
    PYTHONPATH=/opt/mayan-edms/lib/python2.7/site-packages:/opt/mayan-edms/data,
    MAYAN_MEDIA_ROOT=/opt/mayan-edms/media,
    MAYAN_DATABASE_ENGINE=django.db.backends.postgresql,
    MAYAN_DATABASE_HOST=127.0.0.1,
    MAYAN_DATABASE_NAME=mayan,
    MAYAN_DATABASE_PASSWORD=mayanuserpass,
    MAYAN_DATABASE_USER=mayan,
    MAYAN_DATABASE_CONN_MAX_AGE=60,
    DJANGO_SETTINGS_MODULE=mayan.settings.production,
    MAYAN_DOCUMENTS_LANGUAGE_CODES="[pol,eng]",
    MAYAN_DOCUMENTS_LANGUAGE=pol
    
    ...
    
    <rest of file>
Pay attention to the spacing to the left (indentation) and don't add a comma to the last line. The configuration parser for supervisor is strict on that regard.

If done correctly this is what you should get.
Screenshot from 2018-08-27 20-51-20.png
Screenshot from 2018-08-27 20-51-20.png (20.02 KiB) Viewed 620 times

btd
Posts: 4
Joined: Sun Aug 26, 2018 8:25 pm

Re: mayan 3.0.3 on ubuntu 18.04 vm - change settings

Post by btd » Tue Aug 28, 2018 6:38 am

Yes, thank you.
editing supervisors mayan.conf did the trick. I was trying that too, but I have placed my variables before DJANGO_SETTINGS_MODULE=mayan.settings.production, with others, not after, and then mayan crashed.

Thank you for help.

Soernt
Posts: 1
Joined: Tue Aug 28, 2018 8:52 am

Re: mayan 3.0.3 on ubuntu 18.04 vm - change settings

Post by Soernt » Tue Aug 28, 2018 9:03 am

Hi,

I use a docker-compose.yml file to configure the installation of Mayan.
I have some trouble to set the MAYAN_DOCUMENTS_LANGUAGE_CODES variable to support "deu" and "eng". So far I tried:

MAYAN_DOCUMENTS_LANGUAGE_CODES: ('deu','eng')
as it documented at https://mayan.readthedocs.io/en/latest/ ... uages.html
That gives me an error while starting the container.

MAYAN_DOCUMENTS_LANGUAGE_CODES: [deu,eng]
as it is documented in this thread.
That gives me an error by docker "services.mayan-edms.environment.MAYAN_DOCUMENTS_LANGUAGE_CODES contains ["deu", "eng"], which is an invalid type, it should be a string, number, or a null"

I wounder what might be the right syntax?

Since I am german, I try to adjust the settings to support german. So far I add these settings to the docker-compose.yml:

MAYAN_APT_INSTALLS: tesseract-ocr-deu
MAYAN_DOCUMENTS_LANGUAGE: deu
MAYAN_DOCUMENTS_LANGUAGE_CODES: [deu,eng]

Is there any more I need to configure?

Any help is much appreciated.

ignazarr
Posts: 1
Joined: Tue Aug 28, 2018 12:34 pm

Re: mayan 3.0.3 on ubuntu 18.04 vm - change settings

Post by ignazarr » Tue Aug 28, 2018 7:24 pm

Hi,

I am very interested also in this as I have very little success with passing the environment variables through the docker-compose.yml.

Also is MAYAN_DATABASE_DRIVER = MAYAN_DATABASE_ENGINE ? I always end up with the SQLite warning when using the docker-compose.

Thanks.

ironhacker
Posts: 2
Joined: Tue Jan 22, 2019 3:11 am

Re: mayan 3.0.3 on ubuntu 18.04 vm - change settings

Post by ironhacker » Fri Jan 25, 2019 5:28 pm

So where's the proper place to change settings for Django? I don't want to lose all the defaults, but rather just make updates. For instance, I'd like the API to return 100 results per request instead of 10. This is under REST_FRAMEWORK - PAGE_SIZE for Django and defined in mayan.settings.base.

Thanks.

Post Reply