官术网_书友最值得收藏!

Email configuration

Redash uses email as part of user management (password reset and so on) and as a destination for alerts to be received at.

After your first setup, when you log in to Redash, you will see the following notification telling you that your email has not yet been configured, which means that you can't enjoy all the features of Redash:

The email configuration resides inside an env file.

We can use the find or locate Linux command to find where exactly the env file resides on our machine.

By default (in case you used setup.sh based installation), it's located at /opt/redash/env.

In the bitnami installation for example, the file is located at /opt/bitnami/apps/redash/htdocs/env) (in other installations, you can always search for the env file if you're not sure where is it located).

Inside the env file, lots of values have defaults (localhost, for example), so in case you have postfix (or some other email server) running on the same host as Redash, you can leave the configuration settings as is. Otherwise, you will have to alter the following settings (inside the env file):

# Note that not all values are required, as they have default values
export REDASH_MAIL_SERVER="" # default: localhost
export REDASH_MAIL_PORT="" # default: 25
export REDASH_MAIL_USE_TLS="" # default: false
export REDASH_MAIL_USE_SSL="" # default: false
export REDASH_MAIL_USERNAME="" # default: None
export REDASH_MAIL_PASSWORD="" # default: None
export REDASH_MAIL_DEFAULT_SENDER="" # Email address to send from
export REDASH_HOST="" # base address of your Redash instance, for example: "https://demo.redash.io"

Once you have updated the configuration, restart all services with docker-compose up -d. If you are using a bitnami image and you want to restart all the services, you will have to use the following code:

sudo /opt/bitnami/ctlscript.sh restart

The output should show you what services were restarted and whether they went up normally.

In the following command output (since we executed a restart), we can see the shutdown of all the services (with the order being preserved), and the startup right after (in reverse order):

Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd stopped
/opt/bitnami/apps/redash/scripts/ctl_redash_gunicorn.sh : gunicorn stopped
/opt/bitnami/apps/redash/scripts/ctl_redash_celery_worker.sh : redash-celery stopped
/opt/bitnami/apps/redash/scripts/ctl_redash_celery_scheduled.sh : redash_celery_scheduled stopped
/opt/bitnami/redis/scripts/ctl.sh : redis stopped
waiting for server to shut down.... done
server stopped
/opt/bitnami/postgresql/scripts/ctl.sh : postgresql stopped
waiting for server to start.... done
server started
/opt/bitnami/postgresql/scripts/ctl.sh : postgresql started at port 5432
/opt/bitnami/redis/scripts/ctl.sh : redis started at port 6379
/opt/bitnami/apps/redash/scripts/ctl_redash_gunicorn.sh : gunicorn started
/opt/bitnami/apps/redash/scripts/ctl_redash_celery_worker.sh : redash_celery_worker started
/opt/bitnami/apps/redash/scripts/ctl_redash_celery_scheduled.sh : redash_celery_scheduled started
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd started at port 80

root@ip-10-69-10-45:/home/bitnami#
Not all of the values are required, as most of them have defaults.
It is recommended that you use email services that can ensure delivery (for production or mission critical tasks), for example, SES, Mailgun, or Google email services.

To test the email configuration setting, you can run the following from your command line (from /opt/redash/):

docker-compose run --rm server manage send_test_mail

For example, for bitnami installation, the command will be as follows:

/opt/bitnami/apps/redash/htdocs# ./bin/run /opt/bitnami/apps/redash/htdocs/manage.py send_test_email

When you run Send Email from the UI, it will look like this (1 press the send email button, 2 you should see a notification that the email was sent):

If you didn't get an email after this, the wisest place to look for clues is the logs:

$REDASH_INSTALLATION_PATH/logs/redash_celery_worker.log
Once again, note that in different installations, the log location might differ. However, the log name stays the same, so you can always search for it.

Here, we can see a real example of an unauthorized email sending attempt, with incorrect credentials:

[2018-06-24 21:46:09,096][PID:2114][WARNING][MainProcess] celery@ip-10-69-10-45 ready.
[2018-06-24 21:46:10,690][PID:2147][ERROR][Worker-2] task_name=redash.tasks.send_mail taks_id=adc52790-4e09-4ced-ab6e-375689db3676 Failed sending message: Reset your password
Traceback (most recent call last):
File "/opt/bitnami/apps/redash/htdocs/redash/tasks/general.py", line 57, in send_mail
mail.send(message)
File "/opt/bitnami/apps/redash/htdocs/venv/lib/python2.7/site-packages/flask_mail.py", line 492, in send
message.send(connection)
File "/opt/bitnami/apps/redash/htdocs/venv/lib/python2.7/site-packages/flask_mail.py", line 427, in send
connection.send(self)
File "/opt/bitnami/apps/redash/htdocs/venv/lib/python2.7/site-packages/flask_mail.py", line 192, in send
message.rcpt_options)
File "/opt/bitnami/python/lib/python2.7/smtplib.py", line 737, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
SMTPSenderRefused: (530, '5.5.1 Authentication Required. Learn more at\n5.5.1 https://support.google.com/mail/?p=WantAuthError m14-v6sbj2132487123dslkj.88 - gsmtp', u'neo.andersson@gmail.com')
主站蜘蛛池模板: 漳浦县| 宁波市| 黑龙江省| 永泰县| 枞阳县| 河津市| 施秉县| 龙游县| 措勤县| 常山县| 临桂县| 桃园县| 浦北县| 西丰县| 八宿县| 安徽省| 德江县| 锡林浩特市| 晋宁县| 健康| 安平县| 德惠市| 金华市| 浦城县| 仁化县| 大英县| 筠连县| 蒙山县| 博爱县| 科尔| 碌曲县| 齐河县| 涡阳县| 沛县| 大港区| 子洲县| 石景山区| 衡阳县| 叶城县| 赫章县| 盱眙县|