From 566afeec5bf312973a9c0bfecc39fd310e1ee425 Mon Sep 17 00:00:00 2001 From: Alexander Mancevice Date: Fri, 11 Nov 2016 07:59:22 -0500 Subject: [PATCH] superset fixes --- Dockerfile | 6 ++++-- README.md | 4 ++-- docker-compose.yml | 35 +++++++++++++++++++++++++++++++++++ superset/superset_config.py | 9 +++++---- 4 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 67de038e8..09a97d423 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,14 +20,16 @@ RUN apk add --no-cache \ ENV LANG=C.UTF-8 \ LC_ALL=C.UTF-8 \ PATH=$PATH:/home/superset/.bin \ - PYTHONPATH=/home/superset/superset_config.py:$PYTHONPATH + PYTHONPATH=/home/superset/superset_config.py:$PYTHONPATH \ + SQLALCHEMY_DATABASE_URI=sqlite:////home/superset/.superset/superset.db # Run as superset user WORKDIR /home/superset COPY superset . RUN addgroup superset && \ adduser -h /home/superset -G superset -D superset && \ - mkdir /home/superset/db && \ + mkdir /home/superset/.superset && \ + touch /home/superset/.superset/superset.db && \ chown -R superset:superset /home/superset USER superset diff --git a/README.md b/README.md index 49598206f..3a429a27d 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Docker image for [AirBnB's Superset](https://github.com/airbnb/superset). Run the superset demo by entering this command into your console: ```bash -docker run --name superset -d -p 8088:8088 amancevice/superset -docker exec -it superset demo +docker-compose up -d +docker-compose exec superset demo ``` You will be prompted to set up an admin user. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..485a6d857 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +version: '2' +services: + redis: + image: redis:alpine + restart: always + volumes: + - redis:/data + mysql: + image: mysql:5.7 + restart: always + environment: + MYSQL_ROOT_PASSWORD: superset + MYSQL_DATABASE: superset + MYSQL_USER: superset + MYSQL_PASSWORD: superset + volumes: + - mysql:/var/lib/mysql + superset: + build: . + image: amancevice/superset + restart: always + depends_on: + - mysql + - redis + environment: + SECRET_KEY: thisISaSECRET_1234 + SQLALCHEMY_DATABASE_URI: mysql://superset:superset@mysql:3306/superset + CACHE_CONFIG: "{\"CACHE_TYPE\": \"redis\", \"CACHE_DEFAULT_TIMEOUT\": 300, \"CACHE_KEY_PREFIX\": \"caravel_\", \"CACHE_REDIS_HOST\": \"redis\", \"CACHE_REDIS_PORT\": 6379, \"CACHE_REDIS_DB\": 1, \"CACHE_REDIS_URL\": \"redis://redis:6379/1\"}" + ports: + - "8888:8088" +volumes: + mysql: + external: false + redis: + external: false diff --git a/superset/superset_config.py b/superset/superset_config.py index 5fcad0846..8cd89f9e7 100644 --- a/superset/superset_config.py +++ b/superset/superset_config.py @@ -7,7 +7,7 @@ ROW_LIMIT = int(os.getenv("ROW_LIMIT", 5000)) WEBSERVER_THREADS = int(os.getenv("WEBSERVER_THREADS", 8)) -CARAVEL_WEBSERVER_PORT = int(os.getenv("CARAVEL_WEBSERVER_PORT", 8088)) +SUPERSET_WEBSERVER_PORT = int(os.getenv("SUPERSET_WEBSERVER_PORT", 8088)) # --------------------------------------------------------- # --------------------------------------------------------- @@ -18,7 +18,8 @@ # The SQLAlchemy connection string. SQLALCHEMY_DATABASE_URI = os.getenv( - "SQLALCHEMY_DATABASE_URI", "sqlite:////home/caravel/.caravel/caravel.db") + "SQLALCHEMY_DATABASE_URI", + "sqlite:////home/superset/.superset/superset.db") # Flask-WTF flag for CSRF CSRF_ENABLED = os.getenv("CSRF_ENABLED", "1") in ("True", "true", "1") @@ -34,8 +35,8 @@ except ValueError: CACHE_CONFIG = {} -# Import all the env variables prefixed with "CARAVEL_" -config_keys = [c for c in os.environ if c.startswith("CARAVEL_")] +# Import all the env variables prefixed with "SUPERSET_" +config_keys = [c for c in os.environ if c.startswith("SUPERSET_")] for key in config_keys: globals()[key[8:]] = os.environ[key]