Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing MapBox Token when using Apache Superset with Docker

I've installed Apache Superset according to this official manual. I can create plots, connect to databases etc. without any problems, only if I want to plot latitude and longitude data with a mapbox or deck.gl plots, I get this warning and can't see any maps:

NO_TOKEN_WARNING For information on setting up your basemap, read Note on Map Tokens

I have a MapBox-Api-Key (lets say XXYYZZ) and followed instructions where I created a superset_config.py file in the home folder of the server where superset is running. This is the code I used:

Entries in .bashrc

export SUPERSET_HOME=/home/maximus/envs/superset/lib/python3.6/site-packages/superset export SUPERSET_CONFIG_PATH=$HOME/.superset/superset_config.py export PYTHONPATH=/home/maximus/envs/superset/bin/python:/home/maximus/.superset:$PYTHONPATH

Created superset_confiy.py in .superset

path: $ ~/.superset/superset_config.py

with following code

#---------------------------------------------------------
# Superset specific config
#---------------------------------------------------------
ROW_LIMIT = 50000

MAPBOX_API_KEY = 'XXYYZZ'

As I'm using docker, I thought maybe I need to to the same within the main docker container of superset (superset_app) but it still does not work.

My server runs on Ubuntu 18.04 LTS. Anyone any ideas on how to solve this problem with docker, superset and mapbox?

like image 381
maximusKarlson Avatar asked May 23 '26 07:05

maximusKarlson


2 Answers

I solved the problem by adding my mapbox token (XXYYZZ) to the docker environment file which is used by docker-compose.

This is what I did in detail:

  • As superset runs on my server I connected via ssh
  • Stop superset with docker-compose down
  • cd into the docker folder within the folder where the docker-compose files is --> cd superset/docker
  • I was running the non-dev version with docker-compose, therefore I opened the .env-non-dev file with nano. If you run the "normal" version just edit the .env file instead.

Comment: I'm not sure if this is the supposed way, but apparently you can edit the environmental parameters.

  • I added my Mapbox Key (MAPBOX_API_KEY = "XXYYZZ")
  • Finally just start superset again with docker-compose -f docker-compose-non-dev.yml up -d or docker-compose -f docker-compose.yml up -d respectively.

Thats all, I can now see the maps when opening the deck.gl sample dashboard.

like image 64
maximusKarlson Avatar answered May 25 '26 20:05

maximusKarlson


The documentation and a youtube video tutorial seem outdated. For the most recent release: clone the superset repo; add the MAPBOX_API_KEY to the superset/config.py or docker/pythonpath_dev/superset_config.py; then docker-compose up solved the problem

like image 42
L M Avatar answered May 25 '26 21:05

L M