Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable ssh tunneling using env variables for superset #60

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ services:
superset:
build:
context: ./superset/
args:
SUPERSET_PASSWORD: ${SUPERSET_PASSWORD:-password}
SUPERSET_ADMIN_EMAIL: ${SUPERSET_ADMIN_EMAIL:[email protected]}
environment:
- SUPERSET_PASSWORD=${SUPERSET_PASSWORD:-password}
- SUPERSET_ADMIN_EMAIL=${SUPERSET_ADMIN_EMAIL:[email protected]}
- SUPERSET_SSH_TUNNELING=${SUPERSET_SSH_TUNNELING}
ports:
- 8080:8088

Expand Down
1 change: 1 addition & 0 deletions env.template
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ COUCHDB_SECURE=false
# superset: required environment variables for 'gamma', 'prod' and 'local'
SUPERSET_PASSWORD=password
[email protected]
SUPERSET_SSH_TUNNELING=false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SUPERSET_SSH_TUNNELING=false
SUPERSET_SSH_TUNNELING=False

With this setting: SUPERSET_SSH_TUNNELING=false in my .env file DBT container exits with errors.
It works when I change this line to SUPERSET_SSH_TUNNELING=False
Please add this detail to the README.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that. I will make the update.

21 changes: 8 additions & 13 deletions superset/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
FROM apache/superset:2.0.0
FROM apache/superset:2.1.2

USER root

ARG SUPERSET_PASSWORD=admin
ARG [email protected]
RUN pip install mysqlclient

RUN pip install psycopg2-binary
COPY ./superset-init.sh /superset-init.sh

USER superset
COPY superset_config.py /app/
ENV SUPERSET_CONFIG_PATH /app/superset_config.py

RUN superset superset fab create-admin \
--username admin \
--firstname Superset \
--lastname Admin \
--email $SUPERSET_ADMIN_EMAIL \
--password $SUPERSET_PASSWORD
RUN ["chmod", "+x", "/superset-init.sh"]

RUN superset superset db upgrade
RUN superset superset init
USER superset
ENTRYPOINT [ "/superset-init.sh" ]
13 changes: 13 additions & 0 deletions superset/superset-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# create Admin user, you can read these values from env or anywhere else possible
superset fab create-admin --username "admin" --firstname Superset --lastname Admin --email "$SUPERSET_ADMIN_EMAIL" --password "$SUPERSET_PASSWORD"

# Upgrading Superset metastore
superset db upgrade

# setup roles and permissions
superset superset init

# Starting server
/bin/sh -c /usr/bin/run-server.sh
9 changes: 9 additions & 0 deletions superset/superset_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import os

FEATURE_FLAGS = {
"ENABLE_TEMPLATE_PROCESSING": True,
"SSH_TUNNELING": os.environ["SUPERSET_SSH_TUNNELING"],
}

ENABLE_PROXY_FIX = True
SECRET_KEY = "YOUR_OWN_RANDOM_GENERATED_STRING"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there another way to set this secret key? Maybe to also use an environment variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that should also be set with an env variable. I will make the change.

Loading