Superset reporting

An environment can include Apache Superset (DEV-3477). Superset adds a reporting web application and dashboards that the portal embeds. This page explains how to select the stack, how to sign in, and what to do when a deploy shows a warning.

What the stack contains

The stack has seven services.

Service Role

superset

Superset web application and admin user interface.

superset-worker

Background worker for Superset tasks.

superset-beat

Scheduler for Superset tasks.

superset-db

PostgreSQL database for Superset metadata.

superset-redis

Message broker and cache.

superset-nginx

HTTPS entry point for the Superset admin user interface.

superset-embed-proxy

HTTPS entry point that lets the portal show dashboards in a frame. You do not select it: the environment gets it when it has portals.

Superset needs a database, ClickHouse, and ftacs. It reads ACS data through reader accounts that the deploy creates.

Select the stack

Use the superset preset. The preset selects the portals stack and all seven Superset services.

Without the preset, tick the row superset stack [superset | superset-worker | …​]. The row stands for six services: superset, the worker, the scheduler (superset-beat), the metadata database, Redis and nginx. The environment still gets six separate services, so meta.json, the Compose file, ports and resources list them by name. On Update-Environment, an environment that has all six shows the row ticked.

The embed proxy is not on the service list, as in Deployment Manager. Create-Environment and Update-Environment add it whenever the environment has superset, portals and ui-backend, and remove it when one of them goes. An environment with Superset and without the portal has the Superset admin user interface only, and no embed proxy. The Port Preview, Resource Estimate and dependency graph count the proxy when it will be added.

The superset image has no preselected version. Choose a version in IMAGE_VERSIONS. The worker and the scheduler use the version that you choose for superset.

The presets full and with-ai do not include Superset.

Sign in as administrator

The administrator account is admin. The default password is admin. This is a known QA default.

The password is effective only at the first start of Superset. Superset creates the administrator once and never applies the password again. If you change SUPERSET_PASSWORD later, the portal sends the new password but the Superset account keeps the old one. Embedded dashboards then fail to sign in. To fix this, change the password of the admin user inside Superset to the same value, with the password function of Superset itself. The deploy code never changes an existing password, so no deploy step does this for you.

To use another password, change SUPERSET_PASSWORD for the superset service in SERVICE_VARIABLES before the first deploy. The password must not contain a single quote (') or a newline. If it does, the deploy stops with exit code 4 and a message that names the variable SUPERSET_PASSWORD. Choose another value and deploy again.

Anyone who can reach the admin port can sign in with the default login. SQL Lab in Superset can read all data that the reader accounts can read. This is the ACS and QoE data of the environment.

Ports

Port variable Default Use

SUPERSET_ADMIN_PORT

8094

HTTPS port of the Superset admin user interface (superset-nginx).

SUPERSET_PROXY_PORT

4443

HTTPS port of the embed proxy. The portal uses it to show dashboards.

The port allocator chooses the host ports. The deploy summary shows the final URLs. Use the fully qualified host name in the browser, not the short name. The embedded dashboards allow the portal origin with the fully qualified name only.

Secrets

The deploy generates these values once for each environment:

  • the Superset signing key

  • the Superset metadata database password

  • the reader passwords for MySQL, Oracle and ClickHouse

The values are stored in superset/.env.secrets in the environment directory on the controller (/var/jenkins_home/qa-data/envs/<env>). The deploy writes them into the Superset service files on the runner. They never appear in the root .env file or in the console.

  • Update keeps the file. A new deploy reuses the stored values.

  • Snapshots exclude the file. Backups made by Manage-Environment exclude it too.

The signing key must not change after the first start. Do not delete superset/.env.secrets from an environment that has already started. If you create the environment again, the deploy generates new secrets. The Superset metadata of the old environment is not reused.

Reader accounts and dashboard import

After all services are healthy, the deploy creates the reader accounts. The accounts have read-only access.

Database Reader account

MySQL

read

Oracle

SUPERSET_READ

ClickHouse

superset_read

The deploy runs this step on every deploy. When both the database reader and the ClickHouse reader exist, the deploy releases the dashboard import. The import starts in the background and takes a few minutes. The deploy does not wait for it. Dashboards appear in Superset after the import ends.

If a reader cannot be created, the import does not start. The deploy shows a warning and does not fail. Fix the cause and deploy again.

ClickHouse access management

Superset needs the ClickHouse account superset_read. The deploy creates it through the ClickHouse administrator account. This requires the following line in the root environment file of the environment. This is the file .env.<db> (.env.mysql or .env.oracle), the file that the GLOBAL_VARIABLES editor shows:

CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1

New environments contain this line. Environments created before DEV-3477 do not contain it. For such an environment, use one of these two ways:

  1. Add the line in GLOBAL_VARIABLES in Update-Environment, and deploy.

  2. Create the environment again.

On the next deploy, Docker recreates every container of the environment.

Warnings and manual steps

The deploy does not fail on these warnings.

Warning What to do

A portal dashboard id could not be set. The warning says the id was not found, is still empty after writing, or could not be read or written in UI Backend. It can also say that the file superset/dashboards/dashboard-ids.txt is missing.

In the portal, open Settings > System settings > Interface. For each named interface item, enter the embedded dashboard UUID. Each line of superset/dashboards/dashboard-ids.txt has three columns: the client (mc or sc), the interface item id, and the UUID.

Most shipped dashboards are built for MySQL and stay largely empty on Oracle.

None. This is expected on Oracle.

A table of the iotw schema is not there yet, or the environment has no iotw schema.

Deploy again after ui-backend has created the table. Until then the User Activity reports stay empty. On an environment without the schema they stay empty.

A reader could not be created. Dashboards were not imported.

Fix the cause and deploy again.

The import could not be released.

Deploy again.

Certificate

This section is about QA environments. In a QA environment, both proxies use a copy of the ui-backend certificate. The copy is in superset-nginx/ssl/. ui-backend also trusts this certificate in its own truststore. If you rotate the wildcard certificate, update both places.

An installation made with Deployment Manager uses different certificates. There, the embed proxy uses the portal’s certificate from portals/ssl/. The connection from the proxy to Superset uses a separate certificate from superset/ssl/. See The two hops.

Changes that do not reach an existing environment

An environment keeps its own copy of the Superset files from the moment you create it. A fix to the service files in the shared library does not reach an existing environment. You have two options:

  • Create the environment again.

  • Copy the changed files into the environment directory on the controller, and run Deploy-Environment with RESET_CONFIGS.

For developers

The code is in these files.

File Role

vars/supersetDeploy.groovy

Generates the secrets on the controller, aligns the worker and scheduler images, runs the two scripts on the runner.

resources/scripts/superset-env.sh

Writes the secrets into the Superset service files and into ui-backend/.env. Exit code 4 means a value holds a single quote or a newline.

resources/scripts/superset-post-deploy.sh

Creates the readers, releases the import, sets the dashboard ids. It always exits with 0.

resources/services/superset/SOURCE.md

Records the origin of the vendored files and the deliberate differences.

Compare the vendored files with the deployment catalogue when a new analytics/superset line is adopted for QA.