blob: ae4bff18ae27926ad79edb0807aed4935b407618 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# Where the real starting happens.
# We need multiple celeryd conf since we want multiple RhodeCode instances
# running, and each needs its own celery daemon. The instances are created on
# the APPINI variables, passed by celeryd-start.conf upstart script.
# Celery instances should not be started nor stoppe using this, but rather
# with celeryd-start and celeryd-stop, taht will take care of the instance
# variables.
description "Celery Upstart Job"
author "Milo Casagrande <milo.casagrande@linaro.org>"
start on started rhodecode
stop on stopped rhodecode
respawn
respawn limit 10 5
instance $APPINI
umask 0002
env HOME="/home/rhodecode"
env USER="rhodecode"
env GROUP="rhodecode"
env LOCAL_PY_PATH=".local/lib/python2.7/site-packages/"
limit nofile 4096 65536
script
PIDFILE="/tmp/celeryd-$APPINI.pid"
CONF_FILE="$HOME/$APPINI"
COMMAND="paster celeryd $CONF_FILE --pidfile=$PIDFILE --autoscale=8,1"
PYTHONPATH="$PYTHONPATH:$HOME/$LOCAL_PY_PATH"
export PYTHONPATH=$PYTHONPATH
if [ -z "$GROUP" ]; then
exec sudo -u $USER $COMMAND
else
exec sudo -u $USER -g $GROUP $COMMAND
fi
end script
post-stop script
PIDFILE="/tmp/celeryd-$APPINI.pid"
rm -f $PIDFILE
end script
|