-
Notifications
You must be signed in to change notification settings - Fork 5
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
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
x-superset-volumes: | ||
&superset-volumes # /app/pythonpath_docker will be appended to the PYTHONPATH in the final container | ||
- ./superset:/app/docker | ||
- superset_home:/app/superset_home | ||
|
||
version: "3.7" | ||
services: | ||
superset: | ||
env_file: superset/.env-non-dev | ||
image: apache/superset:3.0.2 | ||
container_name: superset_app | ||
command: ["/app/docker/docker-bootstrap.sh", "app-gunicorn"] | ||
user: "root" | ||
restart: unless-stopped | ||
ports: | ||
- 8088:8088 | ||
volumes: *superset-volumes | ||
|
||
volumes: | ||
superset_home: | ||
external: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
x-superset-depends-on: &superset-depends-on | ||
- db | ||
- redis | ||
x-superset-volumes: | ||
&superset-volumes # /app/pythonpath_docker will be appended to the PYTHONPATH in the final container | ||
- ./superset:/app/docker | ||
- superset_home:/app/superset_home | ||
|
||
version: "3.7" | ||
services: | ||
redis: | ||
image: redis:7 | ||
container_name: superset_cache | ||
restart: unless-stopped | ||
volumes: | ||
- redis:/data | ||
|
||
superset: | ||
env_file: superset/.env-non-dev | ||
image: apache/superset:3.0.2 | ||
container_name: superset_app | ||
command: ["/app/docker/docker-bootstrap.sh", "app-gunicorn"] | ||
user: "root" | ||
restart: unless-stopped | ||
ports: | ||
- 8088:8088 | ||
depends_on: *superset-depends-on | ||
volumes: *superset-volumes | ||
|
||
db: | ||
env_file: superset/.env-non-dev | ||
image: postgres:15 | ||
container_name: superset_db | ||
restart: unless-stopped | ||
volumes: | ||
- db_home:/var/lib/postgresql/data | ||
- ./superset/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d | ||
|
||
superset-init: | ||
image: apache/superset:3.0.2 | ||
container_name: superset_init | ||
command: ["/app/docker/docker-init.sh"] | ||
env_file: superset/.env-non-dev | ||
depends_on: *superset-depends-on | ||
user: "root" | ||
volumes: *superset-volumes | ||
healthcheck: | ||
disable: true | ||
|
||
superset-worker: | ||
image: apache/superset:3.0.2 | ||
container_name: superset_worker | ||
command: ["/app/docker/docker-bootstrap.sh", "worker"] | ||
env_file: superset/.env-non-dev | ||
restart: unless-stopped | ||
depends_on: *superset-depends-on | ||
user: "root" | ||
volumes: *superset-volumes | ||
healthcheck: | ||
test: | ||
[ | ||
"CMD-SHELL", | ||
"celery -A superset.tasks.celery_app:app inspect ping -d celery@$$HOSTNAME", | ||
] | ||
|
||
superset-worker-beat: | ||
image: apache/superset:3.0.2 | ||
container_name: superset_worker_beat | ||
command: ["/app/docker/docker-bootstrap.sh", "beat"] | ||
env_file: superset/.env-non-dev | ||
restart: unless-stopped | ||
depends_on: *superset-depends-on | ||
user: "root" | ||
volumes: *superset-volumes | ||
healthcheck: | ||
disable: true | ||
|
||
volumes: | ||
superset_home: | ||
external: false | ||
db_home: | ||
external: false | ||
redis: | ||
external: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,14 +14,6 @@ services: | |
- COUCHDB_SECURE=${COUCHDB_SECURE:-true} | ||
- HTTP_ENDPOINT=postgrest:3000 | ||
|
||
superset: | ||
build: | ||
context: ./superset/ | ||
args: | ||
SUPERSET_PASSWORD: ${SUPERSET_PASSWORD:-password} | ||
SUPERSET_ADMIN_EMAIL: ${SUPERSET_ADMIN_EMAIL:[email protected]} | ||
ports: | ||
- 8080:8088 | ||
|
||
dbt: | ||
platform: linux/amd64 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
COMPOSE_PROJECT_NAME=superset | ||
|
||
# database configurations (do not modify) | ||
DATABASE_DIALECT=postgresql | ||
|
||
EXAMPLES_DB=examples | ||
EXAMPLES_HOST=db | ||
EXAMPLES_USER=examples | ||
EXAMPLES_PASSWORD=examples | ||
EXAMPLES_PORT=5432 | ||
|
||
# database engine specific environment variables | ||
# change the below if you prefer another database engine | ||
POSTGRES_DB=superset | ||
POSTGRES_USER=superset | ||
POSTGRES_PASSWORD=superset | ||
|
||
# Add the mapped in /app/pythonpath_docker which allows devs to override stuff | ||
PYTHONPATH=/app/pythonpath:/app/docker/pythonpath_dev | ||
REDIS_HOST=redis | ||
REDIS_PORT=6379 | ||
|
||
SUPERSET_ENV=production | ||
SUPERSET_LOAD_EXAMPLES=no | ||
SUPERSET_SECRET_KEY=TEST_NON_DEV_SECRET | ||
CYPRESS_CONFIG=false | ||
SUPERSET_PORT=8088 | ||
MAPBOX_API_KEY='' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
|
||
# Getting Started with Superset using Docker | ||
|
||
Docker is an easy way to get started with Superset. | ||
|
||
## Prerequisites | ||
|
||
1. [Docker](https://www.docker.com/get-started) | ||
2. [Docker Compose](https://docs.docker.com/compose/install/) | ||
|
||
## Configuration | ||
|
||
The `/app/pythonpath` folder is mounted from [`./docker/pythonpath_dev`](./pythonpath_dev) | ||
which contains a base configuration [`./docker/pythonpath_dev/superset_config.py`](./pythonpath_dev/superset_config.py) | ||
intended for use with local development. | ||
|
||
### Local overrides | ||
|
||
In order to override configuration settings locally, simply make a copy of [`./docker/pythonpath_dev/superset_config_local.example`](./pythonpath_dev/superset_config_local.example) | ||
into `./docker/pythonpath_dev/superset_config_docker.py` (git ignored) and fill in your overrides. | ||
|
||
### Local packages | ||
|
||
If you want to add Python packages in order to test things like databases locally, you can simply add a local requirements.txt (`./docker/requirements-local.txt`) | ||
and rebuild your Docker stack. | ||
|
||
Steps: | ||
|
||
1. Create `./docker/requirements-local.txt` | ||
2. Add your new packages | ||
3. Rebuild docker compose | ||
1. `docker compose down -v` | ||
2. `docker compose up` | ||
|
||
## Initializing Database | ||
|
||
The database will initialize itself upon startup via the init container ([`superset-init`](./docker-init.sh)). This may take a minute. | ||
|
||
## Normal Operation | ||
|
||
To run the container, simply run: `docker compose up` | ||
|
||
After waiting several minutes for Superset initialization to finish, you can open a browser and view [`http://localhost:8088`](http://localhost:8088) | ||
to start your journey. | ||
|
||
## Developing | ||
|
||
While running, the container server will reload on modification of the Superset Python and JavaScript source code. | ||
Don't forget to reload the page to take the new frontend into account though. | ||
|
||
## Production | ||
|
||
It is possible to run Superset in non-development mode by using [`docker-compose-non-dev.yml`](../docker-compose-non-dev.yml). This file excludes the volumes needed for development and uses [`./docker/.env-non-dev`](./.env-non-dev) which sets the variable `SUPERSET_ENV` to `production`. | ||
|
||
## Resource Constraints | ||
|
||
If you are attempting to build on macOS and it exits with 137 you need to increase your Docker resources. See instructions [here](https://docs.docker.com/docker-for-mac/#advanced) (search for memory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
REQUIREMENTS_LOCAL="/app/docker/requirements-local.txt" | ||
# If Cypress run – overwrite the password for admin and export env variables | ||
if [ "$CYPRESS_CONFIG" == "true" ]; then | ||
export SUPERSET_CONFIG=tests.integration_tests.superset_test_config | ||
export SUPERSET_TESTENV=true | ||
export SUPERSET__SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://superset:superset@db:5432/superset | ||
fi | ||
# | ||
# Make sure we have dev requirements installed | ||
# | ||
if [ -f "${REQUIREMENTS_LOCAL}" ]; then | ||
echo "Installing local overrides at ${REQUIREMENTS_LOCAL}" | ||
pip install --no-cache-dir -r "${REQUIREMENTS_LOCAL}" | ||
else | ||
echo "Skipping local overrides" | ||
fi | ||
|
||
# | ||
# playwright is an optional package - run only if it is installed | ||
# | ||
if command -v playwright > /dev/null 2>&1; then | ||
playwright install-deps | ||
playwright install chromium | ||
fi | ||
|
||
case "${1}" in | ||
worker) | ||
echo "Starting Celery worker..." | ||
celery --app=superset.tasks.celery_app:app worker -O fair -l INFO | ||
;; | ||
beat) | ||
echo "Starting Celery beat..." | ||
rm -f /tmp/celerybeat.pid | ||
celery --app=superset.tasks.celery_app:app beat --pidfile /tmp/celerybeat.pid -l INFO -s "${SUPERSET_HOME}"/celerybeat-schedule | ||
;; | ||
app) | ||
echo "Starting web app (using development server)..." | ||
flask run -p 8088 --with-threads --reload --debugger --host=0.0.0.0 | ||
;; | ||
app-gunicorn) | ||
echo "Starting web app..." | ||
/usr/bin/run-server.sh | ||
;; | ||
*) | ||
echo "Unknown Operation!!!" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
/app/docker/docker-init.sh | ||
|
||
# TODO: copy config overrides from ENV vars | ||
|
||
# TODO: run celery in detached state | ||
export SERVER_THREADS_AMOUNT=8 | ||
# start up the web server | ||
|
||
/usr/bin/run-server.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
set -e | ||
|
||
# Packages needed for puppeteer: | ||
apt update | ||
apt install -y chromium | ||
|
||
cd /app/superset-frontend | ||
npm install -f --no-optional --global webpack webpack-cli | ||
npm install -f --no-optional | ||
|
||
echo "Running frontend" | ||
npm run dev |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
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.