File tree Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ # Where does gitconsensus live
3
+ CELERY_HOME="/opt/gitconsensus"
4
+
5
+ # Name of nodes to start
6
+ # here we have a single node
7
+ CELERYD_NODES="w1"
8
+ # or we could have three nodes:
9
+ #CELERYD_NODES="w1 w2 w3"
10
+
11
+ # Absolute or relative path to the 'celery' command:
12
+ CELERY_BIN="/opt/gitconsensus/venv/bin/celery"
13
+ #CELERY_BIN="/virtualenvs/def/bin/celery"
14
+
15
+ # App instance to use
16
+ # comment out this line if you don't use an app
17
+ CELERY_APP="gitconsensusservice.celery"
18
+ # or fully qualified:
19
+ #CELERY_APP="proj.tasks:app"
20
+
21
+ # How to call manage.py
22
+ CELERYD_MULTI="multi"
23
+
24
+ # Extra command-line arguments to the worker
25
+ CELERYD_OPTS="--time-limit=120 --concurrency=4"
26
+
27
+ # - %n will be replaced with the first part of the nodename.
28
+ # - %I will be replaced with the current child process index
29
+ # 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"
32
+ CELERYD_LOG_LEVEL="INFO"
Original file line number Diff line number Diff line change
1
+ [Unit]
2
+ Description =GitConsensus Service
3
+ After =network.target
4
+
5
+ [Service]
6
+ Type =forking
7
+ User =gitconsensus
8
+ Group =gitconsensus
9
+ EnvironmentFile =-/etc/gitconsensus/celery
10
+ WorkingDirectory =${CELERY_HOME}
11
+ ExecStart =/bin/sh -c 'source ${CELERY_HOME}/venv/bin/activate && ${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}/venv/bin/activate && ${CELERY_BIN} multi stopwait ${CELERYD_NODES} --pidfile=${CELERYD_PID_FILE}'
13
+ ExecReload =/bin/sh -c 'source ${CELERY_HOME}/venv/bin/activate && ${CELERY_BIN} multi restart ${CELERYD_NODES} -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
14
+
15
+ [Install]
16
+ WantedBy =multi-user.target
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ if [[ -L " ${BASH_SOURCE[0]} " ]]
4
+ then
5
+ DIR=" $( cd " $( dirname $( readlink " ${BASH_SOURCE[0]} " ) ) " && pwd ) "
6
+ else
7
+ DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
8
+ fi
9
+
10
+ cd $DIR
11
+
12
+ cp $DIR /etc/systemd/system/gitconsensusworker.service /etc/systemd/system/gitconsensusworker.service
13
+ cp $DIR /etc/gitconsensus/celery /etc/gitconsensus/celery
14
+
15
+
16
+ adduser --gecos " " --disabled-login gitconsensus
17
+
18
+ echo " d /var/run/celery 0755 celery celery -" >> /etc/tmpfiles.d/celery.conf
19
+ echo " d /var/log/celery 0755 celery celery - " >> /etc/tmpfiles.d/celery.conf
20
+
You can’t perform that action at this time.
0 commit comments