Expand custom Python setting section

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-11-18 17:13:27 -04:00
parent cd5da60063
commit 35aafc3f70
5 changed files with 23 additions and 7 deletions

View File

@@ -26,6 +26,7 @@
- Automate paths in documentation. - Automate paths in documentation.
- Settings chapter improvements. - Settings chapter improvements.
- Documentation paths consistency fixes. - Documentation paths consistency fixes.
- Expand custom Python setting section.
3.2.9 (2019-11-03) 3.2.9 (2019-11-03)
================== ==================

View File

@@ -146,14 +146,14 @@ For another setup that offers more performance and scalability refer to the
|MAYAN_BIN| preparestatic --noinput |MAYAN_BIN| preparestatic --noinput
11. Create the supervisor file at ``/etc/supervisor/conf.d/mayan.conf``: 11. Create the supervisor file at ``|MAYAN_SUPERVISOR_CONF|``:
------------------------------------------------------------------------ ------------------------------------------------------------------------
:: ::
sudo MAYAN_DATABASE_ENGINE=django.db.backends.postgresql MAYAN_DATABASE_NAME=mayan \ sudo MAYAN_DATABASE_ENGINE=django.db.backends.postgresql MAYAN_DATABASE_NAME=mayan \
MAYAN_DATABASE_PASSWORD=mayanuserpass MAYAN_DATABASE_USER=mayan \ MAYAN_DATABASE_PASSWORD=mayanuserpass MAYAN_DATABASE_USER=mayan \
MAYAN_DATABASE_HOST=127.0.0.1 MAYAN_MEDIA_ROOT=|MAYAN_MEDIA_ROOT| \ MAYAN_DATABASE_HOST=127.0.0.1 MAYAN_MEDIA_ROOT=|MAYAN_MEDIA_ROOT| \
|MAYAN_BIN| platformtemplate supervisord > /etc/supervisor/conf.d/mayan.conf |MAYAN_BIN| platformtemplate supervisord > |MAYAN_SUPERVISOR_CONF|
12. Configure Redis: 12. Configure Redis:
@@ -220,7 +220,7 @@ of a restart or power failure. The Gunicorn workers are increased to 3.
sudo rabbitmqctl set_permissions -p mayan mayan ".*" ".*" ".*" sudo rabbitmqctl set_permissions -p mayan mayan ".*" ".*" ".*"
4. Edit the supervisor file at ``/etc/supervisor/conf.d/mayan.conf``: 4. Edit the supervisor file at ``|MAYAN_SUPERVISOR_CONF|``:
--------------------------------------------------------------------- ---------------------------------------------------------------------
Replace (paying attention to the comma at the end):: Replace (paying attention to the comma at the end)::

View File

@@ -108,6 +108,17 @@ or via the ``DJANGO_SETTINGS_MODULE`` environment variable like this::
export DJANGO_SETTINGS_MODULE=mayan.media.mayan_settings.mysettings export DJANGO_SETTINGS_MODULE=mayan.media.mayan_settings.mysettings
To make the use of the custom Python setting file permanent, update the ``|MAYAN_SUPERVISOR_CONF|``
file. In the ``[supervisord]`` section, update the ``environment=`` value of
``DJANGO_SETTINGS_MODULE`` from the default ``mayan.settings.production`` to
``mayan.media.mayan_settings.mysettings``. Pay attention to the indentation of
the ``environment=`` entries.
Force supervisor to read the changes and restart using::
sudo supervisorctl reread
sudo supervisorctl restart all
For the :doc:`../chapters/docker` installation method, the full import path will be For the :doc:`../chapters/docker` installation method, the full import path will be
``mayan_settings.mysettings`` and can only be passed via the ``mayan_settings.mysettings`` and can only be passed via the
``MAYAN_SETTINGS_MODULE`` environment variable like this:: ``MAYAN_SETTINGS_MODULE`` environment variable like this::

View File

@@ -273,6 +273,8 @@ def setup(app):
MAYAN_GUNICORN_BIN = os.path.join(MAYAN_PYTHON_BIN_DIR, 'gunicorn') MAYAN_GUNICORN_BIN = os.path.join(MAYAN_PYTHON_BIN_DIR, 'gunicorn')
MAYAN_PIP_BIN = os.path.join(MAYAN_PYTHON_BIN_DIR, 'pip') MAYAN_PIP_BIN = os.path.join(MAYAN_PYTHON_BIN_DIR, 'pip')
MAYAN_BIN = os.path.join(MAYAN_PYTHON_BIN_DIR, 'mayan-edms.py') MAYAN_BIN = os.path.join(MAYAN_PYTHON_BIN_DIR, 'mayan-edms.py')
SUPERVISOR_ETC_PATH = '/etc/supervisor/conf.d/'
MAYAN_SUPERVISOR_CONF = os.path.join(SUPERVISOR_ETC_PATH, 'mayan.conf')
environment_variables = utils.load_env_file() environment_variables = utils.load_env_file()
environment_variables['DOCKER_MAYAN_IMAGE_VERSION'] = mayan.__version__ environment_variables['DOCKER_MAYAN_IMAGE_VERSION'] = mayan.__version__
@@ -280,8 +282,10 @@ def setup(app):
environment_variables['MAYAN_MEDIA_ROOT'] = MAYAN_MEDIA_ROOT environment_variables['MAYAN_MEDIA_ROOT'] = MAYAN_MEDIA_ROOT
environment_variables['MAYAN_PYTHON_BIN_DIR'] = MAYAN_PYTHON_BIN_DIR environment_variables['MAYAN_PYTHON_BIN_DIR'] = MAYAN_PYTHON_BIN_DIR
environment_variables['MAYAN_GUNICORN_BIN'] = MAYAN_GUNICORN_BIN environment_variables['MAYAN_GUNICORN_BIN'] = MAYAN_GUNICORN_BIN
environment_variables['MAYAN_PIP_BIN'] = MAYAN_PIP_BIN
environment_variables['MAYAN_BIN'] = MAYAN_BIN environment_variables['MAYAN_BIN'] = MAYAN_BIN
environment_variables['MAYAN_PIP_BIN'] = MAYAN_PIP_BIN
environment_variables['SUPERVISOR_ETC_PATH'] = SUPERVISOR_ETC_PATH
environment_variables['MAYAN_SUPERVISOR_CONF'] = MAYAN_SUPERVISOR_CONF
substitutions = utils.generate_substitutions( substitutions = utils.generate_substitutions(
dictionary=environment_variables dictionary=environment_variables
) )

View File

@@ -60,7 +60,7 @@ Perform these steps after updating the code from either step above.
Make a backup of your supervisord file:: Make a backup of your supervisord file::
sudo cp /etc/supervisor/conf.d/mayan.conf /etc/supervisor/conf.d/mayan.conf.bck sudo cp |MAYAN_SUPERVISOR_CONF| |MAYAN_SUPERVISOR_CONF|.bck
Update the supervisord configuration file. Replace the environment Update the supervisord configuration file. Replace the environment
variables values show here with your respective settings. This step will refresh variables values show here with your respective settings. This step will refresh
@@ -70,12 +70,12 @@ recommended layout::
sudo MAYAN_DATABASE_ENGINE=django.db.backends.postgresql MAYAN_DATABASE_NAME=mayan \ sudo MAYAN_DATABASE_ENGINE=django.db.backends.postgresql MAYAN_DATABASE_NAME=mayan \
MAYAN_DATABASE_PASSWORD=mayanuserpass MAYAN_DATABASE_USER=mayan \ MAYAN_DATABASE_PASSWORD=mayanuserpass MAYAN_DATABASE_USER=mayan \
MAYAN_DATABASE_HOST=127.0.0.1 MAYAN_MEDIA_ROOT=|MAYAN_MEDIA_ROOT| \ MAYAN_DATABASE_HOST=127.0.0.1 MAYAN_MEDIA_ROOT=|MAYAN_MEDIA_ROOT| \
|MAYAN_BIN| platformtemplate supervisord > /etc/supervisor/conf.d/mayan.conf |MAYAN_BIN| platformtemplate supervisord > |MAYAN_SUPERVISOR_CONF|
Edit the supervisord configuration file and update any setting the template Edit the supervisord configuration file and update any setting the template
generator missed:: generator missed::
sudo vi /etc/supervisor/conf.d/mayan.conf sudo vi |MAYAN_SUPERVISOR_CONF|
Migrate existing database schema with:: Migrate existing database schema with::