Commit b5c1d5df by e0d

Initial working version of notifier role.

parent 1322e01a
#!/bin/sh
exec /usr/bin/ssh -o StrictHostKeyChecking=no -i /etc/git-identity "$@"
---
##
## for future compliance, when the API comes on line.
##
- name: notifier | restart the notifier service
service: name=notifier state=restarted
#
# TODO: Needed while this repo is private
#
- name: notifier | upload ssh script
copy:
src=git_ssh.sh dest=/tmp/git_ssh.sh
force=yes owner=root group=adm mode=750
tags:
- notifier
- 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:
- deploy
- install
- update
- name: notifier | checkout code
git:
dest={{ notifier_code_dir }} repo={{ notifier_source_repo }}
version={{ notifier_version }}
environment:
GIT_SSH: /tmp/git_ssh.sh
tags:
- deploy
- install
- update
#
# TODO: Needed while this repo is private
#
- name: notifier | update src permissions
file:
path={{ notifier_code_dir }} state=directory owner={{ notifier_user }}
group={{ notifier_user }} mode=2750 recurse=yes
tags:
- 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:
- deploy
- install
- update
#
# TODO: Needed while this repo is private
#
- name: notifier | remove ssh script
file: path=/tmp/git_ssh.sh state=absent
tags:
- deploy
- install
- update
- name: notifier | install application requirements
pip:
requirements="{{ notifier_requirements_file }}"
virtualenv="{{ notifier_venv_dir }}" state=present
sudo: true
sudo_user: "{{ notifier_user }}"
tags:
- deploy
- install
- update
\ No newline at end of file
---
#
# notifier
#
# Overview:
#
# Provides the edX notifier service, a service for sending
# notifications over messaging protocols.
#
# Dependencies:
#
# * common
#
# Example play:
# roles:
# - common
# - notifier
#
- name: notifier | install notifier specific system packages
apt: pkg={{','.join(notifier_debian_pkgs)}} state=present
tags:
- notifier
- install
- update
- name: notifier | create notifier user {{ notifier_user }}
user:
name={{ notifier_user }} state=present shell=/bin/bash
home={{ notifier_home }} createhome=yes
tags:
- notifier
- install
- update
- name: notifier | setup the notifier env
template:
src=notifier_env.j2 dest="{{ notifier_home }}/notifier_env"
owner="{{ notifier_user }}" group="{{ notifier_user }}"
tags:
- notifier
- install
- update
- name: notifier | ensure .bashrc exists
shell: touch {{ notifier_home }}/.bashrc
sudo: true
sudo_user: "{{ notifier_user }}"
tags:
- notifier
- install
- update
- name: notifier | add source of notifier_env to .bashrc
lineinfile:
dest={{ notifier_home }}/.bashrc
regexp='. {{ notifier_home }}/notifier_env'
line='. {{ notifier_home }}/notifier_env'
tags:
- notifier
- install
- update
- name: notifier | add source venv to .bashrc
lineinfile:
dest={{ notifier_home }}/.bashrc
regexp='. {{ notifier_venv_dir }}/bin/activate'
line='. {{ notifier_venv_dir }}/bin/activate'
tags:
- notifier
- install
- update
- include: deploy.yml
\ No newline at end of file
description "Notifier Service"
start on runlevel [2345]
stop on runlevel [!2345]
env PID=/var/tmp/notifier_service.pid
chdir {{ notifier_code_dir }}
exec {{ notifier_home }}/src/manage.py runserver
\ No newline at end of file
# Application Environment
export NOTIFIER_ENV="{{ notifier_env }}"
# email settings independent of transport
export EMAIL_HOST="{{ notifier_email_host }}"
export EMAIL_PORT="{{ notifer_email_port }}"
export EMAIL_HOST_USER="{{ notifer_email_user }}"
export EMAIL_HOST_PASSWORD="{{ notifier_email_pass }}"
export EMAIL_DOMAIN="{{ notifier_email_domain }}"
export EMAIL_REWRITE_RECIPIENT="{{ notifer_email_rewrite_recipient }}"
# LMS links, images, etc
export LMS_URL_BASE="{{ notifier_lms_url_base }}"
# Comments Service Endpoint, for digest pulls
export CS_URL_BASE="{{ notifier_comment_service_base }}"
export CS_API_KEY="{{ notifier_comment_service_api_key }}"
# User Service Endpoint, for notification prefs
export US_URL_BASE="{{ notifier_user_service_base }}"
export US_API_KEY="{{ notifier_user_service_api_key }}"
# celery
export BROKER_URL="{{ notifier_celery_broker_url }}"
\ No newline at end of file
---
notifier_user: "notifier"
notifier_home: "/opt/wwc/notifier"
notifier_venv_dir: "{{ notifier_home }}/virtualenvs/notifier"
notifier_source_repo: "git@github.com:edx/notifier.git"
notifier_code_dir: "{{ notifier_home }}/src"
notifier_version: "preintegration"
notifier_git_identity_path: "{{ secure_dir }}/files/git-identity"
notifier_requirements_file: "{{ notifier_code_dir }}/requirements.txt"
notifier_env: "Development"
notifier_email_host: "localhost"
notifier_email_port: 25
notifier_email_user: ""
notifier_email_pass: ""
notifier_email_host: ""
notifier_email_domain: "notifications.edx.org"
notifier_email_rewrite_recipient: ""
notifier_lms_url_base: "http://localhost:8000"
notifier_comment_service_base: "http://localhost:4567"
2notifier_comment_service_api_key: "PUT_YOUR_API_KEY_HERE"
notifier_user_service_base: "http://localhost:8000"
notifier_user_service_api_key: "PUT_YOUR_API_KEY_HERE"
notifier_celery_broker_url: "django://"
notifier_debian_pkgs:
- apparmor-utils
- build-essential
- curl
- g++
- gcc
- ipython
- pkg-config
- rsyslog
\ No newline at end of file
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