[4.1 rc2] Problem with supervisor configuration

When things don't work as they should.
Post Reply
qra
50 Posts
50 Posts
Posts: 56
Joined: Fri Oct 25, 2019 9:08 pm
Location: Poland

[4.1 rc2] Problem with supervisor configuration

Post by qra »

Hi. In version 4.1 rc2 there is an issue with environment variables in the /etc/supervisor/conf.d/mayan-edms.conf file.

A snippet from the system log:

Code: Select all

...
Oct  7 14:16:11 local-mayan systemd[1]: Started Supervisor process control system for UNIX.
Oct  7 14:16:12 local-mayan supervisord[1421]: Error: Format string '%(ENV_MAYAN_GUNICORN_BIN)s --workers %(ENV_MAYAN_GUNICORN_WORKERS)s %(ENV_MAYAN_GUNICORN_TEMPORARY_DIRECTORY)s mayan.wsgi --max-requests %(ENV_MAYAN_GUNICORN_MAX_REQUESTS)s --max-requests-jitter %(ENV_MAYAN_GUNICORN_JITTER)s --worker-class %(ENV_MAYAN_GUNICORN_WORKER_CLASS)s --bind 0.0.0.0:8000 --env DJANGO_SETTINGS_MODULE=%(ENV_MAYAN_SETTINGS_MODULE)s --timeout %(ENV_MAYAN_GUNICORN_TIMEOUT)s --limit-request-line %(ENV_MAYAN_GUNICORN_LIMIT_REQUEST_LINE)s' for 'program:mayan-edms-gunicorn.command' contains names ('ENV_MAYAN_GUNICORN_BIN') which cannot be expanded. Available names: ENV_INVOCATION_ID, ENV_JOURNAL_STREAM, ENV_LANG, ENV_PATH, group_name, here, host_node_name, process_num, program_name in section 'program:mayan-edms-gunicorn' (file: '/etc/supervisor/conf.d/mayan-edms.conf')
Oct  7 14:16:12 local-mayan supervisord[1421]: For help, use /usr/bin/supervisord -h
Oct  7 14:16:12 local-mayan systemd[1]: supervisor.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Oct  7 14:16:12 local-mayan systemd[1]: supervisor.service: Failed with result 'exit-code'.
...
Start of mayan-edms.con file:

Code: Select all

[supervisord]
environment=
    PYTHONPATH="/opt/mayan-edms/media/user_settings",
    DJANGO_SETTINGS_MODULE=mayan.settings.production,
    MAYAN_ALLOWED_HOSTS='["*"]',
    MAYAN_MEDIA_ROOT="/opt/mayan-edms/media/",
    MAYAN_PYTHON_BIN_DIR=/opt/mayan-edms/bin/,
    MAYAN_GUNICORN_BIN=/opt/mayan-edms/bin/gunicorn,
    MAYAN_GUNICORN_WORKERS=3,
    MAYAN_GUNICORN_MAX_REQUESTS=500,
    MAYAN_GUNICORN_JITTER=50,
    MAYAN_GUNICORN_WORKER_CLASS=sync,
    MAYAN_GUNICORN_TIMEOUT=120,
    MAYAN_GUNICORN_LIMIT_REQUEST_LINE=4094,
    MAYAN_SETTINGS_MODULE=mayan.settings.production,
    MAYAN_WORKER_A_CONCURRENCY="",
    MAYAN_WORKER_A_MAX_MEMORY_PER_CHILD="--max-memory-per-child=300000",
    MAYAN_WORKER_A_MAX_TASKS_PER_CHILD="--max-tasks-per-child=100",
    MAYAN_WORKER_B_CONCURRENCY="",
    MAYAN_WORKER_B_MAX_MEMORY_PER_CHILD="--max-memory-per-child=300000",
    MAYAN_WORKER_B_MAX_TASKS_PER_CHILD="--max-tasks-per-child=100",
    MAYAN_WORKER_C_CONCURRENCY="",
    MAYAN_WORKER_C_MAX_MEMORY_PER_CHILD="--max-memory-per-child=300000",
    MAYAN_WORKER_C_MAX_TASKS_PER_CHILD="--max-tasks-per-child=100",
    MAYAN_WORKER_D_CONCURRENCY="--concurrency=1",
    MAYAN_WORKER_D_MAX_MEMORY_PER_CHILD="--max-memory-per-child=300000",
    MAYAN_WORKER_D_MAX_TASKS_PER_CHILD="--max-tasks-per-child=10",
    _LAST_LINE=""

[program:mayan-edms-gunicorn]
autorestart = true
autostart = true
command = %(ENV_MAYAN_GUNICORN_BIN)s --workers %(ENV_MAYAN_GUNICORN_WORKERS)s %(ENV_MAYAN_GUNICORN_TEMPORARY_DIRECTORY)s mayan.wsgi --max-requests %(ENV_MAYAN_GUNICORN_MAX_REQUESTS)s --max-requests-jitter %(ENV_MAYAN_GUNICORN_JITTER)s --worker-class %(ENV_MAYAN_GUNICORN_WORKER_CLASS)s --bind 0.0.0.0:8000 --env DJANGO_SETTINGS_MODULE=%(ENV_MAYAN_SETTINGS_MODULE)s --timeout %(ENV_MAYAN_GUNICORN_TIMEOUT)s --limit-request-line %(ENV_MAYAN_GUNICORN_LIMIT_REQUEST_LINE)s
redirect_stderr = true
user = mayan

[program:mayan-edms-worker_a]
autorestart = true
autostart = true
command = nice -n 0 %(ENV_COMMAND)s
environment =
  COMMAND = "%(ENV_MAYAN_PYTHON_BIN_DIR)scelery -A mayan worker %(ENV_MAYAN_WORKER_A_CONCURRENCY)s --hostname=mayan-edms-worker_a.%%h --loglevel=ERROR -Ofair --queues=converter,sources_fast %(ENV_MAYAN_WORKER_A_MAX_MEMORY_PER_CHILD)s %(ENV_MAYAN_WORKER_A_MAX_TASKS_PER_CHILD)s --without-gossip --without-heartbeat"
killasgroup = true
numprocs = 1
priority = 998
startsecs = 10
stopwaitsecs = 1
user = mayan
...
User avatar
rosarior
Developer
Developer
Posts: 688
Joined: Tue Aug 21, 2018 3:28 am
Location: Puerto Rico
Contact:

Re: [4.1 rc2] Problem with supervisor configuration

Post by rosarior »

Hello,

thanks for the report.

Seems to be a problem with Supervisord that was fixed in version 4.2.2: http://supervisord.org/changes.html
Fixed a bug where environment variables defined in environment= in the [supervisord] section or a [program:x] section could not be used in %(ENV_x)s expansions. Patch by MythRen
We'll add the entry in the troubleshooting and see if there is an easy way to backport Supervisord 4.2.2.

Thanks for the testing the release candidate and reporting your findings!
User avatar
rosarior
Developer
Developer
Posts: 688
Joined: Tue Aug 21, 2018 3:28 am
Location: Puerto Rico
Contact:

Re: [4.1 rc2] Problem with supervisor configuration

Post by rosarior »

Version 4.2.2 is not available on Ubuntu, even in the upcoming Impish release.

It is available on Debian since bullseye and the .deb package works with Ubuntu 21.04.

https://packages.debian.org/bullseye/supervisor
2021-10-08_02-51.png
2021-10-08_02-51.png (41.86 KiB) Viewed 627 times
2021-10-08_03-18.png
2021-10-08_03-18.png (60.2 KiB) Viewed 627 times
Post Reply