Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: introduce .env.override for docker-compose #1584

Merged
merged 4 commits into from
Jun 3, 2024
Merged
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.override
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# DO NOT PUSH CHANGES OF THIS FILE TO opentelemetry/opentelemetry-demo
# PLACE YOUR .env ENVIRONMENT VARIABLES OVERRIDES IN THIS FILE
45 changes: 24 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ TOOLS_DIR := ./internal/tools
MISSPELL_BINARY=bin/misspell
MISSPELL = $(TOOLS_DIR)/$(MISSPELL_BINARY)

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

# 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!
SEMCONVGEN_VERSION=0.11.0
Expand Down Expand Up @@ -74,17 +77,17 @@ install-tools: $(MISSPELL)

.PHONY: build
build:
docker compose build
$(DOCKER_COMPOSE_CMD) build

.PHONY: build-and-push-dockerhub
build-and-push-dockerhub:
docker compose --env-file .dockerhub.env -f docker-compose.yml build
docker compose --env-file .dockerhub.env -f docker-compose.yml push
$(DOCKER_COMPOSE_CMD) --env-file .dockerhub.env -f docker-compose.yml build
$(DOCKER_COMPOSE_CMD) --env-file .dockerhub.env -f docker-compose.yml push

.PHONY: build-and-push-ghcr
build-and-push-ghcr:
docker compose --env-file .ghcr.env -f docker-compose.yml build
docker compose --env-file .ghcr.env -f docker-compose.yml push
$(DOCKER_COMPOSE_CMD) --env-file .ghcr.env -f docker-compose.yml build
$(DOCKER_COMPOSE_CMD) --env-file .ghcr.env -f docker-compose.yml push

.PHONY: build-env-file
build-env-file:
Expand All @@ -97,12 +100,12 @@ build-env-file:

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

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

.PHONY: generate-protobuf
generate-protobuf:
Expand All @@ -124,7 +127,7 @@ generate-kubernetes-manifests:

.PHONY: start
start:
docker compose up --force-recreate --remove-orphans --detach
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) up --force-recreate --remove-orphans --detach
@echo ""
@echo "OpenTelemetry Demo is running."
@echo "Go to http://localhost:8080 for the demo UI."
Expand All @@ -135,7 +138,7 @@ start:

.PHONY: start-minimal
start-minimal:
docker compose -f docker-compose.minimal.yml up --force-recreate --remove-orphans --detach
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) up -f docker-compose.minimal.yml 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."
Expand All @@ -147,7 +150,7 @@ start-minimal:
# Observabilty-Driven Development (ODD)
.PHONY: start-odd
start-odd:
docker compose --profile odd up --force-recreate --remove-orphans --detach
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) --profile odd up --force-recreate --remove-orphans --detach
@echo ""
@echo "OpenTelemetry Demo is running."
@echo "Go to http://localhost:8080 for the demo UI."
Expand All @@ -159,7 +162,7 @@ start-odd:

.PHONY: stop
stop:
docker compose --profile tests --profile odd down --remove-orphans --volumes
$(DOCKER_COMPOSE_CMD) --profile tests --profile odd down --remove-orphans --volumes
@echo ""
@echo "OpenTelemetry Demo is stopped."

Expand All @@ -173,10 +176,10 @@ ifdef SERVICE
endif

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

ifdef service
docker compose build $(service)
docker compose stop $(service)
docker compose rm --force $(service)
docker compose create $(service)
docker compose start $(service)
$(DOCKER_COMPOSE_CMD) build $(service)
$(DOCKER_COMPOSE_CMD) stop $(service)
$(DOCKER_COMPOSE_CMD) rm --force $(service)
$(DOCKER_COMPOSE_CMD) create $(service)
$(DOCKER_COMPOSE_CMD) start $(service)
else
@echo "Please provide a service name using `service=[service name]` or `SERVICE=[service name]`"
endif
Expand Down
Loading