You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "denodo-research-labs (via GitHub)" <gi...@apache.org> on 2025/06/05 15:43:53 UTC
[PR] fix(compose): environment entries in compose*.yml override values in docker/.env [superset]
denodo-research-labs opened a new pull request, #33700:
URL: https://github.com/apache/superset/pull/33700
### SUMMARY
Docker compose files (`docker-compose.yml`, `docker-compose-non-dev.yml`, `docker-compose-image-tag.yml`) contain `environment` entries for several containers, establishing values for env variables that are also included in `docker/.env`.
But due to [the way environment variable precedence works in Docker](https://docs.docker.com/compose/how-tos/environment-variables/envvars-precedence/), any env variable merely listed in the `.yml` files –even if no value is specified– will overwrite any values coming from the `env-file` entries (`docker/.env` and `docker/.env-local`).
This means that if users set, for instance, `SUPERSET_LOAD_EXAMPLES=no` in `docker/.env` or `docker/.env-local` (as explained in the documentation), this value **will be ignored** and examples will be loaded anyway, because the `docker-compose-*.yml` contain this:
v
### TESTING INSTRUCTIONS
- Set `SUPERSET_LOAD_EXAMPLES=no` in `docker/.env-local`.
- Start with `docker compose ... up -d`
- Examples will be loaded (and container `superset_init` will take a long time to start, which is inconvenient).
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [X] Has associated issue: #31747 (`environment` entries were added here).
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
### ADDITIONAL COMMENTS
Please note the above would not happen if `docker/.env` was in fact `.env`, and this may cause some confusion.
The reason is, the `.env` file present in the docker-compose root folder will be used for replacing any environment variables **used in the `.yml` file itself**. So for instance, if we had a `.env` file with:
```
SUPERSET_LOAD_EXAMPLES=no
```
Then this line in `docker-compose.yml` would work as expected, setting the value of the variable to `no`:
```yml
environment:
SUPERSET_LOAD_EXAMPLES: "${SUPERSET_LOAD_EXAMPLES:-yes}"
```
But there is a difference between `.env` and Docker compose's `env-file`'s specified for each of the containers. The former applies on the `.yml` file, while the latter applies exclusively _inside the container_, but taking less precedence than the former.
So the fact that those files in the `docker/` folder are called `.env` **is misleading**. Those are not `.env` files, but instead `env-file`s (yes, subtle 😄).
So, **proposal**: Would you consider renaming those files inside the `docker/` folder to something like (just a suggestion):
* `docker/.env` -> `docker/environment`
* `docker/.env-local` -> `docker/environment-local`
(Please note renaming these would mean also changes in the public documentation, and in the `.gitignore` file.)
If it makes sense for you, we could provide an additional PR for that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(compose): environment entries in compose*.yml override values in docker/.env [superset]
Posted by "denodo-research-labs (via GitHub)" <gi...@apache.org>.
denodo-research-labs commented on PR #33700:
URL: https://github.com/apache/superset/pull/33700#issuecomment-2955022598
Thanks for merging.
> Only minor downside is that it's a bit hard to find env vars you may want to alter
Agreed that it is very confusing. First impulse is to use the `environment` section of the `*.yml` to _document_ the variables that should be present in the `env-file`s and give them a default value, but unfortunately this is not how it works. Also, the similarity in name between the `.env` file and the `env-file` property does not help when they are configuration steps applied so differently.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(compose): environment entries in compose*.yml override values in docker/.env [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch merged PR #33700:
URL: https://github.com/apache/superset/pull/33700
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(compose): environment entries in compose*.yml override values in docker/.env [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on PR #33700:
URL: https://github.com/apache/superset/pull/33700#issuecomment-2950831589
This LGTM overall, I double checked that the defaults are/were the same between what we're de-referencing here in `docker-compose.*.yml` and in the default `docker/.env` file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(compose): environment entries in compose*.yml override values in docker/.env [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on PR #33700:
URL: https://github.com/apache/superset/pull/33700#issuecomment-2950833496
Thanks for the contribution btw - lots of forensics involved here!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org