Apache Superset – Production

So we want to use Superset in production.

There are a few steps to get you up and running; these are outlined on the main website under configuring Superset.

As you would expect, some of it is pretty vague.

The starting point is to pick one database to house all the configuration data. My choice is MariaDB. (MySQL is stated on the site). They recommend this goes on a separate server, but the installation is still the same; the config file will just have the hostname or IP address. So this is the guide.

apt install mysql-server mysql-client

Use this guide on the various command of MariaDB / MySQL etc. MariaDB Cheatsheet

These commands for this install, though, are

mysql
create database superset;
create user 'supersetadmin'@'%' identified by 'password321';
grant all on superset.* to 'supersetadmin'@'%' with grant option;

Did you notice the highly complicated password? No password cracker will ever work that one out.

You should have installed the MySQL connector from the previous post, but if Google brought you here for a reason, then read Apache Superset this will give you the insight on how to install all of the other bits needed.

We now have to change the config file; I love the instructions on the AuperSet site, just find the file and change it. The file in question is superset_config.py

This file does not exist, but config.py does exist, there is a relationship between these files. The superset_config.py file will be used first to determine the settings in question.

The main config.py file, if you have followed the paths in the instructions, is

/opt/superset/venv/lib/python3.8/site-packages/superset/config.py
cd /opt/superset/venv

Now create the file and use the details from above.

Setting the username and password can be found here https://flask-sqlalchemy.palletsprojects.com/en/2.x/config/

tee vi /opt/superset/venv/superset_config.py << EOF
SQLALCHEMY_DATABASE_URI = 'mysql://supersetadmin:password321@localhost/superset'
EOF

How to define what the config path is https://medium.com/codex/powerful-bi-tool-apache-superset-ba8e17a8549b

export SUPERSET_CONFIG_PATH=/opt/superset/venv/superset_config.py
export FLASK_APP=superset

superset db upgrade

ERROR

from werkzeug.wrappers.etag import ETagResponseMixin
ModuleNotFoundError: No module named ‘werkzeug.wrappers.etag’

pip3 uninstall werkzeug
pip3 uninstall flask

pip3 install flask==2.0.3 --no-warn-script-location
pip3 install werkzeug==2.0.3 --no-warn-script-location


superset db upgrade
superset fab create-admin
superset init

Now to start the server

superset run -p 8088 --with-threads --reload --debugger

You can bind the server to one of the addresses if you have more than one network card.

superset run -h IP-Address -p 8088 –with-threads –reload –debugger

Messages appear at startup

WARNING

A Default SECRET_KEY was detected, please use superset_config.py to override it.
Use a strong complex alphanumeric string and use a tool to help you generate
a sufficiently random sequence, ex: openssl rand -base64 42

ERRORS

If you see this error message on the console

GET /api/v1/dashboard/_info?q=(keys:!(permissions)) HTTP/1.1 superset#

You forgot to run

superset init

1 thought on “Apache Superset – Production”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s