Code Monkey home page Code Monkey logo

docker-superset's Introduction

Superset

An extendable Docker image for Airbnb's Superset platform.

Basic Setup

By default the Superset meta database will be stored in a local sqlite database, in the most basic case getting a working Superset instance up and running is as simple as:

docker run -d --name superset -p 8088:8088 tylerfowler/superset

The entrypoint script will set up an admin user for you using the ADMIN_* environment variables, with a default username and password of:

username: admin
password: superset

Modifying Admin Credentials

The admin user is created in the entrypoint script using the ADMIN_* environment variables in the Dockerfile, which should be overriden.

docker run -d --name superset \
  -e ADMIN_USERNAME=myadminuser \
  -e ADMIN_FIRST_NAME=Some \
  -e ADMIN_LAST_NAME=Name \
  -e [email protected] \
  -e ADMIN_PWD=mypassword \
  -p 8088:8088 \
tylerfowler/superset

Modifying Database Backends

In order to keep the base image as lean as possible only the Postgres driver is included and any other database drivers or libraries that are needed should be installed in a downstream image. To use a different backend you just need to install the appropriate drivers and modify the $SUP_META_DB_URI to be the database connection string for the backend, which is only used in the entrypoint script at runtime.

Modifying the Superset Configuration

The Superset config file is generated dynamically in the entrypoint script using the SUP_* environment variables, for example to increase the row limit to 10000 and the number of webserver threads to 16:

docker run -d --name superset \
  -e SUP_ROW_LIMIT=10000 \
  -e SUP_WEBSERVER_THREADS=16 \
  -p 8088:8088 \
tylerfowler/superset

Advanced Configuration via Custom Entrypoint

In order to correctly set up Superset the entrypoint needs to be set the superset-init.sh script, though if a more advanced configuration is required you can also supply your own entrypoint script.

In your Dockerfile add any script as long as it ends up at /docker-entrypoint.sh. This script will be run after the initial superset_config.py is generated but before any of the Superset setup commands are ran. Note that the environment variables will still be used to bootstrap the Superset configuration file.

For example to add a Redis cache to your configuration:

#!/bin/bash

cat <<EOF >> $SUPERSET_HOME/superset_config.py
CACHE_CONFIG = {
  'CACHE_TYPE': 'RedisCache',
  'CACHE_REDIS_URL': 'localhost:6379'
}
EOF

After this is finished running Superset will continue to configure itself as normal. Alternately, if the init script detects that a superset-config.py file already exists under $SUPERSET_HOME then it will skip bootstrapping the file altogether and will use the user supplied config instead. Similarly after Superset is finished setting itself up (migrating the DB, initializing, creating admin user, etc...) it will write an empty file at $SUPERSET_HOME/.setup-complete so that subsequent runs on a mounted volume will not set up Superset from scratch. To take advantage of this fact simply mount the $SUPERSET_HOME directory (which is /superset by default).

docker run -d --name superset \
  -v /mysuperset:/superset \
  -p 8088:8088 \
tylerfowler/superset

Note, however, that even if an existing Superset configuration is detected, any user supplied docker-entrypoint.sh file will still be run. So if need be write a file that can be checked for to ensure your script only runs once in the same fashion that the superset-init.sh script does.

Enjoy!

docker-superset's People

Contributors

tylerfowler avatar youngwookim avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.