Skip to content

Use compose profiles to enable logging / promtail #108

@ulope

Description

@ulope

🎯 Problem to be solved

The new v0.1.13 release contains optional support for log collection.
The way that is implemented relies on operators to manually add an additional compose file on the command line (every time they interact with the deployed stack).

This is not only inconvenient due to the amount of typing required (i.e. docker compose ... vs docker compose -f docker-compose.yml -f logging.yml ...) but also error prone due to people forgetting to include the additional file.

A more elegant (IMO) solution would be to use the profile feature docker compose provides.
This allows to place services into profiles which can be thought of like groups.
Services without an assigned profile are always selected while those with a profile can be selected wither via a CLI flag or an env variable (COMPOSE_PROFILES) which can also be set in .env.

So that would mean to enable log forwarding operators would simply need to edit their .env file (e.g. uncomment or add a COMPOSE_PROFILES=logging line)

Example:

docker-compose.yml:

services:
  # ...

  logging:
    profiles: [logging]
    # ...

.env:

# ...

#COMPOSE_PROFILES=logging

🧪 Tests

  • Works in local docker-compose

👐 Additional acceptance criteria

❌ Out of Scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions