Recently I started collecting some data (perhaps more on that later) and store it in the Postgres DB running on my webserver. While it is possible to compose and run queries using psql or DBeaver, I like data visualization and don't like to write code to create it, unless I really-really want to create something fancy - then D3 comes into play. This means I need some BI tooling. At work, we use Redash and Metabase, therefore, curious as I am, I decided to try out yet another option.

Apache Superset started its life at AirBnB, joined ASF in 2016 and graduated from the incubator in 2021, and version 2.0 appeared this summer. The look and feel is production-grade, and in fact there is a cloud offering, https://preset.io/, that comes with RBAC, SSO, and customer support.

The simplest option to install Superset is by using docker-compose. Hilariously, I had to tweak the YAML file (resolve anchors by hand) because my Debian server has docker-compose 1.21.0 installed, and compose format version 3.7 support appeared only in 1.22.0. One more piece of software that's nudging me to upgrade to Bullseye.

The most tricky bit is how to make Postgres running on the host available to the containers. Since they are running in 172.18.0.0/16 network, I did the following:

  • sudo firewall-cmd --zone=trusted --add-source=172.18.0.0/16 (also with --permanent flag to save the settings)
  • Set listen_addresses in postgresql.conf to 'localhost,172.18.0.1'
  • Added a line in pg_hba.conf ('trust' might not be the best choice though):
    host    all             all             172.18.0.1/16           trust
  • Restarted Postgres with systemctl

Of course, I don't expose Superset webserver port to the outside and port-forward it over SSH instead: ssh -L 8088:localhost:8088 -N -T artem@webserver

Superset provides a very helpful wizard for connecting to the DB, which highlights in red invalid host and port values, checking the connection in the background:

In the final step you can configure what subset of SQL should be available. For example, I enabled creating views and running EXPLAIN from the browser: