Commit 1a7fb5e4 by Michael Roytman Committed by GitHub

Merge pull request #3798 from edx/mroytman/update-notifier

Dockerfile for notifier on 16.04
parents b196e20b d7264a83
FROM edxops/xenial-common:latest
MAINTAINER edxops
WORKDIR /edx/app/edx_ansible/edx_ansible/docker/plays
ADD . /edx/app/edx_ansible/edx_ansible
COPY docker/build/notifier/ansible_overrides.yml /
RUN /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook notifier.yml \
-i '127.0.0.1,' -c local \
-t 'install' \
-e@/ansible_overrides.yml
WORKDIR /edx/app
CMD ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisor/supervisord.conf"]
- name: Deploy notifier
hosts: all
sudo: True
gather_facts: True
vars:
serial_count: 1
serial: "{{ serial_count }}"
roles:
- common_vars
- docker
- notifier
---
- name: restart notifier-scheduler
supervisorctl:
name: "notifier-scheduler"
state: restarted
config: "{{ supervisor_cfg }}"
supervisorctl_path: "{{ supervisor_ctl }}"
when: not disable_edx_services
- name: restart notifier-celery-workers
supervisorctl:
name: "notifier-celery-workers"
state: restarted
config: "{{ supervisor_cfg }}"
supervisorctl_path: "{{ supervisor_ctl }}"
when: not disable_edx_services
......@@ -7,9 +7,9 @@
accept_hostkey: yes
become: true
become_user: "{{ notifier_user }}"
notify:
- restart notifier-scheduler
- restart notifier-celery-workers
tags:
- "install"
- "install:code"
# Optional auth for git
- name: Create ssh script for git (not authenticated)
......@@ -19,6 +19,9 @@
owner: "{{ notifier_user }}"
mode: "0750"
when: NOTIFIER_GIT_IDENTITY == ""
tags:
- "install"
- "install:code"
- name: Create ssh script for git (authenticated)
template:
......@@ -27,6 +30,9 @@
owner: "{{ notifier_user }}"
mode: "0750"
when: NOTIFIER_GIT_IDENTITY != ""
tags:
- "install"
- "install:code"
- name: Install read-only ssh key
copy:
......@@ -36,6 +42,9 @@
owner: "{{ notifier_user }}"
mode: "0600"
when: NOTIFIER_GIT_IDENTITY != ""
tags:
- "install"
- "install:code"
- name: Checkout theme
git:
......@@ -47,6 +56,9 @@
become_user: "{{ notifier_user }}"
environment:
GIT_SSH: "{{ notifier_git_ssh }}"
tags:
- "install"
- "install:code"
- name: Write notifier local settings
template:
......@@ -54,8 +66,9 @@
dest: "{{ NOTIFIER_CODE_DIR }}/notifier/settings_local.py"
mode: "0555"
when: NOTIFIER_THEME_NAME != ''
notify:
- restart notifier-celery-workers
tags:
- "install"
- "install:configuration"
- name: Install application requirements
pip:
......@@ -64,9 +77,9 @@
state: present
become: true
become_user: "{{ notifier_user }}"
notify:
- restart notifier-scheduler
- restart notifier-celery-workers
tags:
- "install"
- "install:app-requirements"
# Syncdb for whatever reason always creates the file owned by www-data:www-data, and then
# complains it can't write because it's running as notifier. So this is to touch the file into
......@@ -79,11 +92,10 @@
group: "{{ NOTIFIER_WEB_USER }}"
mode: "0664"
become: true
notify:
- restart notifier-scheduler
- restart notifier-celery-workers
tags:
- deploy
- "install"
- "install:configuration"
- name: Syncdb
shell: "{{ NOTIFIER_VENV_DIR }}/bin/python manage.py syncdb"
......@@ -92,6 +104,29 @@
become: true
become_user: "{{ notifier_user }}"
environment: notifier_env_vars
notify:
- restart notifier-scheduler
- restart notifier-celery-workers
when: migrate_db is defined and migrate_db|lower == "yes"
tags:
- "install"
- "install:configuration"
- name: restart notifier-scheduler
supervisorctl:
name: "notifier-scheduler"
state: restarted
config: "{{ supervisor_cfg }}"
supervisorctl_path: "{{ supervisor_ctl }}"
when: not disable_edx_services
tags:
- "manage"
- "manage:start"
- name: restart notifier-celery-workers
supervisorctl:
name: "notifier-celery-workers"
state: restarted
config: "{{ supervisor_cfg }}"
supervisorctl_path: "{{ supervisor_ctl }}"
when: not disable_edx_services
tags:
- "manage"
- "manage:start"
......@@ -21,11 +21,17 @@
name: "{{ item }}"
state: present
with_items: "{{ notifier_debian_pkgs }}"
tags:
- "install"
- "install:system-requirements"
- name: Check if incommon ca is installed
command: "test -e /usr/share/ca-certificates/incommon/InCommonServerCA.crt"
register: incommon_present
ignore_errors: yes
tags:
- "install"
- "install:base"
- name: Create incommon ca directory
file:
......@@ -33,21 +39,33 @@
state: directory
mode: "2775"
when: incommon_present|failed
tags:
- "install"
- "install:base"
- name: Retrieve incommon server CA
get_url:
url: "https://www.incommon.org/cert/repository/InCommonServerCA.txt"
dest: "/usr/share/ca-certificates/incommon/InCommonServerCA.crt"
when: incommon_present|failed
tags:
- "install"
- "install:base"
- name: Add InCommon ca cert
lineinfile:
dest: /etc/ca-certificates.conf
regexp: 'incommon/InCommonServerCA.crt'
line: 'incommon/InCommonServerCA.crt'
tags:
- "install"
- "install:base"
- name: Update ca certs globally
shell: "update-ca-certificates"
tags:
- "install"
- "install:base"
- name: Create notifier user {{ notifier_user }}
user:
......@@ -56,6 +74,9 @@
shell: /bin/false
home: "{{ notifier_app_dir }}"
createhome: no
tags:
- "install"
- "install:base"
- name: Create notifier app dir
file:
......@@ -63,9 +84,9 @@
state: directory
owner: "{{ notifier_user }}"
group: "{{ common_web_group }}"
notify:
- restart notifier-scheduler
- restart notifier-celery-workers
tags:
- "install"
- "install:base"
- name: Setup the notifier env
template:
......@@ -74,6 +95,9 @@
owner: "{{ notifier_user }}"
group: "{{ notifier_user }}"
mode: "0655"
tags:
- "install"
- "install:base"
- name: Drop a bash_profile
copy:
......@@ -81,6 +105,9 @@
dest: "{{ notifier_app_dir }}/.bash_profile"
owner: "{{ notifier_user }}"
group: "{{ notifier_user }}"
tags:
- "install"
- "install:base"
- name: Ensure .bashrc exists
file:
......@@ -88,18 +115,27 @@
state: touch
become: true
become_user: "{{ notifier_user }}"
tags:
- "install"
- "install:base"
- name: Add source of notifier_env to .bashrc
lineinfile:
dest: "{{ notifier_app_dir }}/.bashrc"
regexp: '. {{ notifier_app_dir }}/notifier_env'
line: '. {{ notifier_app_dir }}/notifier_env'
tags:
- "install"
- "install:base"
- name: Add source venv to .bashrc
lineinfile:
dest: "{{ notifier_app_dir }}/.bashrc"
regexp: '. {{ NOTIFIER_VENV_DIR }}/bin/activate'
line: '. {{ NOTIFIER_VENV_DIR }}/bin/activate'
tags:
- "install"
- "install:base"
- name: Create desired directories
file:
......@@ -113,6 +149,9 @@
- { path: '{{ notifier_app_dir }}/bin', owner: '{{ notifier_user }}', group: '{{ notifier_user }}', mode: '2775' }
- { path: '{{ notifier_app_dir }}/.ssh', owner: '{{ notifier_user }}', group: '{{ notifier_user }}', mode: '2700' }
- { path: '{{ COMMON_LOG_DIR }}/notifier', owner: 'syslog', group: 'syslog', mode: '0664' }
tags:
- "install"
- "install:base"
- name: Write supervisord wrapper for celery workers and scheduler
template:
......@@ -122,6 +161,9 @@
become_user: "{{ notifier_user }}"
with_items:
- { src: 'notifier-scheduler-supervisor.sh.j2', dest: '{{ notifier_app_dir }}/notifier-scheduler-supervisor.sh' }
tags:
- "install"
- "install:configuration"
- name: Write supervisord config for celery workers and scheduler
template:
......@@ -132,6 +174,9 @@
with_items:
- { src: 'edx/app/supervisor/conf.d/notifier-celery-workers.conf.j2', dest: '{{ supervisor_available_dir }}/notifier-celery-workers.conf' }
- { src: 'edx/app/supervisor/conf.d/notifier-scheduler.conf.j2', dest: '{{ supervisor_available_dir }}/notifier-scheduler.conf' }
tags:
- "install"
- "install:configuration"
- name: Enable supervisord config for celery workers
file:
......@@ -140,9 +185,10 @@
state: link
force: yes
become_user: "{{ supervisor_user }}"
notify:
- restart notifier-celery-workers
when: not disable_edx_services
tags:
- "install"
- "install:configuration"
- name: Enable supervisord config for scheduler
file:
......@@ -151,9 +197,10 @@
state: link
force: yes
become_user: "{{ supervisor_user }}"
notify:
- restart notifier-scheduler
when: not disable_edx_services
tags:
- "install"
- "install:configuration"
- include: deploy.yml
tags:
......
......@@ -28,3 +28,4 @@ weights:
- tools_jenkins: 8
- ecomworker: 4
- notes: 2
- notifier: 2
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