Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    • Menu
    Projects Groups Snippets
  • Get a free trial
  • Sign up
  • Login
  • Sign in / Register
  • Mayan EDMS Mayan EDMS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 200
    • Issues 200
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 10
    • Merge requests 10
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

GitLab 15.0 has launched! Please visit Breaking changes in 15.0 and 15.0 Removals to see which breaking changes may impact your workflow.

  • Mayan EDMS
  • Mayan EDMSMayan EDMS
  • Issues
  • #1013
Closed
Open
Created Jul 03, 2021 by joh-ku@joh-kuContributor

Supervisor template: variable name substitution fails on direct demployment

Summary

Variable name substitution for template file partial_supervisord does not work for direct deployment method.

What is the current bug behavior?

The mayan-edms upgrade process for direct deployment documents to create the supervisord configuration file with the following command:

sudo -u mayan MAYAN_MEDIA_ROOT=/opt/mayan-edms/media/ \
/opt/mayan-edms/bin/mayan-edms.py platformtemplate supervisord | sudo sh -c "cat > /etc/supervisor/conf.d/mayan-edms.conf"

During rendering, not all variables are substituted:

[program:mayan-edms-gunicorn]
autorestart = true
autostart = true
command = /bin/bash -c "${MAYAN_GUNICORN_BIN} --workers ${MAYAN_GUNICORN_WORKERS} ${MAYAN_GUNICORN_TEMPORARY_DIRECTORY} mayan.wsgi --max-requests ${MAYAN_GUNICORN_MAX_REQUESTS} --max-requests-jitter ${MAYAN_GUNICORN_JITTER} --worker-class ${MAYAN_GUNICORN_WORKER_CLASS} --bind 0.0.0.0:8000 --env DJANGO_SETTINGS_MODULE=${MAYAN_SETTINGS_MODULE} --timeout ${MAYAN_GUNICORN_TIMEOUT} --limit-request-line ${MAYAN_GUNICORN_LIMIT_REQUEST_LINE}"
redirect_stderr = true
user = mayan

[program:mayan-edms-worker_a]
autorestart = true
autostart = true
command = nice -n 0 /bin/bash -c "${MAYAN_PYTHON_BIN_DIR}celery worker -A mayan -Ofair -l ERROR -Q converter,document_states_fast,sources_fast --hostname=mayan-edms-worker_a.%%h ${MAYAN_WORKER_A_CONCURRENCY} ${MAYAN_WORKER_A_MAX_MEMORY_PER_CHILD} ${MAYAN_WORKER_A_MAX_TASKS_PER_CHILD}"
killasgroup = true
numprocs = 1
priority = 998
startsecs = 10
stopwaitsecs = 1
user = mayan

[program:mayan-edms-worker_b]
autorestart = true
autostart = true
command = nice -n 2 /bin/bash -c "${MAYAN_PYTHON_BIN_DIR}celery worker -A mayan -Ofair -l ERROR -Q document_states_medium,documents,duplicates,file_caching,file_metadata,indexing,metadata,parsing,search,sources --hostname=mayan-edms-worker_b.%%h ${MAYAN_WORKER_B_CONCURRENCY} ${MAYAN_WORKER_B_MAX_MEMORY_PER_CHILD} ${MAYAN_WORKER_B_MAX_TASKS_PER_CHILD}"
killasgroup = true
numprocs = 1
priority = 998
startsecs = 10
stopwaitsecs = 1
user = mayan

[program:mayan-edms-worker_c]
autorestart = true
autostart = true
command = nice -n 15 /bin/bash -c "${MAYAN_PYTHON_BIN_DIR}celery worker -A mayan -Ofair -l ERROR -Q checkouts_periodic,documents_periodic,events,mailing,signatures,sources_periodic,statistics,uploads --hostname=mayan-edms-worker_c.%%h ${MAYAN_WORKER_C_CONCURRENCY} ${MAYAN_WORKER_C_MAX_MEMORY_PER_CHILD} ${MAYAN_WORKER_C_MAX_TASKS_PER_CHILD}"
killasgroup = true
numprocs = 1
priority = 998
startsecs = 10
stopwaitsecs = 1
user = mayan

[program:mayan-edms-worker_d]
autorestart = true
autostart = true
command = nice -n 18 /bin/bash -c "${MAYAN_PYTHON_BIN_DIR}celery worker -A mayan -Ofair -l ERROR -Q ocr,storage_periodic,tools --hostname=mayan-edms-worker_d.%%h ${MAYAN_WORKER_D_CONCURRENCY} ${MAYAN_WORKER_D_MAX_MEMORY_PER_CHILD} ${MAYAN_WORKER_D_MAX_TASKS_PER_CHILD}"
killasgroup = true
numprocs = 1
priority = 998
startsecs = 10
stopwaitsecs = 1
user = mayan

[program:mayan-edms-celery-beat]
autorestart = true
autostart = true
command = nice -n 1 /bin/bash -c "${MAYAN_PYTHON_BIN_DIR}celery -A mayan beat --pidfile= -l ERROR"
killasgroup = true
numprocs = 1
priority = 998
startsecs = 10
stopwaitsecs = 1
user = mayan

Quick analysis

I think this bug was introduced with commit 2974b386. The direct deployment method does not use the same context as the docker deployment method.

What is the expected correct behavior?

Correctly set all variables:

autorestart = true
autostart = true
command = /srv/dms/system/bin/gunicorn --workers 3 mayan.wsgi --max-requests 500 --max-requests-jitter 50 --worker-class sync --bind 0.0.0.0:8000 --timeout 120 --limit-request-line 4094
user = mayan

[program:mayan-edms-worker_a]
autorestart = true
autostart = true
command = nice -n 0 /srv/dms/system/bin/celery worker -A mayan -Ofair -l ERROR -Q converter,document_states_fast,sources_fast -n mayan-edms-worker_a.%%h --max-memory-per-child=300000 --max-tasks-per-child=100
killasgroup = true
numprocs = 1
priority = 998
startsecs = 10
stopwaitsecs = 1
user = mayan

[program:mayan-edms-worker_b]
autorestart = true
autostart = true
command = nice -n 2 /srv/dms/system/bin/celery worker -A mayan -Ofair -l ERROR -Q document_states_medium,file_caching,indexing,search,sources,uploads -n mayan-edms-worker_b.%%h --max-memory-per-child=300000 --max-tasks-per-child=100
killasgroup = true
numprocs = 1
priority = 998
startsecs = 10
stopwaitsecs = 1
user = mayan

[program:mayan-edms-worker_c]
autorestart = true
autostart = true
command = nice -n 15 /srv/dms/system/bin/celery worker -A mayan -Ofair -l ERROR -Q checkouts_periodic,documents,documents_periodic,duplicates,events,mailing,metadata,signatures,sources_periodic,statistics -n mayan-edms-worker_c.%%h --max-memory-per-child=300000 --max-tasks-per-child=100
killasgroup = true
numprocs = 1
priority = 998
startsecs = 10
stopwaitsecs = 1
user = mayan

[program:mayan-edms-worker_d]
autorestart = true
autostart = true
command = nice -n 18 /srv/dms/system/bin/celery worker -A mayan -Ofair -l ERROR -Q file_metadata,ocr,parsing,storage_periodic,tools -n mayan-edms-worker_d.%%h --concurrency=1 --max-memory-per-child=300000 --max-tasks-per-child=10
killasgroup = true
numprocs = 1
priority = 998
startsecs = 10
stopwaitsecs = 1
user = mayan

[program:mayan-edms-celery-beat]
autorestart = true
autostart = true
command = nice -n 1 /srv/dms/system/bin/celery beat -A mayan --pidfile= -l ERROR
killasgroup = true
numprocs = 1
priority = 998
startsecs = 10
stopwaitsecs = 1
user = mayan

Environment details

Key Value
OS FreeBSD 13.0-RELEASE-p3
python Python 3.8.10
mayan-edms 4.0.10
Edited Jul 04, 2021 by joh-ku
Assignee
Assign to
Time tracking