Unify supervisor configuration files. Lower nice levels of most workers. Merge OCR and slow workers. Lower gunicorn workers to 2. Call all supervisor processes using a shell to expand the install and mayan binary locations and avoid hardcoding.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -1,44 +1,52 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
echo "* start"
|
||||
echo "mayan: starting entrypoint.sh"
|
||||
INSTALL_FLAG=/var/lib/mayan/media/system/SECRET_KEY
|
||||
|
||||
export MAYAN_MEDIA_ROOT=/var/lib/mayan
|
||||
export MAYAN_GUNICORN_WORKERS=${MAYAN_GUNICORN_WORKERS:-3}
|
||||
export MAYAN_DEFAULT_BROKER_URL=redis://127.0.0.1:6379/0
|
||||
export MAYAN_DEFAULT_CELERY_RESULT_BACKEND=redis://127.0.0.1:6379/0
|
||||
export MAYAN_ALLOWED_HOSTS=*
|
||||
export CELERY_ALWAYS_EAGER=True
|
||||
export MAYAN_CELERY_RESULT_BACKEND=${MAYAN_CELERY_RESULT_BACKEND:-redis://127.0.0.1:6379/0}
|
||||
export MAYAN_BIN=/usr/local/lib/python2.7/dist-packages/mayan/bin/mayan-edms.py
|
||||
export MAYAN_BROKER_URL=${MAYAN_BROKER_URL:-redis://127.0.0.1:6379/0}
|
||||
export MAYAN_CELERY_RESULT_BACKEND=${MAYAN_CELERY_RESULT_BACKEND:-redis://127.0.0.1:6379/0}
|
||||
export MAYAN_GUNICORN_WORKERS=${MAYAN_GUNICORN_WORKERS:-2}
|
||||
export MAYAN_INSTALL_DIR=/usr/local/lib/python2.7/dist-packages/mayan
|
||||
export MAYAN_MEDIA_ROOT=/var/lib/mayan
|
||||
export MAYAN_SETTINGS_FILE=${MAYAN_SETTINGS_FILE:-mayan.settings.production}
|
||||
|
||||
export CELERY_ALWAYS_EAGER=False
|
||||
export PYTHONPATH=$PYTHONPATH:$MAYAN_MEDIA_ROOT/settings
|
||||
|
||||
chown mayan:mayan /var/lib/mayan -R
|
||||
|
||||
initialize() {
|
||||
echo "* initialize"
|
||||
echo "mayan: initialize()"
|
||||
su mayan -c "mayan-edms.py initialsetup --force"
|
||||
su mayan -c "mayan-edms.py collectstatic --noinput --clear"
|
||||
}
|
||||
|
||||
upgrade() {
|
||||
echo "* upgrade"
|
||||
echo "mayan: upgrade()"
|
||||
su mayan -c "mayan-edms.py performupgrade"
|
||||
su mayan -c "mayan-edms.py collectstatic --noinput --clear"
|
||||
}
|
||||
|
||||
start() {
|
||||
echo "mayan: start()"
|
||||
rm -rf /var/run/supervisor.sock
|
||||
exec /usr/bin/supervisord -nc /etc/supervisor/supervisord.conf
|
||||
}
|
||||
|
||||
os_package_installs() {
|
||||
echo "* os_package_installs"
|
||||
echo "mayan: os_package_installs()"
|
||||
if [ "${MAYAN_APT_INSTALLS}" ]; then
|
||||
apt-get-install $MAYAN_APT_INSTALLS
|
||||
fi
|
||||
}
|
||||
|
||||
pip_installs() {
|
||||
echo "* pip_installs"
|
||||
echo "mayan: pip_installs()"
|
||||
if [ "${MAYAN_PIP_INSTALLS}" ]; then
|
||||
pip install $MAYAN_PIP_INSTALLS
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user