Bladeren bron

Add files for demonize celery via systemd.

Anarchist666 12 jaren geleden
bovenliggende
commit
630c8fbbcc
3 gewijzigde bestanden met toevoegingen van 37 en 0 verwijderingen
  1. 20 0
      extra/systemd/celery
  2. 2 0
      extra/systemd/celery.conf
  3. 15 0
      extra/systemd/celery.service

+ 20 - 0
extra/systemd/celery

@@ -0,0 +1,20 @@
+# Name of nodes to start, here we have a single node
+CELERYD_NODES="w1"
+# or we could have three nodes:
+#CELERYD_NODES="w1 w2 w3"
+
+# Where to chdir at start.
+#CELERYD_CHDIR="/opt/Myproject/"
+
+# How to call "manage.py celeryd_multi"
+CELERYD_MULTI="celeryd_multi"
+
+# Extra arguments to celeryd
+CELERYD_OPTS="--time-limit=300 --concurrency=3"
+
+# %n will be replaced with the nodename.
+CELERYD_LOG_FILE="/var/log/celery/%n.log"
+CELERYD_PID_FILE="/var/run/celery/%n.pid"
+
+#Logging level, choose between `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`, or `FATAL`.
+CELERYD_LOG_LEVEL="INFO"

+ 2 - 0
extra/systemd/celery.conf

@@ -0,0 +1,2 @@
+d /run/celery 0755 user users -
+d /var/log/celery 0755 user users -

+ 15 - 0
extra/systemd/celery.service

@@ -0,0 +1,15 @@
+[Unit]
+Description=Celery Nodes Daemon
+After=network.target
+
+[Service]
+Type=forking
+User=user
+Group=users
+EnvironmentFile=-/etc/conf.d/celery
+ExecStart=/usr/bin/python2 ${CELERYD_CHDIR}/manage.py ${CELERYD_MULTI} start $CELERYD_NODES --pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} $CELERYD_OPTS 
+ExecStop=/usr/bin/python2 ${CELERYD_CHDIR}/manage.py ${CELERYD_MULTI} stopwait $CELERYD_NODES --pidfile=${CELERYD_PID_FILE}
+ExecReload=/usr/bin/python2 ${CELERYD_CHDIR}/manage.py ${CELERYD_MULTI} restart $CELERYD_NODES --pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} $CELERYD_OPTS 
+
+[Install]
+WantedBy=multi-user.target