Compare commits

...

3 Commits

Author SHA1 Message Date
Danyal-Faheem
e31026fc9a fix: update superset port to 2247 2025-03-26 15:44:03 +05:00
Danyal-Faheem
0bcd5398dd fix: update webdriver configurations 2025-03-18 17:34:49 +05:00
Danyal-Faheem
5c1ebede74 feat: enable alerts and reports in superset
fixes #46
2025-02-14 21:32:35 +05:00
3 changed files with 44 additions and 10 deletions

View File

@ -0,0 +1 @@
- [Improvement] Enable Alerts and Reports in superset. (by @Danyal-Faheem)

View File

@ -128,7 +128,7 @@ AUTH_USER_REGISTRATION = True
class CeleryConfig: # pylint: disable=too-few-public-methods class CeleryConfig: # pylint: disable=too-few-public-methods
BROKER_URL = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}" BROKER_URL = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}"
CELERY_IMPORTS = ("superset.sql_lab", "superset.tasks") CELERY_IMPORTS = ("superset.sql_lab", "superset.tasks","superset.tasks.thumbnails",)
CELERYD_LOG_LEVEL = "DEBUG" CELERYD_LOG_LEVEL = "DEBUG"
CELERYD_PREFETCH_MULTIPLIER = 1 CELERYD_PREFETCH_MULTIPLIER = 1
CELERY_ACKS_LATE = False CELERY_ACKS_LATE = False
@ -142,10 +142,6 @@ class CeleryConfig: # pylint: disable=too-few-public-methods
}, },
} }
CELERYBEAT_SCHEDULE = { CELERYBEAT_SCHEDULE = {
"email_reports.schedule_hourly": {
"task": "email_reports.schedule_hourly",
"schedule": crontab(minute=1, hour="*"),
},
"reports.scheduler": { "reports.scheduler": {
"task": "reports.scheduler", "task": "reports.scheduler",
"schedule": crontab(minute="*", hour="*"), "schedule": crontab(minute="*", hour="*"),
@ -159,13 +155,32 @@ class CeleryConfig: # pylint: disable=too-few-public-methods
CELERY_CONFIG = CeleryConfig CELERY_CONFIG = CeleryConfig
# Email configuration
SMTP_HOST = "{{ SMTP_HOST }}"
SMTP_PORT = {{ SMTP_PORT }}
SMTP_STARTTLS = {{ SMTP_USE_TLS }}
SMTP_SSL = {{ SMTP_USE_SSL }}
SMTP_USER = "{{ SMTP_USERNAME }}" # use the empty string "" if using an unauthenticated SMTP server
SMTP_PASSWORD = "{{ SMTP_PASSWORD }}" # use the empty string "" if using an unauthenticated SMTP server
SMTP_MAIL_FROM = "{{ CONTACT_EMAIL }}"
EMAIL_REPORTS_SUBJECT_PREFIX = "[{{ PLATFORM_NAME }}] "
ALERT_REPORTS_NOTIFICATION_DRY_RUN = False
WEBDRIVER_BASEURL = "http://cairn-superset:2247/"
# The base URL for the email report hyperlinks.
WEBDRIVER_BASEURL_USER_FRIENDLY = "{{ CAIRN_HOST }}"
# Avoid duplicate logging because of propagation to root logger # Avoid duplicate logging because of propagation to root logger
logging.getLogger("superset").propagate = False logging.getLogger("superset").propagate = False
# https://github.com/apache/superset/blob/master/RESOURCES/FEATURE_FLAGS.md # https://github.com/apache/superset/blob/master/RESOURCES/FEATURE_FLAGS.md
FEATURE_FLAGS = { FEATURE_FLAGS = {
# Enable dashboard embedding # Enable dashboard embedding
"EMBEDDED_SUPERSET": True "EMBEDDED_SUPERSET": True,
# This feature is stable but known to have bugs from time to time
# Alerts and Reports also do not work on arm64 base images
"ALERT_REPORTS": True,
} }
ENABLE_CORS=True ENABLE_CORS=True

View File

@ -7,16 +7,34 @@ FROM docker.io/apache/superset:4.0.0
USER root USER root
# https://github.com/apache/superset/blob/4.0.0/Dockerfile#L109-L110
# Extracted from https://superset.apache.org/docs/installation/alerts-reports/#custom-dockerfile
ARG GECKODRIVER_VERSION=v0.33.0 \
FIREFOX_VERSION=117.0.1
RUN apt-get update -qq \
&& apt-get install -yqq --no-install-recommends \
libnss3 \
libdbus-glib-1-2 \
libgtk-3-0 \
libx11-xcb1 \
libasound2 \
libxtst6 \
wget \
pkg-config \
# Install GeckoDriver WebDriver
&& wget -q https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz -O - | tar xfz - -C /usr/local/bin \
# Install Firefox
&& wget -q https://download-installer.cdn.mozilla.net/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/firefox-${FIREFOX_VERSION}.tar.bz2 -O - | tar xfj - -C /opt \
&& ln -s /opt/firefox/firefox /usr/local/bin/firefox \
&& apt-get autoremove -yqq --purge wget && rm -rf /var/[log,tmp]/* /tmp/* /var/lib/apt/lists/*
# https://pypi.org/project/clickhouse-driver/ # https://pypi.org/project/clickhouse-driver/
# https://pypi.org/project/mysqlclient/ # https://pypi.org/project/mysqlclient/
# https://pypi.org/project/clickhouse-connect/ # https://pypi.org/project/clickhouse-connect/
# https://pypi.org/project/clickhouse-sqlalchemy/ # https://pypi.org/project/clickhouse-sqlalchemy/
# https://pypi.org/project/Authlib/ # https://pypi.org/project/Authlib/
# We preserve the clickhouse-sqlalchemy package to keep backward compatibility with existing dashboards # We preserve the clickhouse-sqlalchemy package to keep backward compatibility with existing dashboards
RUN apt-get update \
&& apt-get install -y \
pkg-config
RUN --mount=type=cache,target=/root/.cache/pip,sharing=shared pip install \ RUN --mount=type=cache,target=/root/.cache/pip,sharing=shared pip install \
clickhouse-driver==0.2.7 \ clickhouse-driver==0.2.7 \
mysqlclient==2.2.4 \ mysqlclient==2.2.4 \