Skip to content

Commit

Permalink
fix: support docker/.env-local for docker-compose (#28039)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored Apr 15, 2024
1 parent 8538796 commit 0c12369
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 69 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ release.json
messages.mo

docker/requirements-local.txt
docker/.env-local

cache/
docker/*local*
40 changes: 20 additions & 20 deletions docker-compose-image-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ services:

db:
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
image: postgres:15
container_name: superset_db
restart: unless-stopped
Expand All @@ -47,10 +47,10 @@ services:

superset:
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
image: *superset-image
container_name: superset_app
command: ["/app/docker/docker-bootstrap.sh", "app-gunicorn"]
Expand All @@ -66,10 +66,10 @@ services:
container_name: superset_init
command: ["/app/docker/docker-init.sh"]
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
depends_on: *superset-depends-on
user: "root"
volumes: *superset-volumes
Expand All @@ -81,10 +81,10 @@ services:
container_name: superset_worker
command: ["/app/docker/docker-bootstrap.sh", "worker"]
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
restart: unless-stopped
depends_on: *superset-depends-on
user: "root"
Expand All @@ -101,10 +101,10 @@ services:
container_name: superset_worker_beat
command: ["/app/docker/docker-bootstrap.sh", "beat"]
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
restart: unless-stopped
depends_on: *superset-depends-on
user: "root"
Expand Down
40 changes: 20 additions & 20 deletions docker-compose-non-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ services:

db:
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
image: postgres:15
container_name: superset_db
restart: unless-stopped
Expand All @@ -52,10 +52,10 @@ services:

superset:
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
build:
<<: *common-build
container_name: superset_app
Expand All @@ -73,10 +73,10 @@ services:
<<: *common-build
command: ["/app/docker/docker-init.sh"]
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
depends_on: *superset-depends-on
user: "root"
volumes: *superset-volumes
Expand All @@ -89,10 +89,10 @@ services:
container_name: superset_worker
command: ["/app/docker/docker-bootstrap.sh", "worker"]
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
restart: unless-stopped
depends_on: *superset-depends-on
user: "root"
Expand All @@ -110,10 +110,10 @@ services:
container_name: superset_worker_beat
command: ["/app/docker/docker-bootstrap.sh", "beat"]
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
restart: unless-stopped
depends_on: *superset-depends-on
user: "root"
Expand Down
56 changes: 28 additions & 28 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ services:

db:
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
image: postgres:15
container_name: superset_db
restart: unless-stopped
Expand All @@ -70,10 +70,10 @@ services:

superset:
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
build:
<<: *common-build
container_name: superset_app
Expand Down Expand Up @@ -125,10 +125,10 @@ services:
container_name: superset_init
command: ["/app/docker/docker-init.sh"]
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
depends_on: *superset-depends-on
user: *superset-user
volumes: *superset-volumes
Expand All @@ -146,10 +146,10 @@ services:
container_name: superset_node
command: ["/app/docker/docker-frontend.sh"]
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
depends_on: *superset-depends-on
volumes: *superset-volumes

Expand All @@ -159,10 +159,10 @@ services:
container_name: superset_worker
command: ["/app/docker/docker-bootstrap.sh", "worker"]
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
restart: unless-stopped
depends_on: *superset-depends-on
user: *superset-user
Expand All @@ -181,10 +181,10 @@ services:
container_name: superset_worker_beat
command: ["/app/docker/docker-bootstrap.sh", "beat"]
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
restart: unless-stopped
depends_on: *superset-depends-on
user: *superset-user
Expand All @@ -198,10 +198,10 @@ services:
container_name: superset_tests_worker
command: ["/app/docker/docker-bootstrap.sh", "worker"]
env_file:
# defaults
- docker/.env
# gitignored overrides
- docker/.env-local
- path: docker/.env # default
required: true
- path: docker/.env-local # optional override
required: false
environment:
DATABASE_HOST: localhost
DATABASE_DB: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ with docker compose will store that data in a PostgreSQL database contained in a
[volume](https://docs.docker.com/storage/volumes/), which is not backed up.

Again **DO NOT USE THIS FOR PRODUCTION**

:::

You should see a wall of logging output from the containers being launched on your machine. Once
Expand All @@ -137,6 +138,13 @@ are helpful for learning and testing out Superset but unnecessary for experience
production deployments. The loading process can sometimes take a few minutes and a good amount of
CPU, so you may want to disable it on a resource-constrained device.

For more advanced or dynamic configurations that are typically managed in a `superset_config.py` file
located in your `PYTHONPATH`, note that it can be done by providing a
`docker/pythonpath_dev/superset_config_docker.py` that will be ignored by git
(preventing you to commit/push your local configuration back to the repository).
The mechanics of this are in `docker/pythonpath_dev/superset_config.py` where you can see
that the logic runs a `from superset_config_docker import *`


:::note
Users often want to connect to other databases from Superset. Currently, the easiest way to
Expand Down

0 comments on commit 0c12369

Please sign in to comment.