Enhance docs for email reporting (#8486)

* extend documentation about setting up email reporting

* mention EMAIL_REPORTS_USER
This commit is contained in:
Christoph Lingg 2019-10-31 06:37:13 +01:00 committed by Maxime Beauchemin
parent a8f1589dbf
commit 06a4108a7d
1 changed files with 47 additions and 7 deletions

View File

@ -963,24 +963,60 @@ Email Reports
-------------
Email reports allow users to schedule email reports for
* slice and dashboard visualization (Attachment or inline)
* slice data (CSV attachment on inline table)
* chart and dashboard visualization (Attachment or inline)
* chart data (CSV attachment on inline table)
**Setup**
Make sure you enable email reports in your configuration file
.. code-block:: python
ENABLE_SCHEDULED_EMAIL_REPORTS = True
Now you will find two new items in the navigation bar that allow you to schedule email
reports
* Manage -> Dashboard Emails
* Manage -> Chart Email Schedules
Schedules are defined in crontab format and each schedule
can have a list of recipients (all of them can receive a single mail,
or separate mails). For audit purposes, all outgoing mails can have a
mandatory bcc.
**Requirements**
In order get picked up you need to configure a celery worker and a celery beat
(see section above "Celery Tasks"). Your celery configuration also
needs an entry ``email_reports.schedule_hourly`` for ``CELERYBEAT_SCHEDULE``.
* A selenium compatible driver & headless browser
To send emails you need to configure SMTP settings in your configuration file. e.g.
.. code-block:: python
EMAIL_NOTIFICATIONS = True
SMTP_HOST = "email-smtp.eu-west-1.amazonaws.com"
SMTP_STARTTLS = True
SMTP_SSL = False
SMTP_USER = "smtp_username"
SMTP_PORT = 25
SMTP_PASSWORD = os.environ.get("SMTP_PASSWORD")
SMTP_MAIL_FROM = "insights@komoot.com"
To render dashboards you need to install a local browser on your superset instance
* `geckodriver <https://github.com/mozilla/geckodriver>`_ and Firefox is preferred
* `chromedriver <http://chromedriver.chromium.org/>`_ is a good option too
* Run `celery worker` and `celery beat` as follows ::
celery worker --app=superset.tasks.celery_app:app --pool=prefork -Ofair -c 4
celery beat --app=superset.tasks.celery_app:app
You need to adjust the ``EMAIL_REPORTS_WEBDRIVER`` accordingly in your configuration.
You also need to specify on behalf of which username to render the dashboards. In general
dashboards and charts are not accessible to unauthorized requests, that is why the
worker needs to take over credentials of an existing user to take a snapshot. ::
EMAIL_REPORTS_USER = 'username_with_permission_to_access_dashboards'
**Important notes**
@ -995,6 +1031,10 @@ mandatory bcc.
* It is recommended to run separate workers for ``sql_lab`` and
``email_reports`` tasks. Can be done by using ``queue`` field in ``CELERY_ANNOTATIONS``
* Adjust ``WEBDRIVER_BASEURL`` in your config if celery workers can't access superset via its
default value ``http://0.0.0.0:8080/`` (notice the port number 8080, many other setups use
port 8088).
SQL Lab
-------
SQL Lab is a powerful SQL IDE that works with all SQLAlchemy compatible