This project intends to do 4 key goals:
- Query MongoDB through Apache Superset 2.0.1
- Create an embedded dashboard and a demonstration how to do it by a React App
- Build full project by a simple and reusable docker-compose file so that quick start a Superset instance and Trino
- Enable Celery worker for SQLLab and turn on the Global Async Query so that optimize performance for Dashboard loading
- Clone current repository
git clone https://github.com/zhaoyongjie/superset-containerization.git
- Edit
mongodb.connection-url
indocker/mongodb.properties
, fills up corresponding mongodb URI. - Startup Superset via docker-compose, notice that 1)There are some environment variables to declare in the
docker/.env-non-dev
. 2) the filesuperset_home/superset_config.py
will override theconfig.py
and read Database and Redis config from thedocker/.env-non-dev
.cd superset-containerization docker compose up -d
- Use account
admin
/admin
to login Superset. - Create a new Database in Superset, the SQLAlchemy URI is
trino://admin@trino:8080/mongodb
. - Add a
Gamma
role toadmin
user. - Generate Embedded dashboard uuid. Click
embed dashboard
on the three dots in a dashboard. Notice thatAllowed Domains
in theembed
model could leave empty first. - Get
guest_token
for embedded dashboard. To make it easier to generate http requests, we use thehttpie
to request# request a JWT token for admin user echo '{"password": "admin", "username": "admin", "provider": "db"}' | http post http://localhost:8088/api/v1/security/login # request a guest token for embedded dashboard echo '{"user": {"username": "admin"}, "resources": [{"type": "dashboard", "id": "<fill up a dashboard id>"}], "rls": []}' | http post http://localhost:8088/api/v1/security/guest_token/ -A bearer -a "<fill up JWT token from previous step>"
- fill
embedded uuid
andguest token
inembedded_superset/src/App.jsx
- run
npm i
inembedded_superset
- run
npm run build
inembedded_superset
- open a http server in
embedded_superset/dist
cd embedded_superset/dist python3 -m http.server 5000
- open a browser and explore
localhost:5000
, the embedded dashboard should be showed.