Skip to content
This repository has been archived by the owner on Nov 11, 2020. It is now read-only.

smtp is not picked up rather console is used (found in both settings.py and notifier_env) #55

Open
l1ph0x opened this issue Jul 7, 2018 · 2 comments

Comments

@l1ph0x
Copy link

l1ph0x commented Jul 7, 2018

This issue concerns Notifier on open-release/ginkgo.master. (Native install on Ubuntu Server 16.04).

I could not make Notifier work until I dig in the code and did a tiny change as follows

  1. In the env file
    nano /edx/app/notifier/notifier_env
    set the value
    export EMAIL_BACKEND="django.core.mail.backends.smtp.EmailBackend"

  2. In settings file
    nano /edx/app/notifier/src/notifier/settings.py
    erased the whole EMAIL_BACKEND block, and changed the value to
    EMAIL_BACKEND="django.core.mail.backends.smtp.EmailBackend"

@kirkerafael
Copy link

Just in case anyone else has the same problem, here's my take on it:
(Native install of open-release/ironwood.master)

The root of the problem is that notifier-celery-workers service is configured differently than notifier-scheduler-supervisor. Compare configuration files found in /edx/app/supervisor/conf.available.d/.

notifier-scheduler.conf fires a script /edx/app/notifier/notifier-scheduler-supervisor.sh, which in turn loads env file /edx/app/notifier/notifier_env.
notifier-celery-workers.conf on the other hand contains configuration as environment declaration, and runs bare-bones python manage.py celery worker -l INFO command.

Everything works more predictably if you delete the environment line from notifier-celery-workers.conf, replace command line with command=/edx/app/notifier/notifier-celery-workers.sh, and create script /edx/app/notifier/notifier-celery-workers.sh like so:

#!/bin/bash

source /edx/app/notifier/notifier_env
cd /edx/app/notifier/src

export PID='/var/tmp/notifier-scheduler.pid'
export LANG=en_US.UTF-8

/edx/app/notifier/virtualenvs/notifier/bin/python manage.py celery worker -l INFO

(to mirror the notifier-scheduler-supervisor.sh).
Then

sudo /edx/bin/supervisorctl reread
sudo /edx/bin/supervisorctl update

to reload your service and now EMAIL_BACKEND, and also US_API_KEY are read from notifier_env file.

@angonz
Copy link

angonz commented May 2, 2020

Great workaround!
Do you know how to fix it in configuration/ansible, for new installations?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants