Skip to content

feat(create-plugin): make Grafana host port configurable via GRAFANA_PORT in base template#2556

Open
darrenjaneczek wants to merge 1 commit intomainfrom
fix/docker-compose-base-grafana-port
Open

feat(create-plugin): make Grafana host port configurable via GRAFANA_PORT in base template#2556
darrenjaneczek wants to merge 1 commit intomainfrom
fix/docker-compose-base-grafana-port

Conversation

@darrenjaneczek
Copy link
Copy Markdown

@darrenjaneczek darrenjaneczek commented Apr 1, 2026

Closes #2555

Summary

  • Replace hardcoded 3000:3000/tcp in docker-compose-base.yaml with ${GRAFANA_PORT:-3000}:3000/tcp

Docker Compose extends merges list fields like ports rather than replacing them. When a plugin's docker-compose.yaml extends the base and also declares ${GRAFANA_PORT:-3000}:3000/tcp, both entries are applied to the container. With the base hardcoded at 3000:3000/tcp, setting GRAFANA_PORT=3001 results 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=3001 in one workspace's .env to run two environments side by side. The default remains 3000, so existing .env files need no changes.

Test plan

  • Scaffold a new plugin, set GRAFANA_PORT=3001 in .env, run docker compose up — Grafana should bind on port 3001 only
  • Without GRAFANA_PORT set, docker compose up continues to bind on port 3000 (default behaviour unchanged)
  • Two plugin environments can run concurrently on ports 3000 and 3001 without conflict

🤖 Generated with Claude Code

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.
@darrenjaneczek
Copy link
Copy Markdown
Author

Closing — opening prematurely. Will reopen after the associated issue is properly discussed.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

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 release label before merging.
NOTE: When merging a PR with the release label please avoid merging another PR. For further information see here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/tcp port mapping with ${GRAFANA_PORT:-3000}:3000/tcp in the base template.

@darrenjaneczek darrenjaneczek reopened this Apr 1, 2026
@github-project-automation github-project-automation bot moved this from 🚀 Shipped to 💡 Ideation in Grafana Catalog Team Apr 1, 2026
@darrenjaneczek darrenjaneczek added the minor Increment the minor version when merged label Apr 1, 2026
@darrenjaneczek darrenjaneczek changed the title fix(create-plugin): make Grafana host port configurable via GRAFANA_PORT in base template feat(create-plugin): make Grafana host port configurable via GRAFANA_PORT in base template Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Increment the minor version when merged

Projects

Status: 💡 Ideation

Development

Successfully merging this pull request may close these issues.

Feat: make Grafana host port configurable via GRAFANA_PORT in base template

2 participants