-
Notifications
You must be signed in to change notification settings - Fork 292
fix: pass .env variables through to containers in compose.example.yml #2811
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,13 @@ services: | |
| # "Binding to IPv6" for details. | ||
| # - "[::]:${PORT:-3000}:3000" | ||
| restart: unless-stopped | ||
| # Inject any variables you set in .env (ONBOARDING_STATE, APP_DOMAIN, | ||
| # SMTP_*, etc.). The explicit `environment` values below take precedence | ||
| # over .env, so container-critical settings (DB_HOST, REDIS_URL, ...) stay | ||
| # correct. `required: false` keeps this working when no .env file exists. | ||
| env_file: | ||
| - path: .env | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When users follow Useful? React with 👍 / 👎. |
||
| required: false | ||
| environment: | ||
| <<: *rails_env | ||
| # BINDING: "::" # Uncomment for IPv6 dual-stack inside the container | ||
|
|
@@ -95,6 +102,10 @@ services: | |
| volumes: | ||
| - app-storage:/rails/storage | ||
| restart: unless-stopped | ||
| # Same as `web`: pass through .env while keeping explicit values authoritative. | ||
| env_file: | ||
| - path: .env | ||
| required: false | ||
| depends_on: | ||
| db: | ||
| condition: service_healthy | ||
|
|
||
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.
.envfrom overriding the fixed container portWhen a self-hoster changes the documented
PORTvalue in.env, thisenv_filealso injects that value intoweb, so Puma listens on it (config/puma.rb:44) while Compose still publishes${PORT}:3000(compose.example.yml:72). For example,PORT=3001maps host port 3001 to an unused container port 3000, making the UI unreachable. The Compose short port syntax is[HOST:]CONTAINER[/PROTOCOL]; pinPORT: 3000in the explicit container environment or change the container-side mapping accordingly.Useful? React with 👍 / 👎.