Skip to content

Commit f523400

Browse files
committed
systemd/celery worker fixes
1 parent 52a39b9 commit f523400

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

provisioning/etc/gitconsensus/celery

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ CELERYD_NODES="w1"
1010

1111
# Absolute or relative path to the 'celery' command:
1212
CELERY_BIN="/opt/gitconsensus/venv/bin/celery"
13-
#CELERY_BIN="/virtualenvs/def/bin/celery"
1413

1514
# App instance to use
1615
# comment out this line if you don't use an app
@@ -27,6 +26,6 @@ CELERYD_OPTS="--time-limit=120 --concurrency=4"
2726
# - %n will be replaced with the first part of the nodename.
2827
# - %I will be replaced with the current child process index
2928
# and is important when using the prefork pool to avoid race conditions.
30-
CELERYD_PID_FILE="/var/run/celery/%n.pid"
31-
CELERYD_LOG_FILE="/var/log/celery/%n%I.log"
29+
CELERYD_PID_FILE="/var/run/gitconsensus/worker-%n.pid"
30+
CELERYD_LOG_FILE="/var/log/gitconsensus/worker-%n%I.log"
3231
CELERYD_LOG_LEVEL="INFO"

provisioning/etc/systemd/system/gitconsensusworker.service

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ User=gitconsensus
88
Group=gitconsensus
99
EnvironmentFile=-/etc/gitconsensus/celery
1010
WorkingDirectory=${CELERY_HOME}
11-
ExecStart=/bin/sh -c 'source ${CELERY_HOME}/bin/envvar && ${CELERY_BIN} multi start ${CELERYD_NODES} -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
12-
ExecStop=/bin/sh -c 'source ${CELERY_HOME}/bin/envvar && ${CELERY_BIN} multi stopwait ${CELERYD_NODES} --pidfile=${CELERYD_PID_FILE}'
13-
ExecReload=/bin/sh -c 'source ${CELERY_HOME}/bin/envvar && ${CELERY_BIN} multi restart ${CELERYD_NODES} -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
11+
ExecStart=/bin/bash -c 'source ${CELERY_HOME}/bin/envvar && ${CELERY_BIN} multi start ${CELERYD_NODES} -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
12+
ExecStop=/bin/bash -c 'source ${CELERY_HOME}/bin/envvar && ${CELERY_BIN} multi stopwait ${CELERYD_NODES} --pidfile=${CELERYD_PID_FILE}'
13+
ExecReload=/bin/bash -c 'source ${CELERY_HOME}/bin/envvar && ${CELERY_BIN} multi restart ${CELERYD_NODES} -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
1414

1515
[Install]
1616
WantedBy=multi-user.target

provisioning/setup.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ cp $DIR/etc/gitconsensus/celery /etc/gitconsensus/celery
1515

1616
adduser --gecos "" --disabled-login gitconsensus
1717

18+
mkdir /var/run/gitconsensus
19+
chown gitconsensus:gitconsensus /var/run/gitconsensus
20+
mkdir /var/log/gitconsensus
21+
chown gitconsensus:gitconsensus /var/log/gitconsensus
22+
1823
echo "d /var/run/celery 0755 celery celery -" >> /etc/tmpfiles.d/celery.conf
1924
echo "d /var/log/celery 0755 celery celery - " >> /etc/tmpfiles.d/celery.conf
2025

26+
systemctl daemon-reload

0 commit comments

Comments
 (0)