Commit 276cd811 by Sef Kloninger

Merge pull request #275 from edx/sef/notifier-west

Notifier install fixes / seen while installing at Stanford
parents 0823ff88 d9f4c00a
# we never want to migrate from these machines, so note no vars_prompt
# section like other appservers
- hosts: ~tag_Name_app(10|20)_carn - hosts: ~tag_Name_app(10|20)_carn
sudo: True sudo: True
vars_prompt: vars_prompt:
...@@ -9,7 +6,7 @@ ...@@ -9,7 +6,7 @@
default: "no" default: "no"
private: no private: no
vars: vars:
secure_dir: '../../../edx-secret/ansible' secure_dir: '../../../configuration-secure/ansible'
# this indicates the path to site-specific (with precedence) # this indicates the path to site-specific (with precedence)
# things like nginx template files # things like nginx template files
#local_dir: '../../../edx-secret/ansible/local' #local_dir: '../../../edx-secret/ansible/local'
......
# this gets all running prod webservers # For all util machines
- hosts: tag_environment_prod:&tag_function_util - hosts: tag_environment_prod:&tag_function_util
# or we can get subsets of them by name # or we can get subsets of them by name
#- hosts: ~tag_Name_util(1|2)_prod #- hosts: ~tag_Name_util(1|2)_prod
...@@ -17,3 +17,19 @@ ...@@ -17,3 +17,19 @@
roles: roles:
- common - common
- { role: 'edxapp', celery_worker: True } - { role: 'edxapp', celery_worker: True }
# run the notifier on the first util machine only
- hosts: ~tag_Name_util10_prod
sudo: True
vars:
secure_dir: '../../../configuration-secure/ansible'
migrate_db: "no"
vars_files:
- "{{ secure_dir }}/vars/edxapp_prod_vars.yml"
- "{{ secure_dir }}/vars/notifier_prod_vars.yml"
roles:
- role: virtualenv
virtualenv_user: "notifier"
virtualenv_user_home: "/opt/wwc/notifier"
virtualenv_name: "notifier"
- notifier
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
sudo: True sudo: True
vars: vars:
secure_dir: ../../../edx-secret/ansible secure_dir: ../../../edx-secret/ansible
# this indicates the path to site-specific (with precedence)
# things like nginx template files
local_dir: ../../../edx-secret/ansible/local local_dir: ../../../edx-secret/ansible/local
migrate_db: "no" migrate_db: "no"
vars_files: vars_files:
...@@ -14,3 +16,19 @@ ...@@ -14,3 +16,19 @@
roles: roles:
- common - common
- { role: 'edxapp', celery_worker: True } - { role: 'edxapp', celery_worker: True }
# run the notifier on the first util machine only
- hosts: ~tag_Name_util10_stage
sudo: True
vars:
secure_dir: '../../../configuration-secure/ansible'
migrate_db: "no"
vars_files:
- "{{ secure_dir }}/vars/edxapp_stage_vars.yml"
- "{{ secure_dir }}/vars/notifier_stage_vars.yml"
roles:
- role: virtualenv
virtualenv_user: "notifier"
virtualenv_user_home: "/opt/wwc/notifier"
virtualenv_name: "notifier"
- notifier
...@@ -41,6 +41,8 @@ notifier_supervisor_log_dest: "/mnt/logs/supervisor" ...@@ -41,6 +41,8 @@ notifier_supervisor_log_dest: "/mnt/logs/supervisor"
notifer_requests_ca_bundle: "/etc/ssl/certs/ca-certificates.crt" notifer_requests_ca_bundle: "/etc/ssl/certs/ca-certificates.crt"
notifier_dd_api_key: "NOT_USED" # data dog
notifier_debian_pkgs: notifier_debian_pkgs:
- apparmor-utils - apparmor-utils
- build-essential - build-essential
......
#!/bin/sh
exec /usr/bin/ssh -o StrictHostKeyChecking=no -i /etc/git-identity "$@"
#!/bin/bash
. $HOME/.bashrc
minutes=$1
digest_date=`date --utc '+%Y-%m-%dT%H:%MZ'`
cd /opt/wwc/notifier/src && /opt/wwc/notifier/virtualenvs/notifier/bin/python /opt/wwc/notifier/src/manage.py forums_digest --to_datetime=${digest_date} --minutes=${minutes}
# ---
# TODO: Needed while this repo is private - name: notifier | stop notifier-celery-beat
# supervisorctl: name=notifier-celery-beat state=restarted
- name: notifier | upload ssh script ignore_errors: yes
copy:
src=git_ssh.sh dest=/tmp/git_ssh.sh
force=yes owner=root group=adm mode=750
notify:
- notifier | restart notifier
tags:
- notifier
- deploy
- install
- update
#
# TODO: Needed while this repo is private
#
- name: notifier | install read-only ssh key required for checkout
copy:
src={{ notifier_git_identity_path }} dest=/etc/git-identity
force=yes owner=ubuntu group=adm mode=60
tags:
- notifier
- deploy
- install
- update
- name: notifier | stop notifier-scheduler
supervisorctl: name=notifier-scheduler state=restarted
- name: notifier | stop notifier-celery-workers - name: notifier | stop notifier-celery-workers
supervisorctl: name=notifier-celery-workers state=restarted supervisorctl: name=notifier-celery-workers state=restarted
ignore_errors: yes
- 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 }}
environment:
GIT_SSH: /tmp/git_ssh.sh
notify: notify:
- notifier | restart notifier - notifier | restart notifier
tags: tags:
...@@ -46,35 +19,9 @@ ...@@ -46,35 +19,9 @@
- install - install
- update - update
# - name: notifier | source repo group perms
# TODO: Needed while this repo is private
#
- name: notifier | update src permissions
file: file:
path={{ notifier_code_dir }} state=directory owner={{ notifier_user }} path={{ notifier_source_repo }} mode=2775 state=directory
group={{ notifier_user }} mode=2750 recurse=yes
tags:
- notifier
- deploy
- install
- update
#
# TODO: Needed while this repo is private
#
- name: notifier | remove read-only ssh key for the content repo
file: path=/etc/git-identity state=absent
tags:
- notifier
- deploy
- install
- update
#
# TODO: Needed while this repo is private
#
- name: notifier | remove ssh script
file: path=/tmp/git_ssh.sh state=absent
tags: tags:
- notifier - notifier
- deploy - deploy
......
...@@ -96,7 +96,6 @@ ...@@ -96,7 +96,6 @@
owner={{ notifier_user }} owner={{ notifier_user }}
group={{ notifier_user }} group={{ notifier_user }}
- name: notifier | ensure .bashrc exists - name: notifier | ensure .bashrc exists
shell: touch {{ notifier_home }}/.bashrc shell: touch {{ notifier_home }}/.bashrc
sudo: true sudo: true
...@@ -126,16 +125,17 @@ ...@@ -126,16 +125,17 @@
- install - install
- update - update
- name: notifier | create notifier/bin directory - name: notifier | create notifier/db directory
file: file:
path="{{ notifier_home }}/bin" mode=2775 state=directory path="{{ notifier_home }}/db" mode=2775 state=directory
tags: tags:
- notifier - notifier
- install - install
- update - update
- name: notifier | make the script executable - name: notifier | create notifier/bin directory
file: path={{ notifier_home }}/bin/forums_digest.sh state=file mode=2755 file:
path="{{ notifier_home }}/bin" mode=2775 state=directory
tags: tags:
- notifier - notifier
- install - install
...@@ -168,17 +168,4 @@ ...@@ -168,17 +168,4 @@
- install - install
- update - update
- name: notifier | add cron job
cron:
name="forums digest" hour={{ notifier_cron_hour }}
minute="{{ notifier_cron_minute }}" job="$HOME/forums_digest.sh 1440"
state="absent"
sudo: true
sudo_user: "{{ notifier_user }}"
tags:
- notifier
- install
- update
- clean
- include: deploy.yml - include: deploy.yml
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