From 888c1595fd623d9c5530763694d300af6e4d13d8 Mon Sep 17 00:00:00 2001 From: Roger Coll Date: Wed, 26 Jun 2024 15:27:41 +0200 Subject: [PATCH] add collector configs as environment variable (#1632) Co-authored-by: Mikko Viitanen <74129181+mviitane@users.noreply.github.com> --- .env | 2 ++ docker-compose.minimal.yml | 4 ++-- docker-compose.yml | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.env b/.env index 8383b2ec71..f85b34f366 100644 --- a/.env +++ b/.env @@ -25,6 +25,8 @@ ENV_PLATFORM=local OTEL_COLLECTOR_HOST=otelcol OTEL_COLLECTOR_PORT_GRPC=4317 OTEL_COLLECTOR_PORT_HTTP=4318 +OTEL_COLLECTOR_CONFIG=./src/otelcollector/otelcol-config.yml +OTEL_COLLECTOR_CONFIG_EXTRAS=./src/otelcollector/otelcol-config-extras.yml OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC} PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:8080/otlp-http/v1/traces diff --git a/docker-compose.minimal.yml b/docker-compose.minimal.yml index 2f8a5eae88..5720b4e0c8 100644 --- a/docker-compose.minimal.yml +++ b/docker-compose.minimal.yml @@ -584,8 +584,8 @@ services: restart: unless-stopped command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-extras.yml" ] volumes: - - ./src/otelcollector/otelcol-config.yml:/etc/otelcol-config.yml - - ./src/otelcollector/otelcol-config-extras.yml:/etc/otelcol-config-extras.yml + - ${OTEL_COLLECTOR_CONFIG}:/etc/otelcol-config.yml + - ${OTEL_COLLECTOR_CONFIG_EXTRAS}:/etc/otelcol-config-extras.yml ports: - "${OTEL_COLLECTOR_PORT_GRPC}" - "${OTEL_COLLECTOR_PORT_HTTP}" diff --git a/docker-compose.yml b/docker-compose.yml index 3848155f35..bf2c75a3c9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -694,8 +694,8 @@ services: restart: unless-stopped command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-extras.yml" ] volumes: - - ./src/otelcollector/otelcol-config.yml:/etc/otelcol-config.yml - - ./src/otelcollector/otelcol-config-extras.yml:/etc/otelcol-config-extras.yml + - ${OTEL_COLLECTOR_CONFIG}:/etc/otelcol-config.yml + - ${OTEL_COLLECTOR_CONFIG_EXTRAS}:/etc/otelcol-config-extras.yml ports: - "${OTEL_COLLECTOR_PORT_GRPC}" - "${OTEL_COLLECTOR_PORT_HTTP}"