Mail Configuration With Docker Deployment


#1

I have been having issues getting the email notification configured and working with the docker container. The instructions are unclear in the setup guide about the .env location for docker container. Same issue as this one.

I worked around this by adding the environment variables to the docker-compose.yml file, which seemed to work except when I try to send an email it gives me this error.

indent preformatted text by 4 spaces
worker_1    | [2017-08-29 20:42:51,672: ERROR/Worker-29] redash.tasks.send_mail[258a70b0-47ac-4045-8fd6-
da1305703e79]: Failed sending message: Reset your password
worker_1    | Traceback (most recent call last):
worker_1    |   File "/app/redash/tasks/general.py", line 57, in send_mail
worker_1    |     mail.send(message)
worker_1    |   File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 491, in send
worker_1    |     with self.connect() as connection:
worker_1    |   File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 144, in __enter__
worker_1    |     self.host = self.configure_host()
worker_1    |   File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 158, in configure_host
worker_1    |     host = smtplib.SMTP(self.mail.server, self.mail.port)
worker_1    |   File "/usr/lib/python2.7/smtplib.py", line 256, in __init__
worker_1    |     (code, msg) = self.connect(host, port)
worker_1    |   File "/usr/lib/python2.7/smtplib.py", line 316, in connect
worker_1    |     self.sock = self._get_socket(host, port, self.timeout)
worker_1    |   File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket
worker_1    |     return socket.create_connection((host, port), timeout)
worker_1    |   File "/usr/lib/python2.7/socket.py", line 575, in create_connection
worker_1    |     raise err
worker_1    | error: [Errno 101] Network is unreachable
worker_1    | [2017-08-29 20:42:51,675: INFO/MainProcess] Task redash.tasks.send_mail[258a70b0-47ac-4045-8fd6-
da1305703e79] succeeded in 0.00438050896628s: None

I suspect this is actually something to do with my network configuration. However, I am having difficulties locating the specific problem. Any suggestions on what I should look at relating to this issue? Also, is it possible to run ./manage.py functions when running redash through a container?

Thanks!


#2

Hi,

Also, is it possible to run ./manage.py functions when running redash through a container?

yes, if it works the same for as for me: just docker exec -it containername bash into the container, you end up in a directory /app, where the manage.py is located, so you can e.g. ./manage.py send_test_mail <recipient@....>

I get the same error messages as you do (running redash in a container) when I e.g. request a password reset email via the web interface. However, when I send the mail from the CLI ./manage.py send_test_mail <recipient@....> it works. Can you check if that’s also the case for you?