From 461575f1116b04f049ea7880192583bd4d588b97 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 19 Mar 2019 18:17:09 +0100 Subject: Install: fix user/permissions for celery service --- install/celery.service.template | 8 ++++---- install/celeryd.default.template | 8 +++++++- install/ishtar-install | 3 +-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/install/celery.service.template b/install/celery.service.template index ecb88526e..1d7278c7c 100644 --- a/install/celery.service.template +++ b/install/celery.service.template @@ -4,17 +4,17 @@ After=network.target [Service] Type=forking -User=celery -Group=celery +User=www-data +Group=www-data EnvironmentFile=/etc/default/celeryd-#APP_NAME# WorkingDirectory=#INSTALL_PATH# ExecStart=/bin/sh -c '${CELERY_BIN} multi start ${CELERYD_NODES} \ - -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \ + -c ${CELERY_PROCESS_NUMBER} -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \ --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}' ExecStop=/bin/sh -c '${CELERY_BIN} multi stopwait ${CELERYD_NODES} \ --pidfile=${CELERYD_PID_FILE}' ExecReload=/bin/sh -c '${CELERY_BIN} multi restart ${CELERYD_NODES} \ - -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \ + -c ${CELERY_PROCESS_NUMBER} -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \ --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}' [Install] diff --git a/install/celeryd.default.template b/install/celeryd.default.template index 4220b6c35..39c97b902 100644 --- a/install/celeryd.default.template +++ b/install/celeryd.default.template @@ -2,6 +2,9 @@ CELERYD_NODES="#APP_NAME#w1" #CELERYD_NODES="#APP_NAME#w1 #APP_NAME#w2" # 2 workers +# Number of processes by worker +CELERY_PROCESS_NUMBER=2 + # The name of the Celery App, should be the same as the python file # where the Celery tasks are defined CELERY_APP="#APP_NAME#" @@ -14,4 +17,7 @@ CELERYD_PID_FILE="/var/run/celery/#APP_NAME#%n.pid" CELERYD_LOG_LEVEL=INFO # Path to celery binary, that is in your virtual environment -CELERY_BIN=/usr/local/bin/celery \ No newline at end of file +CELERY_BIN=/usr/local/bin/celery + +# to debug the service it could be necessary to uncomment the following line +# C_FAKEFORK=1 diff --git a/install/ishtar-install b/install/ishtar-install index 976c57c2c..9a84114ba 100755 --- a/install/ishtar-install +++ b/install/ishtar-install @@ -486,8 +486,7 @@ EOF ( set -x; $sh_c 'pip3 install celery==4.2.1' ) mkdir -p /var/log/celery/ mkdir -p /var/run/celery/ - useradd -M --system -s /bin/false celery - chown celery:celery /var/log/celery/ /var/run/celery/ + chown www-data:www-data /var/log/celery/ /var/run/celery/ fi echo "-------------------------------------------------------------------------------"; -- cgit v1.2.3