Commit 4b3c5074 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

deploy celery with ansible, WIP

WIP on #174 and #175
parent dbebbef7
Pipeline #21908 passed with stage
in 8 minutes and 45 seconds
[Unit]
Description=Celery Service
After=network.target
[Service]
Type=forking
User=jass
Group=nginx
EnvironmentFile=-/etc/default/ippidb-{{ http_port }}-celeryd
WorkingDirectory=/var/ippidb-{{ http_port }}
ExecStart=/bin/sh -c '${CELERY_BIN} multi start ${CELERYD_NODES} \
-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} \
--logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
[Install]
WantedBy=multi-user.target
CELERYD_NODES="worker"
CELERY_BIN="celery"
CELERY_APP="ippisite"
CELERYD_CHDIR="/var/ippidb-{{ http_port }}-celery"
CELERYD_OPTS="--time-limit=3000 --concurrency=1 --max-tasks-per-child=1"
CELERYD_LOG_FILE="/var/ippidb-{{ http_port }}-celery/celery%N.log"
CELERYD_PID_FILE="/var/ippidb-{{ http_port }}-celery/celery%N.pid"
CELERYD_LOG_LEVEL="DEBUG"
CELERYD_USER=""
CELERYD_GROUP="nginx"
CELERY_CREATE_DIRS=1
......@@ -121,6 +121,24 @@
systemd: state=stopped name=ippidb-web
#ignore fail (i.e. when service does not exist yet)
ignore_errors: yes
- name: stop celery service
systemd: state=stopped name=celery enabled=true
ignore_errors: yes
#
# Set up celery service
#
- name: copy celeryd configuration file
copy:
src: celeryd
dest: /etc/default
owner: root
group: root
- name: copy celery systemd service
copy:
src: celery.service
dest: /lib/systemd/system/celery.service
owner: root
group: root
#
# Fetch/Update code and prep django app for publication
#
......@@ -186,7 +204,7 @@
('EMAIL_ADMIN', 'hmenager@pasteur.fr'),
]
MANAGERS = [
('EMAIL_MANAGER', 'hmenager@pasteur.fr'),
('EMAIL_MANAGER', 'ippidb@pasteur.fr'),
]
LOGGING = {
'version': 1,
......@@ -290,4 +308,9 @@
# Start web server
#
- name: start iPPIDB service if relevant
systemd: state=started name=ippidb{{ http_port }}-web enabled=true
\ No newline at end of file
systemd: state=started name=ippidb{{ http_port }}-web enabled=true
#
# Start celery service
#
- name: start celery service if relevant
systemd: state=started name=celery enabled=true daemon_reload=true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment