Skip to content

Commit

Permalink
Merge pull request #48 from qclaogui/docker-compose-env-file-support
Browse files Browse the repository at this point in the history
  • Loading branch information
qclaogui authored Mar 12, 2024
2 parents 578112e + 0abf57f commit 4639bff
Show file tree
Hide file tree
Showing 20 changed files with 154 additions and 68 deletions.
121 changes: 99 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,92 +34,169 @@ fmt: ## Uses Grafana Agent to fmt the river config
.PHONY: up-monolithic-mode-metrics
up-monolithic-mode-metrics: ## Run monolithic-mode metrics
$(info ******************** run monolithic-mode metrics ********************)
docker compose --project-directory docker-compose/monolithic-mode/metrics --file docker-compose/monolithic-mode/metrics/docker-compose.yaml up -d --remove-orphans
docker compose \
--project-directory docker-compose/monolithic-mode/metrics \
--file docker-compose/monolithic-mode/metrics/docker-compose.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the metrics.")
down-monolithic-mode-metrics:
docker compose --project-directory docker-compose/monolithic-mode/metrics --file docker-compose/monolithic-mode/metrics/docker-compose.yaml down
docker compose \
--project-directory docker-compose/monolithic-mode/metrics \
--file docker-compose/monolithic-mode/metrics/docker-compose.yaml \
down

.PHONY: up-monolithic-mode-logs
up-monolithic-mode-logs: ## Run monolithic-mode logs
$(info ******************** run monolithic-mode logs ********************)
docker compose --project-directory docker-compose/monolithic-mode/logs --file docker-compose/monolithic-mode/logs/docker-compose.yaml up -d --remove-orphans
docker compose \
--project-directory docker-compose/monolithic-mode/logs \
--file docker-compose/monolithic-mode/logs/docker-compose.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the logs.")
down-monolithic-mode-logs:
docker compose --project-directory docker-compose/monolithic-mode/logs --file docker-compose/monolithic-mode/logs/docker-compose.yaml down
docker compose \
--project-directory docker-compose/monolithic-mode/logs \
--file docker-compose/monolithic-mode/logs/docker-compose.yaml \
down

.PHONY: up-monolithic-mode-traces
up-monolithic-mode-traces: ## Run monolithic-mode traces
$(info ******************** run monolithic-mode traces ********************)
docker compose --project-directory docker-compose/monolithic-mode/traces --file docker-compose/monolithic-mode/traces/docker-compose.yaml up -d --remove-orphans
docker compose \
--project-directory docker-compose/monolithic-mode/traces \
--file docker-compose/monolithic-mode/traces/docker-compose.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the traces.")
down-monolithic-mode-traces:
docker compose --project-directory docker-compose/monolithic-mode/traces --file docker-compose/monolithic-mode/traces/docker-compose.yaml down
docker compose \
--project-directory docker-compose/monolithic-mode/traces \
--file docker-compose/monolithic-mode/traces/docker-compose.yaml \
down

.PHONY: up-monolithic-mode-profiles
up-monolithic-mode-profiles: ## Run monolithic-mode profiles
$(info ******************** run monolithic-mode profiles ********************)
docker compose --project-directory docker-compose/monolithic-mode/profiles --file docker-compose/monolithic-mode/profiles/docker-compose.yaml up -d --remove-orphans
docker compose \
--project-directory docker-compose/monolithic-mode/profiles \
--file docker-compose/monolithic-mode/profiles/docker-compose.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the profiles.")
down-monolithic-mode-profiles:
docker compose --project-directory docker-compose/monolithic-mode/profiles --file docker-compose/monolithic-mode/profiles/docker-compose.yaml down
docker compose \
--project-directory docker-compose/monolithic-mode/profiles \
--file docker-compose/monolithic-mode/profiles/docker-compose.yaml \
down

.PHONY: up-monolithic-mode-all-in-one
up-monolithic-mode-all-in-one: ## Run monolithic-mode all-in-one
$(info ******************** run monolithic-mode all-in-one ********************)
docker compose --project-directory docker-compose/monolithic-mode/all-in-one --file docker-compose/monolithic-mode/all-in-one/docker-compose.yaml up -d --remove-orphans
docker compose \
--project-directory docker-compose/monolithic-mode/all-in-one \
--file docker-compose/monolithic-mode/all-in-one/docker-compose.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the metrics.")
down-monolithic-mode-all-in-one:
docker compose --project-directory docker-compose/monolithic-mode/all-in-one --file docker-compose/monolithic-mode/all-in-one/docker-compose.yaml down
docker compose \
--project-directory docker-compose/monolithic-mode/all-in-one \
--file docker-compose/monolithic-mode/all-in-one/docker-compose.yaml \
down


.PHONY: up-read-write-mode-metrics
up-read-write-mode-metrics: ## Run read-write-mode metrics
$(info ******************** run read-write-mode metrics ********************)
docker compose --project-directory docker-compose/read-write-mode/metrics --file docker-compose/read-write-mode/metrics/docker-compose.yaml up -d --remove-orphans
docker compose \
--project-directory docker-compose/read-write-mode/metrics \
--file docker-compose/read-write-mode/metrics/docker-compose.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the metrics.")
down-read-write-mode-metrics:
docker compose --project-directory docker-compose/read-write-mode/metrics --file docker-compose/read-write-mode/metrics/docker-compose.yaml down
docker compose \
--project-directory docker-compose/read-write-mode/metrics \
--file docker-compose/read-write-mode/metrics/docker-compose.yaml \
down

.PHONY: up-read-write-mode-logs
up-read-write-mode-logs: ## Run read-write-mode logs
$(info ******************** run read-write-mode logs ********************)
docker compose --project-directory docker-compose/read-write-mode/logs --file docker-compose/read-write-mode/logs/docker-compose.yaml up -d --remove-orphans
docker compose \
--project-directory docker-compose/read-write-mode/logs \
--file docker-compose/read-write-mode/logs/docker-compose.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the logs.")
down-read-write-mode-logs:
docker compose --project-directory docker-compose/read-write-mode/logs --file docker-compose/read-write-mode/logs/docker-compose.yaml down
docker compose \
--project-directory docker-compose/read-write-mode/logs \
--file docker-compose/read-write-mode/logs/docker-compose.yaml \
down


.PHONY: up-microservices-mode-metrics
up-microservices-mode-metrics: ## Run microservices-mode metrics
$(info ******************** run microservices-mode metrics ********************)
docker compose --project-directory docker-compose/microservices-mode/metrics --file docker-compose/microservices-mode/metrics/docker-compose.yaml up -d --remove-orphans
docker compose \
--project-directory docker-compose/microservices-mode/metrics \
--file docker-compose/microservices-mode/metrics/docker-compose.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the metrics.")
down-microservices-mode-metrics:
docker compose --project-directory docker-compose/microservices-mode/metrics --file docker-compose/microservices-mode/metrics/docker-compose.yaml down
docker compose \
--project-directory docker-compose/microservices-mode/metrics \
--file docker-compose/microservices-mode/metrics/docker-compose.yaml \
down

.PHONY: up-microservices-mode-logs
up-microservices-mode-logs: ## Run microservices-mode logs
$(info ******************** run microservices-mode logs ********************)
docker compose --project-directory docker-compose/microservices-mode/logs --file docker-compose/microservices-mode/logs/docker-compose.yaml up -d --remove-orphans
docker compose \
--project-directory docker-compose/microservices-mode/logs \
--file docker-compose/microservices-mode/logs/docker-compose.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the logs.")
down-microservices-mode-logs:
docker compose --project-directory docker-compose/microservices-mode/logs --file docker-compose/microservices-mode/logs/docker-compose.yaml down
docker compose \
--project-directory docker-compose/microservices-mode/logs \
--file docker-compose/microservices-mode/logs/docker-compose.yaml \
down

.PHONY: up-microservices-mode-traces
up-microservices-mode-traces: ## Run microservices-mode traces
$(info ******************** run microservices-mode traces ********************)
docker compose --project-directory docker-compose/microservices-mode/traces --file docker-compose/microservices-mode/traces/docker-compose.yaml up -d --remove-orphans
docker compose \
--project-directory docker-compose/microservices-mode/traces \
--file docker-compose/microservices-mode/traces/docker-compose.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the traces.")
down-microservices-mode-traces:
docker compose --project-directory docker-compose/microservices-mode/traces --file docker-compose/microservices-mode/traces/docker-compose.yaml down
docker compose \
--project-directory docker-compose/microservices-mode/traces \
--file docker-compose/microservices-mode/traces/docker-compose.yaml \
down

.PHONY: up-microservices-mode-profiles
up-microservices-mode-profiles: ## Run microservices-mode profiles
$(info ******************** run microservices-mode profiles ********************)
docker compose --project-directory docker-compose/microservices-mode/profiles --file docker-compose/microservices-mode/profiles/docker-compose.yaml up -d --remove-orphans
docker compose \
--project-directory docker-compose/microservices-mode/profiles \
--file docker-compose/microservices-mode/profiles/docker-compose.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the profiles.")
down-microservices-mode-profiles:
docker compose --project-directory docker-compose/microservices-mode/profiles --file docker-compose/microservices-mode/profiles/docker-compose.yaml down
docker compose \
--project-directory docker-compose/microservices-mode/profiles \
--file docker-compose/microservices-mode/profiles/docker-compose.yaml \
down


##@ Kubernetes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
depends_on:
gateway:
condition: service_healthy
image: grafana/agent:v0.40.2
image: ${AGENT_IMAGE:-docker.io/grafana/agent:latest}
volumes:
- ../config/agent-flow:/etc/agent-config
- /var/run/docker.sock:/var/run/docker.sock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
depends_on:
gateway:
condition: service_healthy
image: grafana/agent:v0.40.2
image: ${AGENT_IMAGE:-docker.io/grafana/agent:latest}
volumes:
- ../config/agent-flow:/etc/agent-config
- /var/run/docker.sock:/var/run/docker.sock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
depends_on:
gateway:
condition: service_started
image: grafana/agent:v0.40.2
image: ${AGENT_IMAGE:-docker.io/grafana/agent:latest}
volumes:
- ../config/agent-flow:/etc/agent-config
- /var/run/docker.sock:/var/run/docker.sock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
depends_on:
gateway:
condition: service_healthy
image: grafana/agent:v0.40.2
image: ${AGENT_IMAGE:-docker.io/grafana/agent:latest}
volumes:
- ../config/agent-flow:/etc/agent-config
- /var/run/docker.sock:/var/run/docker.sock
Expand Down
2 changes: 1 addition & 1 deletion docker-compose/common/compose-include/load-mimir-rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
depends_on:
gateway:
condition: service_started
image: grafana/mimirtool:2.11.0
image: ${MIMIRTOOL_IMAGE:-docker.io/grafana/mimirtool:latest}
volumes:
- ../../../monitoring-mixins/mimir-mixin/deploy/rules.yaml:/mimir-mixin/rules.yaml
- ../../../monitoring-mixins/mimir-mixin/deploy/alerts.yaml:/mimir-mixin/alerts.yaml
Expand Down
2 changes: 1 addition & 1 deletion docker-compose/common/compose-include/load-tempo-rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
depends_on:
gateway:
condition: service_started
image: grafana/mimirtool:2.11.0
image: ${MIMIRTOOL_IMAGE:-docker.io/grafana/mimirtool:latest}
volumes:
- ../../../monitoring-mixins/tempo-mixin/deploy/rules.yaml:/tempo-mixin/rules.yaml
- ../../../monitoring-mixins/tempo-mixin/deploy/alerts.yaml:/tempo-mixin/alerts.yaml
Expand Down
2 changes: 1 addition & 1 deletion docker-compose/common/compose-include/minio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
minio:
labels:
- logs.agent.grafana.com/scrape=false
image: minio/minio:RELEASE.2024-03-05T04-48-44Z
image: ${MINIO_IMAGE:-docker.io/minio/minio:latest}
entrypoint:
- sh
- -euc
Expand Down
9 changes: 9 additions & 0 deletions docker-compose/common/config/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
AGENT_IMAGE=grafana/agent:v0.40.2
LOKI_IMAGE=grafana/loki:2.9.5
GRAFANA_IMAGE=grafana/grafana:10.4.0
TEMPO_IMAGE=grafana/tempo:2.4.0
MIMIR_IMAGE=grafana/mimir:2.11.0
MIMIRTOOL_IMAGE=grafana/mimirtool:2.11.0
PYROSCOPE_IMAGE=grafana/pyroscope:1.4.0
NGINX_IMAGE=nginxinc/nginx-unprivileged:1.25-alpine
MINIO_IMAGE=minio/minio:RELEASE.2024-03-05T04-48-44Z
6 changes: 3 additions & 3 deletions docker-compose/microservices-mode/logs/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
depends_on:
distributor:
condition: service_healthy
image: nginxinc/nginx-unprivileged:1.25-alpine
image: ${NGINX_IMAGE:-docker.io/nginxinc/nginx-unprivileged:latest}
volumes:
- ../../common/config/nginx:/etc/nginx/templates
- ../../common/config/loki/gateway_loki.conf.template:/etc/nginx/templates/gateway_loki.conf.template
Expand All @@ -46,7 +46,7 @@ services:
depends_on:
ingester:
condition: service_started
image: &lokiImage grafana/loki:2.9.5
image: &lokiImage ${LOKI_IMAGE:-docker.io/grafana/loki:latest}
volumes:
- ../../common/config/loki/microservices-mode-logs.yaml:/etc/loki.yaml # Note: Loki use microservices-mode-logs.yaml
command:
Expand Down Expand Up @@ -160,7 +160,7 @@ services:
grafana:
labels:
- logs.agent.grafana.com/log-format=logfmt
image: grafana/grafana:10.4.0
image: ${GRAFANA_IMAGE:-docker.io/grafana/grafana:latest}
command:
- --config=/etc/grafana-config/grafana.ini
volumes:
Expand Down
6 changes: 3 additions & 3 deletions docker-compose/microservices-mode/metrics/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
condition: service_healthy
ruler:
condition: service_healthy
image: nginxinc/nginx-unprivileged:1.25-alpine
image: ${NGINX_IMAGE:-docker.io/nginxinc/nginx-unprivileged:latest}
volumes:
- ../../common/config/nginx:/etc/nginx/templates
- ../../common/config/mimir/gateway_mimir.conf.template:/etc/nginx/templates/gateway_mimir.conf.template
Expand All @@ -41,7 +41,7 @@ services:
depends_on:
ingester:
condition: service_started
image: &mimirImage grafana/mimir:2.11.0
image: &mimirImage ${MIMIR_IMAGE:-docker.io/grafana/mimir:latest}
volumes:
- ../../common/config/mimir/microservices-mode-metrics.yaml:/etc/mimir.yaml # Note: Mimir use microservices-mode-metrics.yaml
- ./config/mimir:/etc/mimir
Expand Down Expand Up @@ -213,7 +213,7 @@ services:
- mimir-memberlist

grafana:
image: grafana/grafana:10.4.0
image: ${GRAFANA_IMAGE:-docker.io/grafana/grafana:latest}
command:
- --config=/etc/grafana-config/grafana.ini
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
depends_on:
distributor:
condition: service_healthy
image: nginxinc/nginx-unprivileged:1.25-alpine
image: ${NGINX_IMAGE:-docker.io/nginxinc/nginx-unprivileged:latest}
restart: always
volumes:
- ../../common/config/nginx:/etc/nginx/templates
Expand All @@ -36,7 +36,7 @@ services:
depends_on:
ingester:
condition: service_started
image: &pyroscopeImage grafana/pyroscope:1.4.0
image: &pyroscopeImage ${PYROSCOPE_IMAGE:-docker.io/grafana/pyroscope:latest}
volumes:
- ../../common/config/pyroscope/microservices-mode-profiles.yaml:/etc/config.yaml # Note: profiles use microservices-mode-profiles.yaml
command:
Expand Down Expand Up @@ -173,7 +173,7 @@ services:
- pyroscope-memberlist

grafana:
image: grafana/grafana:10.4.0
image: ${GRAFANA_IMAGE:-docker.io/grafana/grafana:latest}
command:
- --config=/etc/grafana-config/grafana.ini
volumes:
Expand Down
8 changes: 4 additions & 4 deletions docker-compose/microservices-mode/traces/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
depends_on:
distributor:
condition: service_healthy
image: nginxinc/nginx-unprivileged:1.25-alpine
image: ${NGINX_IMAGE:-docker.io/nginxinc/nginx-unprivileged:latest}
restart: always
volumes:
- ../../common/config/nginx:/etc/nginx/templates
Expand Down Expand Up @@ -47,7 +47,7 @@ services:
depends_on:
ingester:
condition: service_started
image: &tempoImage grafana/tempo:2.4.0
image: &tempoImage ${TEMPO_IMAGE:-docker.io/grafana/tempo:latest}
volumes:
- ../../common/config/tempo/microservices-mode-traces.yaml:/etc/tempo.yaml # Note: Tempo use microservices-mode-traces.yaml
command:
Expand Down Expand Up @@ -150,7 +150,7 @@ services:
depends_on:
minio:
condition: service_started
image: grafana/mimir:2.11.0
image: ${MIMIR_IMAGE:-docker.io/grafana/mimir:latest}
volumes:
- ../../common/config/mimir/monolithic-mode-metrics.yaml:/etc/config.yaml
command:
Expand All @@ -173,7 +173,7 @@ services:
depends_on:
agent:
condition: service_started
image: grafana/grafana:10.4.0
image: ${GRAFANA_IMAGE:-docker.io/grafana/grafana:latest}
command:
- --config=/etc/grafana-config/grafana.ini
volumes:
Expand Down
Loading

0 comments on commit 4639bff

Please sign in to comment.