feat(create-plugin): make Grafana host port configurable via GRAFANA_PORT in base template#2556
Open
darrenjaneczek wants to merge 1 commit intomainfrom
Open
feat(create-plugin): make Grafana host port configurable via GRAFANA_PORT in base template#2556darrenjaneczek wants to merge 1 commit intomainfrom
darrenjaneczek wants to merge 1 commit intomainfrom
Conversation
Replace the hardcoded 3000:3000/tcp port mapping in docker-compose-base.yaml
with ${GRAFANA_PORT:-3000}:3000/tcp so plugin developers can run multiple
local Grafana instances simultaneously on different ports.
When a plugin's docker-compose.yaml extends docker-compose-base.yaml and also
declares a ports entry, Docker Compose merges the two lists. With the base
hardcoded at 3000:3000/tcp, setting GRAFANA_PORT=3001 in the extending file
results in both 3000:3000 and 3001:3000 being bound — the 3000 binding fails
if another container already holds that port. Using the same variable in the
base means both entries resolve identically and Docker deduplicates them.
Defaults to 3000 when unset, so existing .env files need no changes.
Author
|
Closing — opening prematurely. Will reopen after the associated issue is properly discussed. |
Contributor
|
Hello! 👋 This repository uses Auto for releasing packages using PR labels. ✨ This PR can be merged but will not trigger a new release. To trigger a new release add the |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the create-plugin scaffolding’s base Docker Compose template so the host port used for Grafana can be configured via GRAFANA_PORT, preventing duplicate/merged port bindings when Compose extends is used.
Changes:
- Replace the hardcoded
3000:3000/tcpport mapping with${GRAFANA_PORT:-3000}:3000/tcpin the base template.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #2555
Summary
3000:3000/tcpindocker-compose-base.yamlwith${GRAFANA_PORT:-3000}:3000/tcpDocker Compose
extendsmerges list fields likeportsrather than replacing them. When a plugin'sdocker-compose.yamlextends the base and also declares${GRAFANA_PORT:-3000}:3000/tcp, both entries are applied to the container. With the base hardcoded at3000:3000/tcp, settingGRAFANA_PORT=3001results in two different bindings being attempted — one of which conflicts if another environment is already on port 3000.Using the same variable in the base means both entries always resolve identically. Docker deduplicates them, and only one port is bound. Developers can set
GRAFANA_PORT=3001in one workspace's.envto run two environments side by side. The default remains3000, so existing.envfiles need no changes.Test plan
GRAFANA_PORT=3001in.env, rundocker compose up— Grafana should bind on port3001onlyGRAFANA_PORTset,docker compose upcontinues to bind on port3000(default behaviour unchanged)3000and3001without conflict🤖 Generated with Claude Code