parent
a2f9c1832f
commit
3aa07e4885
|
@ -0,0 +1,20 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Celery Beat Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=celery
|
||||||
|
Group=celery
|
||||||
|
EnvironmentFile=/etc/default/celerybeat
|
||||||
|
ExecStartPre=-+/bin/mkdir -m 0755 /var/run/celery
|
||||||
|
ExecStartPre=+/bin/chown celery:celery /var/run/celery
|
||||||
|
WorkingDirectory=/opt/regluit
|
||||||
|
ExecStart=/bin/sh -c '"${CELERY_BIN}" -A "${CELERY_APP}" beat \
|
||||||
|
--pidfile="${CELERYBEAT_PID_FILE}" \
|
||||||
|
--logfile="${CELERYBEAT_LOG_FILE}" --loglevel="${CELERYBEAT_LOG_LEVEL}" \
|
||||||
|
"${CELERYBEAT_OPTS}"'
|
||||||
|
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,24 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Celery Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
User=celery
|
||||||
|
Group=celery
|
||||||
|
EnvironmentFile=/etc/default/celeryd
|
||||||
|
ExecStartPre=-+/bin/mkdir -m 0755 /var/run/celery
|
||||||
|
ExecStartPre=+/bin/chown celery:celery /var/run/celery
|
||||||
|
WorkingDirectory=/opt/regluit
|
||||||
|
ExecStart=/bin/sh -c '${CELERY_BIN} -A $CELERY_APP multi start $CELERYD_NODES \
|
||||||
|
--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} --loglevel="${CELERYD_LOG_LEVEL}"'
|
||||||
|
ExecReload=/bin/sh -c '${CELERY_BIN} -A $CELERY_APP multi restart $CELERYD_NODES \
|
||||||
|
--pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} \
|
||||||
|
--loglevel="${CELERYD_LOG_LEVEL}" $CELERYD_OPTS'
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -20,31 +20,6 @@
|
||||||
tags:
|
tags:
|
||||||
- celery
|
- celery
|
||||||
|
|
||||||
- name: Create directories for celery
|
|
||||||
become: yes
|
|
||||||
file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
state: directory
|
|
||||||
owner: celery
|
|
||||||
group: celery
|
|
||||||
mode: 0775
|
|
||||||
with_items:
|
|
||||||
- '/var/log/celery'
|
|
||||||
- '/var/run/celery'
|
|
||||||
tags:
|
|
||||||
- celery
|
|
||||||
|
|
||||||
- name: Copy celery init.d scripts
|
|
||||||
become: yes
|
|
||||||
copy:
|
|
||||||
src: "{{ item }}"
|
|
||||||
dest: "/etc/init.d/{{ item }}"
|
|
||||||
mode: 0755
|
|
||||||
with_items:
|
|
||||||
- 'celeryd'
|
|
||||||
- 'celerybeat'
|
|
||||||
tags:
|
|
||||||
- celery
|
|
||||||
|
|
||||||
- name: Copy celery config files
|
- name: Copy celery config files
|
||||||
become: yes
|
become: yes
|
||||||
|
@ -58,10 +33,27 @@
|
||||||
tags:
|
tags:
|
||||||
- celery
|
- celery
|
||||||
|
|
||||||
|
- name: Copy celery service files
|
||||||
|
become: yes
|
||||||
|
copy:
|
||||||
|
src: "{{ item }}.service"
|
||||||
|
dest: "/etc/systemd/system/{{ item }}.service"
|
||||||
|
mode: 0644
|
||||||
|
with_items:
|
||||||
|
- 'celeryd'
|
||||||
|
- 'celerybeat'
|
||||||
|
tags:
|
||||||
|
- celery
|
||||||
|
|
||||||
- name: Start celeryd
|
- name: Start celeryd
|
||||||
become: yes
|
become: yes
|
||||||
command: /etc/init.d/celeryd restart
|
ansible.builtin.service:
|
||||||
|
name: celeryd
|
||||||
|
daemon_reload: yes
|
||||||
|
state: reloaded
|
||||||
|
|
||||||
- name: Start celerybeat
|
- name: Start celerybeat
|
||||||
become: yes
|
become: yes
|
||||||
command: /etc/init.d/celerybeat restart
|
ansible.builtin.service:
|
||||||
|
name: celerybeat
|
||||||
|
state: restarted
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
CELERYBEAT_CHDIR="{{ project_path }}/"
|
CELERYBEAT_CHDIR="{{ project_path }}/"
|
||||||
|
|
||||||
# Name of the projects settings module.
|
# Name of the projects settings module.
|
||||||
export DJANGO_SETTINGS_MODULE="{{ django_settings_module }}"
|
DJANGO_SETTINGS_MODULE="{{ django_settings_module }}"
|
||||||
|
|
||||||
# Path to celery
|
# Path to celery
|
||||||
CELERY_BIN="{{ project_path }}/{{ virtualenv_name }}/bin/celery"
|
CELERY_BIN="{{ project_path }}/{{ virtualenv_name }}/bin/celery"
|
||||||
|
|
|
@ -9,4 +9,4 @@ CELERYD_GROUP="celery"
|
||||||
CELERYD_LOG_LEVEL="INFO"
|
CELERYD_LOG_LEVEL="INFO"
|
||||||
|
|
||||||
VIRTUALENV_ACTIVATE="{{ project_path }}/{{ virtualenv_name }}/bin/activate"
|
VIRTUALENV_ACTIVATE="{{ project_path }}/{{ virtualenv_name }}/bin/activate"
|
||||||
export DJANGO_SETTINGS_MODULE="{{ django_settings_module }}"
|
DJANGO_SETTINGS_MODULE="{{ django_settings_module }}"
|
||||||
|
|
Loading…
Reference in New Issue