Superset Docker image that works on a Swarm stack deployment.
I want:
- to build a standard Docker image using only the apache/superset repo files.
- to publish the standard image on Docker Hub named computablefacts/superset-for-swarm
- to have a Swarm stack YAML file that use this image and works out of the box.
- to build my own custom Docker image to add database drivers or other specific stuff
- to publish the custom image on Docker Hub named computablefacts/superset-for-swarm-custom
Copy the swarm-stack.yaml
on your Docker Swarm manager and launch:
$ docker stack deploy --compose-file swarm-stack.yaml my-superset-stack
You can choose the superset image by changing:
x-superset-image: &superset-image computablefacts/superset-for-swarm:1.3.0
with another version
x-superset-image: &superset-image computablefacts/superset-for-swarm:1.3.2
or with our custom image
x-superset-image: &superset-image computablefacts/superset-for-swarm-custom:main
or with your custom image
x-superset-image: &superset-image my-user/my-custom-image:latest
You can test the Swarm stack locally. Clone this repo first and change the ports
setting
in the swarm-stack.yaml
file like this (uncomment the mode
key):
ports:
- target: 8088
published: 8088
protocol: tcp
# Uncomment below to test locally on http://localhost:8088/
mode: host
Start the stack with:
# Turn your local Docker on a Swarm
$ docker swarm init
# Launch the stack
$ docker stack deploy --compose-file swarm-stack.yaml my-local-superset-stack
Superset should be accessible on http://localhost:8088/
TODO: based on xxx-nodev.yaml but without any external dependencies (no external files needed). No superset_home volume shared among containers Celery workers should work
TODO
Checkout the apache/superset repo on the new version.
$ git clone git@github.com:apache/superset.git
$ git checkout 1.3.1
Copy the bash scripts from superset/docker
into this repo /docker
(6 bash scripts).
Copy the config file from superset/docker/pythonpath_dev/superset_config.py
into this
repo /docker/pythonpath/superset_config.py
.
Modify the superset_config.py to use Redis as the results backend.
##### Change from original file
#RESULTS_BACKEND = FileSystemCache("/app/superset_home/sqllab")
# Put results on Redis not on a file that is not shared among containers on the Swarm stack
from cachelib.redis import RedisCache
RESULTS_BACKEND = RedisCache(host=REDIS_HOST, port=REDIS_PORT, key_prefix='superset_results')
##### End of change
On Dockerfile
FROM apache/superset:1.3.1
On custom.dockerfile
FROM computablefacts/superset-for-swarm:1.3.1
On Swarm stack
x-superset-image: &superset-image computablefacts/superset-for-swarm:1.3.1
Commit your changes and push your commit.
Add a git tag with the new superset version
$ git tag -a 1.3.1 -m "From superset 1.3.1"
Push your tag:
$ git push origin 1.3.1