docker: use profiles to optionally enable Prometheus, Loki and Grafana

This is used for demo, it makes sense to also do that for the other
components. This helps test one of the component temporarily, for
example during the e2e tests.
This commit is contained in:
Vincent Bernat
2025-09-06 17:19:57 +02:00
parent a61adbb59b
commit 529a8f69be
9 changed files with 39 additions and 14 deletions

14
.env
View File

@@ -11,15 +11,23 @@ COMPOSE_FILE=${COMPOSE_FILE}:docker/docker-compose-ipinfo.yml
# And you need to update the paths in config/akvorado.yaml. # And you need to update the paths in config/akvorado.yaml.
## Prometheus (metrics) ## Prometheus (metrics)
# COMPOSE_FILE=${COMPOSE_FILE}:docker/docker-compose-prometheus.yml # To enable Prometheus, uncomment the next line.
# COMPOSE_PROFILES=${COMPOSE_PROFILES+${COMPOSE_PROFILES-},}prometheus
COMPOSE_FILE=${COMPOSE_FILE}:docker/docker-compose-prometheus.yml
## Loki (logs) ## Loki (logs)
# COMPOSE_FILE=${COMPOSE_FILE}:docker/docker-compose-loki.yml # To enable Loki, uncomment the next line.
# COMPOSE_PROFILES=${COMPOSE_PROFILES+${COMPOSE_PROFILES-},}loki
COMPOSE_FILE=${COMPOSE_FILE}:docker/docker-compose-loki.yml
## Grafana (visualization) ## Grafana (visualization)
# COMPOSE_FILE=${COMPOSE_FILE}:docker/docker-compose-grafana.yml # To enable Grafana, uncomment the next line.
# COMPOSE_PROFILES=${COMPOSE_PROFILES+${COMPOSE_PROFILES-},}grafana
COMPOSE_FILE=${COMPOSE_FILE}:docker/docker-compose-grafana.yml
## Demo ## Demo
# To enable the demo exporters, uncomment the next line.
# COMPOSE_PROFILES=${COMPOSE_PROFILES+${COMPOSE_PROFILES-},}demo
COMPOSE_FILE=${COMPOSE_FILE}:docker/docker-compose-demo.yml COMPOSE_FILE=${COMPOSE_FILE}:docker/docker-compose-demo.yml
## For testing only: use a ClickHouse cluster ## For testing only: use a ClickHouse cluster

View File

@@ -104,5 +104,7 @@ When using `docker compose`, use the following commands to get an updated
# docker compose up -d # docker compose up -d
``` ```
The `docker-compose-upgrade.tar.gz` tarball contains `.env.dist` instead of `.env`. The `docker-compose-upgrade.tar.gz` tarball contains `.env.dist` instead of
You may want to check for differences with your setup. Usually, there are no differences. `.env`, and `docker/docker-compose-local.yml.dist` instead of
`docker/docker-compose-local.yml.dist`. You may want to check for differences
with your setup.

View File

@@ -928,13 +928,20 @@ Then, you can restart the **outlet** service.
The default Docker Compose setup is meant to help you get started quickly. However, The default Docker Compose setup is meant to help you get started quickly. However,
you can also use it for a production setup. you can also use it for a production setup.
The `.env` file selects the Docker Compose files that are assembled for a You are allowed to modify `.env` and `docker/docker-compose-local.yml`, as well
complete setup. Look at the comments for guidance. You should avoid modifying as anything in `config/`. Everything else will be erased during upgrades.
any existing files, except for `docker/docker-compose-local.yml`, which should
contain your local setup.
This file can override parts of the configuration. The [merge The `.env` file tailors the complete Docker Compose setup. Some parts are
rules](https://docs.docker.com/reference/compose-file/merge/) are a bit complex. enabled using [Docker Compose
profiles](https://docs.docker.com/compose/how-tos/profiles/). You can
temporarily enable them with `--profile` flag to `docker compose`. In this case,
any profile set with `COMPOSE_PROFILES` are overridden. Some other parts require
you to uncomment additional Docker Compose configuration files directly in
`.env`.
This `docker/docker-compose-local.yml` file can override parts of the
configuration. The [merge
rules](https://docs.docker.com/reference/compose-file/merge/) are a bit complex.
The general rule is that scalars are replaced, while lists and mappings are The general rule is that scalars are replaced, while lists and mappings are
merged. However, there are exceptions. merged. However, there are exceptions.

View File

@@ -12,6 +12,8 @@ identified with a specific icon:
## Unreleased ## Unreleased
- 💥 *docker*: use profiles to optionally enable Prometheus, Loki, and Grafana
(if you were already using them, you also need to enable the profile)
- 🩹 *console*: display missing images in documentation - 🩹 *console*: display missing images in documentation
- 🩹 *console*: ensure main table is used when required even when there is no data - 🩹 *console*: ensure main table is used when required even when there is no data
- 🩹 *docker*: fix broken `/metrics` endpoint for inlet - 🩹 *docker*: fix broken `/metrics` endpoint for inlet

View File

@@ -4,8 +4,7 @@ services:
extends: extends:
file: versions.yml file: versions.yml
service: akvorado service: akvorado
profiles: profiles: [ demo ]
- demo
restart: unless-stopped restart: unless-stopped
command: demo-exporter http://akvorado-orchestrator:8080#0 command: demo-exporter http://akvorado-orchestrator:8080#0
depends_on: depends_on:

View File

@@ -189,7 +189,7 @@ services:
file: versions.yml file: versions.yml
service: vector service: vector
restart: "no" restart: "no"
profiles: [manual] profiles: [ manual ]
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro - /var/run/docker.sock:/var/run/docker.sock:ro
- ./vector.yaml:/etc/vector/vector.yaml:ro - ./vector.yaml:/etc/vector/vector.yaml:ro

View File

@@ -6,6 +6,7 @@ services:
extends: extends:
file: versions.yml file: versions.yml
service: grafana service: grafana
profiles: [ grafana ]
environment: environment:
GF_SERVER_ROOT_URL: /grafana GF_SERVER_ROOT_URL: /grafana
GF_SERVER_SERVE_FROM_SUB_PATH: "true" GF_SERVER_SERVE_FROM_SUB_PATH: "true"

View File

@@ -7,6 +7,7 @@ services:
extends: extends:
file: versions.yml file: versions.yml
service: loki service: loki
profiles: [ loki ]
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- akvorado-loki:/loki - akvorado-loki:/loki
@@ -23,6 +24,7 @@ services:
extends: extends:
file: versions.yml file: versions.yml
service: vector service: vector
profiles: [ loki ]
restart: unless-stopped restart: unless-stopped
user: root # for access to /var/run/docker.sock user: root # for access to /var/run/docker.sock
volumes: volumes:

View File

@@ -8,6 +8,7 @@ services:
extends: extends:
file: versions.yml file: versions.yml
service: prometheus service: prometheus
profiles: [ prometheus ]
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- akvorado-prometheus:/prometheus - akvorado-prometheus:/prometheus
@@ -38,6 +39,7 @@ services:
extends: extends:
file: versions.yml file: versions.yml
service: alloy service: alloy
profiles: [ prometheus ]
restart: unless-stopped restart: unless-stopped
user: root # for access to /var/run/docker.sock user: root # for access to /var/run/docker.sock
volumes: volumes:
@@ -69,6 +71,7 @@ services:
extends: extends:
file: versions.yml file: versions.yml
service: node-exporter service: node-exporter
profiles: [ prometheus ]
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- /:/host:ro,rslave - /:/host:ro,rslave
@@ -86,6 +89,7 @@ services:
extends: extends:
file: versions.yml file: versions.yml
service: cadvisor service: cadvisor
profiles: [ prometheus ]
restart: unless-stopped restart: unless-stopped
privileged: true privileged: true
volumes: volumes: