Commit 234ac063 by Max Rothman

Merge pull request #1772 from edx/max/devstack-notifier

Max/devstack notifier
parents 4260ac8a 113233a8
- Role: notifier
- Refactored `NOTIFIER_HOME` and `NOTIFIER_USER` to `notifier_app_dir` and `notifier_user` to match other roles. This shouldn't change anything since users should've only been overriding COMMON_HOME.
- Role: gitreload
- New role added for running
[gitreload](https://github.com/mitodl/gitreload) that can be used
......
......@@ -28,6 +28,7 @@
- oraclejdk
- elasticsearch
- forum
- { role: notifier, NOTIFIER_DIGEST_TASK_INTERVAL: "5" }
- { role: "xqueue", update_users: True }
- role: xserver
when: XSERVER_GIT_IDENTITY|length > 0
......
......@@ -38,6 +38,7 @@
- oraclejdk
- elasticsearch
- forum
- { role: notifier, NOTIFIER_DIGEST_TASK_INTERVAL: "5" }
- { role: "xqueue", update_users: True }
- role: ora
when: ENABLE_LEGACY_ORA
......
......@@ -136,6 +136,7 @@ EDXAPP_FEATURES:
AUTOMATIC_AUTH_FOR_TESTING: $EDXAPP_ENABLE_AUTO_AUTH
ENABLE_THIRD_PARTY_AUTH: $EDXAPP_ENABLE_THIRD_PARTY_AUTH
ENABLE_VIDEO_UPLOAD_PIPELINE: false
ENABLE_DISCUSSION_HOME_PANEL: true
EDXAPP_BOOK_URL: ""
# This needs to be set to localhost
......@@ -283,7 +284,7 @@ EDXAPP_TRACKING_SEGMENTIO_WEBHOOK_SECRET: ""
EDXAPP_SEGMENT_IO_KEY: ""
EDXAPP_SEGMENT_IO: false
EDXAPP_EDX_API_KEY: ""
EDXAPP_EDX_API_KEY: "PUT_YOUR_API_KEY_HERE"
# This is the default set in common.py
EDXAPP_VERIFY_STUDENT:
DAYS_GOOD_FOR: 365
......
#! /usr/bin/env bash
# {{ ansible_managed }}
source "{{ item.home }}/{{ item.env }}"
# If X11 forwarding is enabled, then use the DISPLAY value
# already set and use the X11 session cookie
if [ -n "$DISPLAY" ]; then
export XAUTHORITY="{{ localdev_xauthority }}"
# Otherwise, configure the display to use the virtual frame buffer
else
export DISPLAY="{{ localdev_xvfb_display }}"
fi
# Default to the code repository
cd "{{ item.home }}/{{ item.repo }}"
......@@ -15,6 +15,9 @@ localdev_accounts:
- { user: "{{ ora_user }}", home: "{{ ora_app_dir }}",
env: "ora_env", repo: "ora" }
- { user: "{{ notifier_user }}", home: "{{ notifier_app_dir }}",
env: "notifier_env", repo: "" }
# Helpful system packages for local dev
local_dev_pkgs:
......
......@@ -2,6 +2,20 @@
# {{ ansible_managed }}
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -Al'
alias la='ls -A'
source "{{ item.home }}/{{ item.env }}"
# If X11 forwarding is enabled, then use the DISPLAY value
......
---
NOTIFIER_USER: "notifier"
NOTIFIER_WEB_USER: "www-data"
NOTIFIER_HOME: "{{ COMMON_APP_DIR }}/notifier"
NOTIFIER_VENV_DIR: "{{ NOTIFIER_HOME }}/virtualenvs/notifier"
NOTIFIER_DB_DIR: "{{ NOTIFIER_HOME }}/db"
NOTIFIER_VENV_DIR: "{{ notifier_app_dir }}/virtualenvs/notifier"
NOTIFIER_DB_DIR: "{{ notifier_app_dir }}/db"
NOTIFIER_SOURCE_REPO: "https://github.com/edx/notifier.git"
NOTIFIER_CODE_DIR: "{{ NOTIFIER_HOME }}/src"
NOTIFIER_CODE_DIR: "{{ notifier_app_dir }}/src"
NOTIFIER_VERSION: "master"
NOTIFIER_REQUIREMENTS_FILE: "{{ NOTIFIER_CODE_DIR }}/requirements.txt"
NOTIFIER_LOG_LEVEL: "INFO"
......@@ -20,7 +17,7 @@ NOTIFIER_THEME_REPO: ""
NOTIFIER_THEME_VERSION: "master"
notifier_git_ssh: "/tmp/notifier_git_ssh.sh"
NOTIFIER_GIT_IDENTITY: ""
notifier_git_identity: "{{ NOTIFIER_HOME }}/notifier-git-identity"
notifier_git_identity: "{{ notifier_app_dir }}/notifier-git-identity"
NOTIFIER_DIGEST_EMAIL_SENDER: "notifications@example.com"
NOTIFIER_DIGEST_EMAIL_SUBJECT: "Daily Discussion Digest"
......@@ -46,8 +43,8 @@ NOTIFIER_EMAIL_REWRITE_RECIPIENT: ""
NOTIFIER_LMS_URL_BASE: "http://localhost:8000"
NOTIFIER_LMS_SECRET_KEY: "PUT_YOUR_SECRET_KEY_HERE"
NOTIFIER_COMMENT_SERVICE_BASE: "http://localhost:4567"
NOTIFIER_COMMENT_SERVICE_API_KEY: "PUT_YOUR_API_KEY_HERE"
NOTIFIER_COMMENT_SERVICE_BASE: "http://localhost:18080"
NOTIFIER_COMMENT_SERVICE_API_KEY: "password"
NOTIFIER_USER_SERVICE_BASE: "http://localhost:8000"
NOTIFIER_USER_SERVICE_API_KEY: "PUT_YOUR_API_KEY_HERE"
......@@ -61,6 +58,10 @@ NOTIFER_REQUESTS_CA_BUNDLE: "/etc/ssl/certs/ca-certificates.crt"
NOTIFIER_DD_API_KEY: "NOT_USED" # data dog
notifier_app_dir: "{{ COMMON_APP_DIR }}/notifier"
notifier_user: "notifier"
notifier_debian_pkgs:
- apparmor-utils
- build-essential
......
......@@ -6,7 +6,7 @@
version={{ NOTIFIER_VERSION }}
accept_hostkey=yes
sudo: true
sudo_user: "{{ NOTIFIER_USER }}"
sudo_user: "{{ notifier_user }}"
notify:
- restart notifier-scheduler
- restart notifier-celery-workers
......@@ -15,19 +15,19 @@
- name: create ssh script for git (not authenticated)
template: >
src=git_ssh_noauth.sh.j2 dest={{ notifier_git_ssh }}
owner={{ NOTIFIER_USER }} mode=750
owner={{ notifier_user }} mode=750
when: NOTIFIER_GIT_IDENTITY == ""
- name: create ssh script for git (authenticated)
template: >
src=git_ssh_auth.sh.j2 dest={{ notifier_git_ssh }}
owner={{ NOTIFIER_USER }} mode=750
owner={{ notifier_user }} mode=750
when: NOTIFIER_GIT_IDENTITY != ""
- name: install read-only ssh key
copy: >
content="{{ NOTIFIER_GIT_IDENTITY }}" dest={{ notifier_git_identity }}
force=yes owner={{ NOTIFIER_USER }} mode=0600
force=yes owner={{ notifier_user }} mode=0600
when: NOTIFIER_GIT_IDENTITY != ""
- name: checkout theme
......@@ -37,7 +37,7 @@
version={{ NOTIFIER_THEME_VERSION }}
accept_hostkey=yes
when: NOTIFIER_THEME_NAME != ''
sudo_user: "{{ NOTIFIER_USER }}"
sudo_user: "{{ notifier_user }}"
environment:
GIT_SSH: "{{ notifier_git_ssh }}"
......@@ -59,7 +59,7 @@
requirements="{{ NOTIFIER_REQUIREMENTS_FILE }}"
virtualenv="{{ NOTIFIER_VENV_DIR }}" state=present
sudo: true
sudo_user: "{{ NOTIFIER_USER }}"
sudo_user: "{{ notifier_user }}"
notify:
- restart notifier-scheduler
- restart notifier-celery-workers
......@@ -69,7 +69,7 @@
# place with proper perms first.
- name: fix permissions on notifer db file
file: >
path={{ NOTIFIER_DB_DIR }}/notifier.db state=touch owner={{ NOTIFIER_USER }} group={{ NOTIFIER_WEB_USER }}
path={{ NOTIFIER_DB_DIR }}/notifier.db state=touch owner={{ notifier_user }} group={{ NOTIFIER_WEB_USER }}
mode=0664
sudo: true
notify:
......@@ -82,7 +82,7 @@
shell: >
cd {{ NOTIFIER_CODE_DIR }} && {{ NOTIFIER_VENV_DIR }}/bin/python manage.py syncdb
sudo: true
sudo_user: "{{ NOTIFIER_USER }}"
sudo_user: "{{ notifier_user }}"
environment: notifier_env_vars
notify:
- restart notifier-scheduler
......
......@@ -43,52 +43,58 @@
- name: update ca certs globally
shell: update-ca-certificates
- name: create notifier user {{ NOTIFIER_USER }}
user:
name={{ NOTIFIER_USER }} state=present shell=/bin/bash
home={{ NOTIFIER_HOME }} createhome=yes
- name: create notifier user {{ notifier_user }}
user: >
name="{{ notifier_user }}" state=present shell=/bin/false
home="{{ notifier_app_dir }}" createhome=no
- name: create notifier app dir
file: >
path="{{ notifier_app_dir }}" state=directory
owner="{{ notifier_user }}" group="{{ common_web_group }}"
notify: [restart notifier-scheduler, restart notifier-celery-workers]
- name: setup the notifier env
template:
src=notifier_env.j2 dest={{ NOTIFIER_HOME }}/notifier_env
owner="{{ NOTIFIER_USER }}" group="{{ NOTIFIER_USER }}"
src=notifier_env.j2 dest={{ notifier_app_dir }}/notifier_env
owner="{{ notifier_user }}" group="{{ notifier_user }}"
mode=655
- name: drop a bash_profile
copy: >
src=../../common/files/bash_profile
dest={{ NOTIFIER_HOME }}/.bash_profile
owner={{ NOTIFIER_USER }}
group={{ NOTIFIER_USER }}
dest={{ notifier_app_dir }}/.bash_profile
owner={{ notifier_user }}
group={{ notifier_user }}
- name: ensure .bashrc exists
shell: touch {{ NOTIFIER_HOME }}/.bashrc
shell: touch {{ notifier_app_dir }}/.bashrc
sudo: true
sudo_user: "{{ NOTIFIER_USER }}"
sudo_user: "{{ notifier_user }}"
- name: add source of notifier_env to .bashrc
lineinfile:
dest={{ NOTIFIER_HOME }}/.bashrc
regexp='. {{ NOTIFIER_HOME }}/notifier_env'
line='. {{ NOTIFIER_HOME }}/notifier_env'
dest={{ notifier_app_dir }}/.bashrc
regexp='. {{ notifier_app_dir }}/notifier_env'
line='. {{ notifier_app_dir }}/notifier_env'
- name: add source venv to .bashrc
lineinfile:
dest={{ NOTIFIER_HOME }}/.bashrc
dest={{ notifier_app_dir }}/.bashrc
regexp='. {{ NOTIFIER_VENV_DIR }}/bin/activate'
line='. {{ NOTIFIER_VENV_DIR }}/bin/activate'
- name: create notifier DB directory
file:
path="{{ NOTIFIER_DB_DIR }}" mode=2775 state=directory owner={{ NOTIFIER_USER }} group={{ NOTIFIER_WEB_USER }}
path="{{ NOTIFIER_DB_DIR }}" mode=2775 state=directory owner={{ notifier_user }} group={{ NOTIFIER_WEB_USER }}
- name: create notifier/bin directory
file:
path="{{ NOTIFIER_HOME }}/bin" mode=2775 state=directory owner={{ NOTIFIER_USER }} group={{ NOTIFIER_USER }}
path="{{ notifier_app_dir }}/bin" mode=2775 state=directory owner={{ notifier_user }} group={{ notifier_user }}
- name: create notifier/.ssh directory
file:
path="{{ NOTIFIER_HOME }}/.ssh" mode=2700 state=directory owner={{ NOTIFIER_USER }} group={{ NOTIFIER_USER }}
path="{{ notifier_app_dir }}/.ssh" mode=2700 state=directory owner={{ notifier_user }} group={{ notifier_user }}
- name: create service log dir
file: >
......@@ -98,20 +104,20 @@
group="syslog"
with_items:
- "{{ COMMON_LOG_DIR }}/notifier"
- name: write supervisord wrapper for celery workers
template: >
src=notifier-celery-workers-supervisor.sh.j2
dest="{{ NOTIFIER_HOME }}/notifier-celery-workers-supervisor.sh"
dest="{{ notifier_app_dir }}/notifier-celery-workers-supervisor.sh"
mode=0775
sudo_user: "{{ NOTIFIER_USER }}"
sudo_user: "{{ notifier_user }}"
- name: write supervisord wrapper for scheduler
template: >
src=notifier-scheduler-supervisor.sh.j2
dest="{{ NOTIFIER_HOME }}/notifier-scheduler-supervisor.sh"
dest="{{ notifier_app_dir }}/notifier-scheduler-supervisor.sh"
mode=0775
sudo_user: "{{ NOTIFIER_USER }}"
sudo_user: "{{ notifier_user }}"
- name: write supervisord config for celery workers
template: >
......
......@@ -3,7 +3,7 @@
;
[program:notifier-celery-workers]
command={{ NOTIFIER_HOME }}/notifier-celery-workers-supervisor.sh
command={{ notifier_app_dir }}/notifier-celery-workers-supervisor.sh
process_name=%(program_name)s
numprocs=1
......
......@@ -3,7 +3,7 @@
;
[program:notifier-scheduler]
command={{ NOTIFIER_HOME }}/notifier-scheduler-supervisor.sh
command={{ notifier_app_dir }}/notifier-scheduler-supervisor.sh
process_name=%(program_name)s
numprocs=1
......
#!/bin/bash
source {{ NOTIFIER_HOME }}/notifier_env
source {{ notifier_app_dir }}/notifier_env
cd {{ NOTIFIER_CODE_DIR }}
export PID='/var/tmp/notifier-scheduler.pid'
......
#!/bin/bash
source {{ NOTIFIER_HOME }}/notifier_env
source {{ notifier_app_dir }}/notifier_env
cd {{ NOTIFIER_CODE_DIR }}
export PID='/var/tmp/notifier-celery-workers.pid'
......
......@@ -22,6 +22,8 @@
- oraclejdk
- elasticsearch
- forum
- role: notifier
NOTIFIER_DIGEST_TASK_INTERVAL: "5"
- role: ora
when: ENABLE_LEGACY_ORA
- browsers
......
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