Skip to content

Commit

Permalink
chore: use docker compose for otel-collector in Justfile (#2768)
Browse files Browse the repository at this point in the history
Rather than using docker run.
  • Loading branch information
alecthomas authored Sep 22, 2024
1 parent 9003ae3 commit 58df201
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
12 changes: 3 additions & 9 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,11 @@ debug *args:
# `just otel-dev` with any args you would pass to `ftl dev`. To stop the otel stream, run
# `just otel-stop` in a third terminal tab.
otel-stream:
docker run \
-p ${OTEL_GRPC_PORT}:${OTEL_GRPC_PORT} \
-p 55679:55679 \
otel/opentelemetry-collector:0.104.0 2>&1 | sed 's/\([A-Z].* #\)/\
\1/g'

# Stop the docker container running otel.
otel-container-id := `docker ps -f ancestor=otel/opentelemetry-collector:0.104.0 | tail -1 | cut -d " " -f1`
docker compose --profile infra up otel-collector

# Stop the otel collector container.
otel-stop:
docker stop "{{otel-container-id}}"
docker compose --profile infra down otel-collector

# Run `ftl dev` with the given args after setting the necessary envar.
otel-dev *args:
Expand Down
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ services:
platform: linux/amd64
restart: unless-stopped
stdin_open: true # docker run -i
tty: true # docker run -t
tty: true # docker run -t
ports:
- 3000:3000 # Portal Endpoint
- ${OTEL_GRPC_PORT}:4317 # OTLP GRPC Collector
- ${OTEL_HTTP_PORT}:4318 # OTLP HTTP Collector
- ${OTEL_GRPC_PORT:-4317}:4317 # OTLP GRPC Collector
- ${OTEL_HTTP_PORT:-4317}:4318 # OTLP HTTP Collector
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
volumes:
Expand All @@ -43,6 +43,7 @@ services:
ports:
- 4317:4317 # OTLP gRPC receiver
- 4318:4318 # OTLP http receiver
- 55679:55679
localstack:
image: localstack/localstack
profiles:
Expand All @@ -54,4 +55,4 @@ services:
DEBUG: 1

volumes:
grafana-storage: {}
grafana-storage: {}

0 comments on commit 58df201

Please sign in to comment.