Commit d9227fc4 by e0d

Merge pull request #425 from edx/e0d/notifier-refactor

E0d/notifier refactor
parents 2b385bb7 2b936b5d
......@@ -2,7 +2,7 @@
NOTIFIER_USER: "notifier"
NOTIFIER_WEB_USER: "www-user"
NOTIFIER_HOME: "/opt/wwc/notifier"
NOTIFIER_HOME: "{{ COMMON_APP_DIR }}/notifier"
NOTIFIER_VENV_DIR: "{{ NOTIFIER_HOME }}/virtualenvs/notifier"
NOTIFIER_DB_DIR: "{{ NOTIFIER_HOME }}/db"
NOTIFIER_SOURCE_REPO: "https://github.com/edx/notifier.git"
......@@ -38,7 +38,7 @@ NOTIFIER_USER_SERVICE_HTTP_AUTH_USER: "guido"
NOTIFIER_USER_SERVICE_HTTP_AUTH_PASS: "vanrossum"
NOTIFIER_CELERY_BROKER_URL: "django://"
NOTIFIER_SUPERVISOR_LOG_DEST: "{{ COMMON_DATA_DIR }}/logs/supervisor"
NOTIFIER_SUPERVISOR_LOG_DEST: "{{ COMMON_DATA_DIR }}/log/supervisor"
NOTIFER_REQUESTS_CA_BUNDLE: "/etc/ssl/certs/ca-certificates.crt"
......@@ -53,7 +53,6 @@ notifier_debian_pkgs:
- ipython
- pkg-config
- rsyslog
- supervisor
#
# This structure is iterated over in order to build both
......
---
##
## 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
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
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
supervisorctl: name=notifier-celery-workers state=restarted
ignore_errors: yes
- name: notifier | checkout code
git:
dest={{ NOTIFIER_CODE_DIR }} repo={{ NOTIFIER_SOURCE_REPO }}
version={{ NOTIFIER_VERSION }}
sudo: true
sudo_user: "{{ NOTIFIER_USER }}"
notify:
- notifier | restart notifier
- notifier | restart notifier-scheduler
- notifier | restart notifier-celery-workers
tags:
- notifier
- deploy
- install
- update
- name: notifier | source repo group perms
file:
path={{ NOTIFIER_SOURCE_REPO }} mode=2775 state=directory
tags:
- notifier
- deploy
- install
- update
- name: notifier | install application requirements
pip:
......@@ -35,12 +25,10 @@
sudo: true
sudo_user: "{{ NOTIFIER_USER }}"
notify:
- notifier | restart notifier
- notifier | restart notifier-scheduler
- notifier | restart notifier-celery-workers
tags:
- notifier
- deploy
- install
- update
- name: notifier | syncdb
shell: >
......@@ -48,9 +36,7 @@
sudo: true
sudo_user: "{{ NOTIFIER_USER }}"
notify:
- notifier | restart notifier
- notifier | restart notifier-scheduler
- notifier | restart notifier-celery-workers
tags:
- notifier
- deploy
- install
- update
- deploy
\ No newline at end of file
......@@ -85,18 +85,18 @@
file:
path="{{ NOTIFIER_HOME }}/bin" mode=2775 state=directory
- name: common | create supervisor log directoy
file:
path={{NOTIFIER_SUPERVISOR_LOG_DEST }} mode=2750 state=directory
- name: notifier | supervisord config for celery workers
template:
src=etc/supervisor/conf.d/notifier-celery-workers.conf.j2 dest=/etc/supervisor/conf.d/notifier-celery-workers.conf
template: >
src=edx/app/supervisor/conf.d/notifier-celery-workers.conf.j2
dest="{{ supervisor_cfg_dir }}/notifier-celery-workers.conf"
sudo_user: "{{ supervisor_user }}"
notify: notifier | restart notifier-celery-workers
- name: notifier | supervisord config for scheduler
template:
src=etc/supervisor/conf.d/notifier-scheduler.conf.j2 dest=/etc/supervisor/conf.d/notifier-scheduler.conf
template: >
src=edx/app/supervisor/conf.d/notifier-scheduler.conf.j2
dest="{{ supervisor_cfg_dir }}/notifier-scheduler.conf"
sudo_user: "{{ supervisor_user }}"
notify: notifier | restart notifier-scheduler
- include: deploy.yml
- include: deploy.yml
\ No newline at end of file
......@@ -16,7 +16,6 @@ startretries=3
exitcodes=0,2
stopsignal=TERM
stopwaitsecs=10
user=notifier
redirect_stderr=false
stdout_logfile={{NOTIFIER_SUPERVISOR_LOG_DEST }}/notifier-celery-workers-stdout.log
stdout_logfile_maxbytes=1MB
......
......@@ -16,7 +16,6 @@ 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
......
;
; {{ 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