Skip to content

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

@darrenjaneczek

Description

@darrenjaneczek

Which areas: Create Plugin

Problem:

Running two plugin development environments simultaneously (e.g. two separate plugins, or the same plugin against two different backends) currently requires both to share port 3000. Docker Compose's extends feature merges list fields like ports rather than replacing them, so adding ${GRAFANA_PORT:-3000}:3000/tcp to an extending docker-compose.yaml results in both the base's 3000:3000/tcp entry and the override being present. When both instances try to start, the second one cannot claim port 3000.

Solution:

Change the port mapping in docker-compose-base.yaml to use the same variable:

```yaml
ports:

  • ${GRAFANA_PORT:-3000}:3000/tcp
    ```

Because both the base and the extending file then carry the same expression, Docker resolves them to the same value and deduplicates the binding. 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.

Alternatives:

Inlining the base config directly in each plugin's docker-compose.yaml instead of using extends would also avoid the merge behaviour, but would require duplicating content that extends was specifically introduced to centralise.

Additional context:

Docker Compose's merge behaviour for list fields is documented here. The variable substitution pattern is already used elsewhere in the base template (e.g. ${GRAFANA_IMAGE:-...}, ${GRAFANA_VERSION:-...}), so ${GRAFANA_PORT:-3000} follows the existing convention naturally.

Are you interested in contributing the solution? Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    💡 Ideation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions