Skip to content

Commit

Permalink
Merge pull request #69 from qclaogui:compose-override-agent
Browse files Browse the repository at this point in the history
add common grafana and grafana-agent
  • Loading branch information
qclaogui authored Mar 25, 2024
2 parents 111458a + d92bc7b commit b6ea84d
Show file tree
Hide file tree
Showing 22 changed files with 278 additions and 374 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ up-read-write-mode-logs: ## Run read-write-mode Loki for logs
--project-name read-write-logs \
--project-directory docker-compose/read-write-mode/logs \
--file docker-compose/read-write-mode/logs/compose.yaml \
--file docker-compose/read-write-mode/logs/compose.override.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the logs.")
Expand Down Expand Up @@ -144,6 +145,7 @@ up-microservices-mode-logs: ## Run microservices-mode Loki for logs
--project-name microservices-logs \
--project-directory docker-compose/microservices-mode/logs \
--file docker-compose/microservices-mode/logs/compose.yaml \
--file docker-compose/microservices-mode/logs/compose.override.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the logs.")
Expand All @@ -157,6 +159,7 @@ up-microservices-mode-traces: ## Run microservices-mode Tempo for traces
--project-name microservices-traces \
--project-directory docker-compose/microservices-mode/traces \
--file docker-compose/microservices-mode/traces/compose.yaml \
--file docker-compose/microservices-mode/traces/compose.override.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the traces.")
Expand All @@ -170,6 +173,7 @@ up-microservices-mode-profiles: ## Run microservices-mode Pyroscope for profiles
--project-name microservices-profiles \
--project-directory docker-compose/microservices-mode/profiles \
--file docker-compose/microservices-mode/profiles/compose.yaml \
--file docker-compose/microservices-mode/profiles/compose.override.yaml \
--env-file docker-compose/common/config/.env \
up -d --remove-orphans
@$(call echo_info, "Go to http://localhost:3000/explore for the profiles.")
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

This quick start guide will show you how to getting started. An simple use case `compose.yaml` like so:

Open a new terminal window create the `compose.yaml`:

```yaml
# include is available in Docker Compose version 2.20 and later, and Docker Desktop version 4.22 and later.
include:
Expand All @@ -29,10 +27,10 @@ services:
github-exporter:
image: githubexporter/github-exporter:latest
environment:
- REPOS=qclaogui/codelab-monitoring,grafana/agent
- REPOS=qclaogui/codelab-monitoring
```
and run:
Open a new terminal window create the `compose.yaml` and run:

```shell
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose up -d --remove-orphans
Expand All @@ -42,7 +40,7 @@ Once all containers are up and running you can search for metrics(from Mimir) lo

> In this case you can find `github-exporter` metrics and logs.

More [examples](./examples/)
For more examples, See: [examples/](./examples/)

---

Expand Down
32 changes: 0 additions & 32 deletions docker-compose/common/compose-include/agent-collect-logs.yaml

This file was deleted.

32 changes: 0 additions & 32 deletions docker-compose/common/compose-include/agent-collect-profiles.yaml

This file was deleted.

32 changes: 0 additions & 32 deletions docker-compose/common/compose-include/agent-collect-traces.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ services:
networks:
default:
aliases:
- grafana-agent-cluster
- grafana-agent-cluster
25 changes: 25 additions & 0 deletions docker-compose/common/compose-include/grafana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

services:
grafana:
labels:
logs.agent.grafana.com/log-format: logfmt
image: ${GRAFANA_IMAGE:-docker.io/grafana/grafana:10.4.1}
command:
- --config=/etc/grafana-config/grafana.ini
volumes:
- ../config/grafana/grafana.ini:/etc/grafana-config/grafana.ini
- ../config/grafana/dashboards:/var/lib/grafana/dashboards
- ../config/grafana/provisioning:/etc/grafana/provisioning
- ../../../monitoring-mixins/agent-flow-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/agent-flow-mixin
- ../../../monitoring-mixins/go-runtime-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/go-runtime-mixin
- ../../../monitoring-mixins/loki-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/loki-mixin
- ../../../monitoring-mixins/mimir-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/mimir-mixin
- ../../../monitoring-mixins/pyroscope-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/pyroscope-mixin
- ../../../monitoring-mixins/memcached-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/memcached-mixin
# - ../../../monitoring-mixins/tempo-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/tempo-mixin
environment:
- GF_LOG_LEVEL=warn
- GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD:-admin_password}
- GF_FEATURE_TOGGLES_ENABLE=traceqlEditor tracesEmbeddedFlameGraph traceqlSearch correlations metricsSummary traceToMetrics traceToProfiles
ports:
- "3000:3000"
12 changes: 12 additions & 0 deletions docker-compose/microservices-mode/logs/compose.override.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

services:
# override included service grafana-agent entrypoint
grafana-agent:
entrypoint:
- /bin/grafana-agent
- run
- /etc/agent-config/logs.river # Note: Agent use logs.river
- --server.http.listen-addr=0.0.0.0:12345
- --cluster.enabled=true
- --cluster.join-addresses=grafana-agent-cluster:12345
- --disable-reporting=true
29 changes: 4 additions & 25 deletions docker-compose/microservices-mode/logs/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ version: '3.9'
include:
- path: ../../common/compose-include/minio.yaml
- path: ../../common/compose-include/memcached.yaml
- path: ../../common/compose-include/agent-collect-logs.yaml
# optional
- path: ../../common/compose-include/mimir.yaml
- path: ../../common/compose-include/grafana-agent.yaml
- path: ../../common/compose-include/grafana.yaml

# https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/agent-flow/modules/docker/README.md
x-labels: &loki-labels
Expand Down Expand Up @@ -43,7 +43,7 @@ services:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3100/ || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
retries: 10
ports:
- "33100:3100"

Expand All @@ -63,7 +63,7 @@ services:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3100/ready || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
retries: 10
deploy:
replicas: 2
networks:
Expand Down Expand Up @@ -162,24 +162,3 @@ services:
default:
aliases:
- loki-memberlist

grafana:
labels:
logs.agent.grafana.com/log-format: logfmt
image: ${GRAFANA_IMAGE:-docker.io/grafana/grafana:10.4.1}
command:
- --config=/etc/grafana-config/grafana.ini
volumes:
- ../../common/config/grafana/grafana.ini:/etc/grafana-config/grafana.ini
- ../../common/config/grafana/dashboards:/var/lib/grafana/dashboards
- ../../common/config/grafana/provisioning:/etc/grafana/provisioning
- ../../../monitoring-mixins/agent-flow-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/agent-flow-mixin
- ../../../monitoring-mixins/go-runtime-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/go-runtime-mixin
- ../../../monitoring-mixins/loki-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/loki-mixin
- ../../../monitoring-mixins/mimir-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/mimir-mixin
- ../../../monitoring-mixins/memcached-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/memcached-mixin
environment:
- GF_LOG_LEVEL=warn
- GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD:-admin_password}
ports:
- "3000:3000"
29 changes: 6 additions & 23 deletions docker-compose/microservices-mode/metrics/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ version: '3.9'
include:
- path: ../../common/compose-include/minio.yaml
- path: ../../common/compose-include/memcached.yaml
- path: ../../common/compose-include/agent-collect-metrics.yaml
- path: ../../common/compose-include/load-rules-to-mimir.yaml
- path: ../../common/compose-include/grafana-agent.yaml
- path: ../../common/compose-include/grafana.yaml

services:
gateway:
Expand All @@ -37,7 +38,7 @@ services:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8080/ || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
retries: 10
ports:
- "38080:8080"

Expand All @@ -56,7 +57,7 @@ services:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8080/ready || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
retries: 10
deploy:
replicas: 2
networks:
Expand Down Expand Up @@ -115,7 +116,7 @@ services:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8080/ready || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
retries: 10
deploy:
replicas: 2

Expand All @@ -134,7 +135,7 @@ services:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8080/ready || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
retries: 10
networks:
default:
aliases:
Expand Down Expand Up @@ -205,21 +206,3 @@ services:
default:
aliases:
- mimir-memberlist

grafana:
image: ${GRAFANA_IMAGE:-docker.io/grafana/grafana:10.4.1}
command:
- --config=/etc/grafana-config/grafana.ini
volumes:
- ../../common/config/grafana/grafana.ini:/etc/grafana-config/grafana.ini
- ../../common/config/grafana/dashboards:/var/lib/grafana/dashboards
- ../../common/config/grafana/provisioning:/etc/grafana/provisioning
- ../../../monitoring-mixins/mimir-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/mimir-mixin
- ../../../monitoring-mixins/agent-flow-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/agent-flow-mixin
- ../../../monitoring-mixins/go-runtime-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/go-runtime-mixin
- ../../../monitoring-mixins/memcached-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/memcached-mixin
environment:
- GF_LOG_LEVEL=warn
- GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD:-admin_password}
ports:
- "3000:3000"
11 changes: 11 additions & 0 deletions docker-compose/microservices-mode/profiles/compose.override.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

services:
grafana-agent: # override included service grafana-agent entrypoint
entrypoint:
- /bin/grafana-agent
- run
- /etc/agent-config/profiles.river # Note: Agent use profiles.river
- --server.http.listen-addr=0.0.0.0:12345
- --cluster.enabled=true
- --cluster.join-addresses=grafana-agent-cluster:12345
- --disable-reporting=true
Loading

0 comments on commit b6ea84d

Please sign in to comment.