Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ OTEL_COLLECTOR_HOST=otel-collector
OTEL_COLLECTOR_PORT_GRPC=4317
OTEL_COLLECTOR_PORT_HTTP=4318
OTEL_COLLECTOR_CONFIG=./src/otel-collector/otelcol-config.yml
OTEL_COLLECTOR_CONFIG_FULL=./src/otel-collector/otelcol-config-full.yml
OTEL_COLLECTOR_CONFIG_OBSERVABILITY=./src/otel-collector/otelcol-config-observability.yml
OTEL_COLLECTOR_CONFIG_EXTRAS=./src/otel-collector/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
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ A Pull Request that modifies instrumentation code will likely require an
update in docs. Please make sure to update the opentelemetry.io repo with any
docs changes.

A Pull Request that modifies docker-compose.yaml, otelcol-config.yaml, or
A Pull Request that modifies compose*.yaml, otelcol-config*.yml, or
Grafana dashboards will likely require an update to the Demo Helm chart.
Other changes affecting how a service is deployed will also likely require an
update to the Demo Helm chart.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/label-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- 'src/flagd/**'
helmUpdateRequired:
- '.env'
- 'docker-compose*.yml'
- 'compose*.yaml'
- 'src/flagd/**'
- 'src/grafana/**'
- 'src/jaeger/**'
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,3 @@ src/shipping/target/
test/tracetesting/tracetesting-vars.yaml

!src/currency/build

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ the release.
* [load-generator] Wait for Roof Binoculars image to load in web tasks, and fix
task failures due to missing `tracer` attribute
([#3171](https://github.com/open-telemetry/opentelemetry-demo/pull/3171))
* [docker] Refactor Docker Compose to use layered `-f` files with `start`,
`start-minimal`, `start-no-o11y`, and `start-minimal-no-o11y` make targets
([#3229](https://github.com/open-telemetry/opentelemetry-demo/pull/3229))
* [kubernetes] Removed generated Kubernetes manifests in favor of docs
([#3236](https://github.com/open-telemetry/opentelemetry-demo/pull/3236))
* [cart] Swap the deprecated `OpenFeature.Contrib.Providers.Flagd` package
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ docker logs <container_id>
- Restart containers if needed:

```sh
docker-compose restart
make restart service=<service-name>
```

### Review the Documentation
Expand Down
80 changes: 61 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,28 @@ ADDLICENSE = $(TOOLS_DIR)/$(ADDLICENSE_BINARY)

DOCKER_COMPOSE_CMD ?= docker compose
DOCKER_COMPOSE_ENV=--env-file .env --env-file .env.override
DOCKER_COMPOSE_BUILD_ARGS=

# Compose file layers — combine with -f flags for the desired configuration:
# Core (minimal): compose.yaml
# Full (adds Kafka group): compose.yaml + compose.full.yaml
# With observability stack: + compose.observability.yaml
# With extras customizations: + compose.extras.yaml (always last)
DOCKER_COMPOSE_FILES_CORE=-f compose.yaml
DOCKER_COMPOSE_FILES_FULL=$(DOCKER_COMPOSE_FILES_CORE) -f compose.full.yaml
DOCKER_COMPOSE_FILES_OBSERVABILITY=-f compose.observability.yaml
DOCKER_COMPOSE_FILES_EXTRAS=-f compose.extras.yaml

# Default: full demo + observability stack + extras stub
DOCKER_COMPOSE_FILES=$(DOCKER_COMPOSE_FILES_FULL) $(DOCKER_COMPOSE_FILES_OBSERVABILITY) $(DOCKER_COMPOSE_FILES_EXTRAS)

# Java Workaround for macOS 15.2+ and M4 chips (see https://bugs.openjdk.org/browse/JDK-8345296)
ifeq ($(shell uname -m),arm64)
ifeq ($(shell uname -s),Darwin)
DOCKER_COMPOSE_ENV+= --env-file .env.arm64
DOCKER_COMPOSE_BUILD_ARGS+= --build-arg=_JAVA_OPTIONS=-XX:UseSVE=0
endif
endif

# see https://github.com/open-telemetry/build-tools/releases for semconvgen updates
# Keep links in semantic_conventions/README.md and .vscode/settings.json in sync!
Expand Down Expand Up @@ -62,6 +84,7 @@ checklicense: $(ADDLICENSE)
-ignore node_modules/** \
-ignore .expo/** \
-ignore Pods/** \
-ignore **/extras/** \
-ignore **/vendor/** \
-ignore **/.venv/** \
-ignore **/dist/** \
Expand All @@ -79,6 +102,7 @@ addlicense: $(ADDLICENSE)
-ignore node_modules/** \
-ignore .expo/** \
-ignore Pods/** \
-ignore **/extras/** \
-ignore **/vendor/** \
-ignore **/.venv/** \
-ignore **/dist/** \
Expand Down Expand Up @@ -111,11 +135,11 @@ install-tools: $(MISSPELL) $(ADDLICENSE)

.PHONY: build
build:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) build
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) build $(DOCKER_COMPOSE_BUILD_ARGS)

.PHONY: build-and-push
build-and-push:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) build --push
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) build $(DOCKER_COMPOSE_BUILD_ARGS) --push

# Create multiplatform builder for buildx
.PHONY: create-multiplatform-builder
Expand Down Expand Up @@ -153,12 +177,12 @@ clean-images:

.PHONY: run-tests
run-tests:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml run frontendTests
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml run traceBasedTests
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) -f docker-compose-tests.yml run frontendTests
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) -f docker-compose-tests.yml run traceBasedTests

.PHONY: run-tracetesting
run-tracetesting:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml run traceBasedTests ${SERVICES_TO_TEST}
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) -f docker-compose-tests.yml run traceBasedTests ${SERVICES_TO_TEST}

.PHONY: generate-protobuf
generate-protobuf:
Expand Down Expand Up @@ -186,7 +210,7 @@ check-clean-work-tree:

.PHONY: start
start:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) up --force-recreate --remove-orphans --detach
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) up --force-recreate --remove-orphans --detach
@echo ""
@echo "OpenTelemetry Demo is running."
@echo "Go to http://localhost:8080 for the demo UI."
Expand All @@ -198,19 +222,37 @@ start:

.PHONY: start-minimal
start-minimal:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose.minimal.yml up --force-recreate --remove-orphans --detach
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES_CORE) $(DOCKER_COMPOSE_FILES_OBSERVABILITY) $(DOCKER_COMPOSE_FILES_EXTRAS) up --force-recreate --remove-orphans --detach
@echo ""
@echo "OpenTelemetry Demo in minimal mode is running."
@echo "Go to http://localhost:8080 for the demo UI."
@echo "Go to http://localhost:8080/jaeger/ui for the Jaeger UI."
@echo "Go to http://localhost:8080/grafana/ for the Grafana UI."
@echo "Go to http://localhost:8080/loadgen/ for the Load Generator UI."
@echo "Go to https://opentelemetry.io/docs/demo/feature-flags/ to learn how to change feature flags."
@echo "Go to http://localhost:8080/feature/ to change feature flags."

.PHONY: start-no-o11y
start-no-o11y:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES_FULL) $(DOCKER_COMPOSE_FILES_EXTRAS) up --force-recreate --remove-orphans --detach
@echo ""
@echo "OpenTelemetry Demo is running (no observability stack)."
@echo "Go to http://localhost:8080 for the demo UI."
@echo "Go to http://localhost:8080/loadgen/ for the Load Generator UI."
@echo "Go to http://localhost:8080/feature/ to change feature flags."

.PHONY: start-minimal-no-o11y
start-minimal-no-o11y:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES_CORE) $(DOCKER_COMPOSE_FILES_EXTRAS) up --force-recreate --remove-orphans --detach
@echo ""
@echo "OpenTelemetry Demo in minimal mode is running (no observability stack)."
@echo "Go to http://localhost:8080 for the demo UI."
@echo "Go to http://localhost:8080/loadgen/ for the Load Generator UI."
@echo "Go to http://localhost:8080/feature/ to change feature flags."

.PHONY: stop
stop:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) down --remove-orphans --volumes
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml down --remove-orphans --volumes
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) down --remove-orphans --volumes
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) -f docker-compose-tests.yml down --remove-orphans --volumes
@echo ""
@echo "OpenTelemetry Demo is stopped."

Expand All @@ -224,10 +266,10 @@ ifdef SERVICE
endif

ifdef service
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) stop $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) rm --force $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) create $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) start $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) stop $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) rm --force $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) create $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) start $(service)
else
@echo "Please provide a service name using `service=[service name]` or `SERVICE=[service name]`"
endif
Expand All @@ -242,11 +284,11 @@ ifdef SERVICE
endif

ifdef service
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) build $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) stop $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) rm --force $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) create $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) start $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) build $(DOCKER_COMPOSE_BUILD_ARGS) $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) stop $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) rm --force $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) create $(service)
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) $(DOCKER_COMPOSE_FILES) start $(service)
else
@echo "Please provide a service name using `service=[service name]` or `SERVICE=[service name]`"
endif
Expand Down
26 changes: 26 additions & 0 deletions compose.extras.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

# Extras layer: override this file in your fork to add or modify services
# for your own observability backend or additional components.
#
# This file is intentionally empty. It is always loaded last, giving forks
# a stable, well-defined seam to customize without touching upstream files.
#
# Usage:
# docker compose -f compose.yaml -f compose.full.yaml -f compose.observability.yaml -f compose.extras.yaml up
#
# Example: add a service and patch the otel-collector to export to it:
#
# services:
# my-backend:
# image: myvendor/backend:latest
# ports:
# - "4317"
#
# otel-collector:
# depends_on:
# my-backend:
# condition: service_started
#
# Then add your exporter config to src/otel-collector/otelcol-config-extras.yml.
145 changes: 145 additions & 0 deletions compose.full.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

# Full demo layer: adds Kafka-dependent services (accounting, fraud-detection)
# and patches core services that need Kafka awareness.
#
# Usage:
# docker compose -f compose.yaml -f compose.full.yaml up

services:
# Accounting service (Kafka consumer)
accounting:
image: ${IMAGE_NAME}:${DEMO_VERSION}-accounting
container_name: accounting
build:
context: ./
dockerfile: ${ACCOUNTING_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-accounting
deploy:
resources:
limits:
memory: 160M
restart: unless-stopped
environment:
- KAFKA_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES},service.criticality=low
- OTEL_SERVICE_NAME=accounting
- DB_CONNECTION_STRING=Host=${POSTGRES_HOST};Username=astronomy_user;Password=${POSTGRES_ASTRONOMY_PASSWORD};Database=astronomy_db
- OTEL_DOTNET_AUTO_TRACES_ENTITYFRAMEWORKCORE_INSTRUMENTATION_ENABLED=false
depends_on:
otel-collector:
condition: service_started
kafka:
condition: service_healthy
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"

# Fraud Detection service (Kafka consumer)
fraud-detection:
image: ${IMAGE_NAME}:${DEMO_VERSION}-fraud-detection
container_name: fraud-detection
build:
context: ./
dockerfile: ${FRAUD_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-fraud-detection
args:
OTEL_JAVA_AGENT_VERSION: ${OTEL_JAVA_AGENT_VERSION}
deploy:
resources:
limits:
memory: 300M
restart: unless-stopped
environment:
- FLAGD_HOST
- FLAGD_PORT
- KAFKA_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_INSTRUMENTATION_KAFKA_EXPERIMENTAL_SPAN_ATTRIBUTES=true
- OTEL_INSTRUMENTATION_MESSAGING_EXPERIMENTAL_RECEIVE_TELEMETRY_ENABLED=true
- OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES},service.criticality=low
- OTEL_SERVICE_NAME=fraud-detection
# Workaround on OSX for https://bugs.openjdk.org/browse/JDK-8345296
- _JAVA_OPTIONS
depends_on:
otel-collector:
condition: service_started
kafka:
condition: service_healthy
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"

# Kafka used by Checkout, Accounting, and Fraud Detection services
kafka:
image: ${IMAGE_NAME}:${DEMO_VERSION}-kafka
container_name: kafka
build:
context: ./
dockerfile: ${KAFKA_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-kafka
args:
OTEL_JAVA_AGENT_VERSION: ${OTEL_JAVA_AGENT_VERSION}
deploy:
resources:
limits:
memory: 620M
restart: unless-stopped
environment:
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://${KAFKA_HOST}:9092
- KAFKA_LISTENERS=PLAINTEXT://${KAFKA_HOST}:9092,CONTROLLER://${KAFKA_HOST}:9093
- KAFKA_CONTROLLER_QUORUM_VOTERS=1@${KAFKA_HOST}:9093
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES},service.criticality=low
- OTEL_SERVICE_NAME=kafka
- KAFKA_HEAP_OPTS=-Xmx400m -Xms400m
# Workaround on OSX for https://bugs.openjdk.org/browse/JDK-8345296
- _JAVA_OPTIONS
healthcheck:
test: nc -z kafka 9092
start_period: 10s
interval: 5s
timeout: 10s
retries: 10
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"

# Patch checkout to add Kafka dependency in full mode
checkout:
environment:
- KAFKA_ADDR
depends_on:
kafka:
condition: service_healthy

# Patch otel-collector to add Kafka and Postgres metrics receivers
otel-collector:
command:
- "--config=/etc/otelcol-config.yml"
- "--config=/etc/otelcol-config-full.yml"
- "--config=/etc/otelcol-config-extras.yml"
volumes:
- ${OTEL_COLLECTOR_CONFIG}:/etc/otelcol-config.yml
- ${OTEL_COLLECTOR_CONFIG_FULL}:/etc/otelcol-config-full.yml
- ${OTEL_COLLECTOR_CONFIG_EXTRAS}:/etc/otelcol-config-extras.yml
environment:
- KAFKA_ADDR
- POSTGRES_HOST
- POSTGRES_PORT
- POSTGRES_PASSWORD
- POSTGRES_MONITORING_PASSWORD
Loading
Loading