Commit 50750f4b by e0d

Refactoring to support new supervisor config.

parent 5d0c6d09
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
NOTIFIER_USER: "notifier" NOTIFIER_USER: "notifier"
NOTIFIER_WEB_USER: "www-user" NOTIFIER_WEB_USER: "www-user"
NOTIFIER_HOME: "/opt/wwc/notifier" NOTIFIER_HOME: "{{ COMMON_APP_DIR }}/notifier"
NOTIFIER_VENV_DIR: "{{ NOTIFIER_HOME }}/virtualenvs/notifier" NOTIFIER_VENV_DIR: "{{ NOTIFIER_HOME }}/virtualenvs/notifier"
NOTIFIER_DB_DIR: "{{ NOTIFIER_HOME }}/db" NOTIFIER_DB_DIR: "{{ NOTIFIER_HOME }}/db"
NOTIFIER_SOURCE_REPO: "https://github.com/edx/notifier.git" NOTIFIER_SOURCE_REPO: "https://github.com/edx/notifier.git"
......
...@@ -4,20 +4,16 @@ ...@@ -4,20 +4,16 @@
## for future compliance, when the API comes on line. ## for future compliance, when the API comes on line.
## ##
- name: notifier | install notifier-scheduler
supervisorctl: name=notifier-scheduler state=present
- name: notifier | install notifier-celery-workers
supervisorctl: name=notifier-celery-workers state=present
- name: notifier | restart notifier
supervisorctl: name=notifier-scheduler state=restarted
notify:
- notifier | install notifier-celery-workers
- notifier | install notifier-scheduler
- name: notifier | restart notifier-scheduler - name: notifier | restart notifier-scheduler
supervisorctl: name=notifier-scheduler state=restarted supervisorctl: >
name=notifier-scheduler
state=restarted
config={{ supervisor_cfg }}
supervisorctl_path={{ supervisor_ctl }}
- name: notifier | restart notifier-celery-workers - name: notifier | restart notifier-celery-workers
supervisorctl: name=notifier-celery-workers state=restarted supervisorctl: >
name=notifier-celery-workers
state=restarted
config={{ supervisor_cfg }}
supervisorctl_path={{ supervisor_ctl }}
--- ---
- name: notifier | stop notifier-celery-beat
supervisorctl: name=notifier-celery-beat state=restarted
ignore_errors: yes
- name: notifier | stop notifier-celery-workers - name: notifier | stop notifier-celery-beat
supervisorctl: name=notifier-celery-workers state=restarted supervisorctl: >
name="{{ item }}"
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=present
ignore_errors: yes ignore_errors: yes
sudo_user: "{{ common_web_user }}"
with_items: ['notifier-scheduler','notifier-celery-workers']
tags:
- deploy
- name: notifier | checkout code - name: notifier | checkout code
git: git:
dest={{ NOTIFIER_CODE_DIR }} repo={{ NOTIFIER_SOURCE_REPO }} dest={{ NOTIFIER_CODE_DIR }} repo={{ NOTIFIER_SOURCE_REPO }}
version={{ NOTIFIER_VERSION }} version={{ NOTIFIER_VERSION }}
sudo: true
sudo_user: "{{ NOTIFIER_USER }}"
notify: notify:
- notifier | restart notifier - notifier | restart notifier
tags: tags:
...@@ -35,20 +42,25 @@ ...@@ -35,20 +42,25 @@
sudo: true sudo: true
sudo_user: "{{ NOTIFIER_USER }}" sudo_user: "{{ NOTIFIER_USER }}"
notify: notify:
- notifier | restart notifier - notifier | restart notifier-scheduler
- notifier | restart notifier-celery-workers
tags: tags:
- notifier - notifier
- deploy - deploy
- install - install
- update - update
- name: notifier | debug
debug: msg="supervisorctl is defined as {{ supervisor_ctl }}"
- name: notifier | syncdb - name: notifier | syncdb
shell: > shell: >
cd {{ NOTIFIER_CODE_DIR }} && {{ NOTIFIER_VENV_DIR }}/bin/python manage.py syncdb cd {{ NOTIFIER_CODE_DIR }} && {{ NOTIFIER_VENV_DIR }}/bin/python manage.py syncdb
sudo: true sudo: true
sudo_user: "{{ NOTIFIER_USER }}" sudo_user: "{{ NOTIFIER_USER }}"
notify: notify:
- notifier | restart notifier - notifier | restart notifier-scheduler
- notifier | restart notifier-celery-workers
tags: tags:
- notifier - notifier
- deploy - deploy
......
...@@ -90,13 +90,17 @@ ...@@ -90,13 +90,17 @@
path={{NOTIFIER_SUPERVISOR_LOG_DEST }} mode=2750 state=directory path={{NOTIFIER_SUPERVISOR_LOG_DEST }} mode=2750 state=directory
- name: notifier | supervisord config for celery workers - name: notifier | supervisord config for celery workers
template: template: >
src=etc/supervisor/conf.d/notifier-celery-workers.conf.j2 dest=/etc/supervisor/conf.d/notifier-celery-workers.conf src=edx/app/supervisor/conf.d/notifier-celery-workers.conf.j2
dest=/edx/app/supervisor/conf.d/notifier-celery-workers.conf
sudo_user: "{{ supervisor_user }}"
notify: notifier | restart notifier-celery-workers notify: notifier | restart notifier-celery-workers
- name: notifier | supervisord config for scheduler - name: notifier | supervisord config for scheduler
template: template: >
src=etc/supervisor/conf.d/notifier-scheduler.conf.j2 dest=/etc/supervisor/conf.d/notifier-scheduler.conf src=edx/app/supervisor/conf.d/notifier-scheduler.conf.j2
dest=/edx/app/supervisor/conf.d/notifier-scheduler.conf
sudo_user: "{{ supervisor_user }}"
notify: notifier | restart notifier-scheduler notify: notifier | restart notifier-scheduler
- include: deploy.yml - include: deploy.yml
...@@ -16,7 +16,6 @@ startretries=3 ...@@ -16,7 +16,6 @@ startretries=3
exitcodes=0,2 exitcodes=0,2
stopsignal=TERM stopsignal=TERM
stopwaitsecs=10 stopwaitsecs=10
user=notifier
redirect_stderr=false redirect_stderr=false
stdout_logfile={{NOTIFIER_SUPERVISOR_LOG_DEST }}/notifier-celery-workers-stdout.log stdout_logfile={{NOTIFIER_SUPERVISOR_LOG_DEST }}/notifier-celery-workers-stdout.log
stdout_logfile_maxbytes=1MB stdout_logfile_maxbytes=1MB
......
...@@ -16,7 +16,6 @@ startretries=3 ...@@ -16,7 +16,6 @@ startretries=3
exitcodes=0,2 exitcodes=0,2
stopsignal=TERM stopsignal=TERM
stopwaitsecs=10 stopwaitsecs=10
user=notifier
redirect_stderr=false redirect_stderr=false
stdout_logfile={{ NOTIFIER_SUPERVISOR_LOG_DEST }}/notifier-scheduler-stdout.log stdout_logfile={{ NOTIFIER_SUPERVISOR_LOG_DEST }}/notifier-scheduler-stdout.log
stdout_logfile_maxbytes=1MB stdout_logfile_maxbytes=1MB
......
;
; {{ ansible_managed }}
;
[program:notifier-scheduler]
command={{ NOTIFIER_VENV_DIR }}/bin/python manage.py scheduler
process_name=%(program_name)s
numprocs=1
directory={{ NOTIFIER_CODE_DIR }}
umask=022
autostart=true
autorestart=true
startsecs=10
startretries=3
exitcodes=0,2
stopsignal=TERM
stopwaitsecs=10
user=notifier
redirect_stderr=false
stdout_logfile={{ NOTIFIER_SUPERVISOR_LOG_DEST }}/notifier-scheduler-stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile={{ NOTIFIER_SUPERVISOR_LOG_DEST }}/notifier-scheduler-stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
environment=PID='/var/tmp/notifier-scheduler.pid',LANG=en_US.UTF-8,
{%- for name,value in notifier_env_vars.items() -%}
{{name}}="{{value}}"{%- if not loop.last -%},{%- endif -%}
{%- endfor -%}
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