switching out promtail for alloy (#22)

* rework grafana log ingestion using alloy

* fix docker-compose.yml formatting
This commit is contained in:
Sven Hüster
2025-05-12 13:34:23 +02:00
committed by GitHub
parent b91ac50586
commit 7971f12489
8 changed files with 316 additions and 88 deletions

View File

@@ -54,20 +54,30 @@ services:
- 3100:3100
volumes:
- ./files/loki:/etc/loki
- ./volumes/logs-node-1:/logs/node-1
- ./volumes/logs-node-2:/logs/node-2
- ./volumes/loki-data:/tmp/loki
command: -config.file=/etc/loki/loki-config.yaml
promtail:
container_name: cs-repro-promtail
image: grafana/promtail:3.2.2
healthcheck:
test:
[
"CMD-SHELL",
"wget --no-verbose --tries=1 --spider http://localhost:3100/loki/api/v1/labels || exit 1",
]
interval: 20s
timeout: 3s
retries: 5
start_period: 40s
alloy:
container_name: cs-repro-alloy
image: grafana/alloy:latest
restart: unless-stopped
ports:
- 9080:9080
- 9999:9999
volumes:
- ./files/promtail:/etc/promtail
- ./volumes/logs-node-1:/logs-node-1
- ./volumes/logs-node-2:/logs-node-2
command: -config.file=/etc/promtail/promtail-config.yaml
- ./files/alloy:/etc/alloy:ro
- ./volumes/alloy/data:/var/lib/alloy/data:rw
- ./volumes/logs-node-1:/mattermost/logs:ro
command: run --server.http.listen-addr=0.0.0.0:9080 --storage.path=/var/lib/alloy/data /etc/alloy/config.alloy
depends_on:
- loki
grafana:
@@ -130,7 +140,7 @@ services:
# - MM_SqlSettings_DataSource=mmuser:mmuser_password@tcp(mysql:3306)/mattermost?charset=utf8mb4,utf8&writeTimeout=30s
## Disable this to migrate your config to the database
# - MM_CONFIG=postgres://mmuser:mmuser_password@cs-repro-postgres:5432/mattermost?sslmode=disable&connect_timeout=10&binary_parameters=yes
# - MM_CONFIG=postgres://mmuser:mmuser_password@cs-repro-postgres:5432/mattermost?sslmode=disable&connect_timeout=10&binary_parameters=yes
keycloak:
container_name: cs-repro-keycloak
restart: unless-stopped
@@ -218,49 +228,49 @@ services:
depends_on:
- postgres
mattermost-2:
platform: linux/amd64
container_name: cs-repro-mattermost-2
depends_on:
postgres:
condition: service_healthy
mitmproxy:
condition: service_started
image: mattermost/mattermost-enterprise-edition:10.7
restart: unless-stopped
security_opt:
- no-new-privileges:true
pids_limit: 200
read_only: false
ports:
- "8066:8065"
- "8068:8067"
tmpfs:
- /tmp
volumes:
- ./volumes/mattermost/config:/mattermost/config:rw
- ./volumes/mattermost/data:/mattermost/data:rw
- ./volumes/logs-node-2:/mattermost-1/logs:rw
- ./volumes/mattermost_2/plugins:/mattermost/plugins:rw
- ./volumes/mattermost_2/client/plugins:/mattermost/client/plugins:rw
- ./volumes/mattermost_2/bleve-indexes:/mattermost/bleve-indexes:rw
# - ./license.mattermost:/mattermost/config/license.mattermost-enterprise:ro
# - ./files/mattermost/samlCert.crt:/mattermost/config/saml-cert.crt
# - ./files/mattermost/defaultConfig.json:/mattermost/config/defaultConfig.json:ro
# - ./files/mattermost/replicaConfig.json:/mattermost/config/replicaConfig.json:ro
platform: linux/amd64
container_name: cs-repro-mattermost-2
depends_on:
postgres:
condition: service_healthy
mitmproxy:
condition: service_started
image: mattermost/mattermost-enterprise-edition:10.7
restart: unless-stopped
security_opt:
- no-new-privileges:true
pids_limit: 200
read_only: false
ports:
- "8066:8065"
- "8068:8067"
tmpfs:
- /tmp
volumes:
- ./volumes/mattermost/config:/mattermost/config:rw
- ./volumes/mattermost/data:/mattermost/data:rw
- ./volumes/logs-node-2:/mattermost-1/logs:rw
- ./volumes/mattermost_2/plugins:/mattermost/plugins:rw
- ./volumes/mattermost_2/client/plugins:/mattermost/client/plugins:rw
- ./volumes/mattermost_2/bleve-indexes:/mattermost/bleve-indexes:rw
# - ./license.mattermost:/mattermost/config/license.mattermost-enterprise:ro
# - ./files/mattermost/samlCert.crt:/mattermost/config/saml-cert.crt
# - ./files/mattermost/defaultConfig.json:/mattermost/config/defaultConfig.json:ro
# - ./files/mattermost/replicaConfig.json:/mattermost/config/replicaConfig.json:ro
## Files are required for the mitmproxy on the box
- ./files/mitmproxy/mitmproxy-ca.pem:/etc/ssl/certs/mitmproxy-ca.pem
- ./files/mitmproxy/mitmproxy-dhparam.pem:/etc/ssl/certs/mitmproxy-dhparam.pem
environment:
- HTTP_PROXY=http://cs-repro-mitmproxy:8080
- HTTPS_PROXY=http://cs-repro-mitmproxy:8080
- MM_SqlSettings_DriverName=postgres
- MM_SqlSettings_DataSource=postgres://mmuser:mmuser_password@cs-repro-postgres:5432/mattermost?sslmode=disable&connect_timeout=10&binary_parameters=yes
- MM_SAMLSETTINGS_IDPCERTIFICATEFILE=/mattermost/config/saml-cert.crt
- MM_ServiceSettings_EnableLocalMode=true
- MM_ServiceSettings_LocalModeSocketLocation=/var/tmp/mattermost_local.socket
- MM_ServiceSettings_LicenseFileLocation=/mattermost/config/license.mattermost-enterprise
- MM_LogSettings_Directory=/mattermost/logs
## Files are required for the mitmproxy on the box
- ./files/mitmproxy/mitmproxy-ca.pem:/etc/ssl/certs/mitmproxy-ca.pem
- ./files/mitmproxy/mitmproxy-dhparam.pem:/etc/ssl/certs/mitmproxy-dhparam.pem
environment:
- HTTP_PROXY=http://cs-repro-mitmproxy:8080
- HTTPS_PROXY=http://cs-repro-mitmproxy:8080
- MM_SqlSettings_DriverName=postgres
- MM_SqlSettings_DataSource=postgres://mmuser:mmuser_password@cs-repro-postgres:5432/mattermost?sslmode=disable&connect_timeout=10&binary_parameters=yes
- MM_SAMLSETTINGS_IDPCERTIFICATEFILE=/mattermost/config/saml-cert.crt
- MM_ServiceSettings_EnableLocalMode=true
- MM_ServiceSettings_LocalModeSocketLocation=/var/tmp/mattermost_local.socket
- MM_ServiceSettings_LicenseFileLocation=/mattermost/config/license.mattermost-enterprise
- MM_LogSettings_Directory=/mattermost/logs
mattermost-rtcd:
container_name: cs-repro-mattermost-rtcd
platform: linux/amd64
@@ -284,28 +294,28 @@ services:
command: mitmweb --web-host 0.0.0.0 --set confdir=/certs --mode transparent
# Named volumes section is removed since we're using host path mounts
# mysql:
# container_name: cs-repro-mysql
# image: mysql:8
# restart: always
# environment:
# MYSQL_DATABASE: "mattermost"
# # So you don't have to use root, but you can if you like
# MYSQL_USER: "mmuser"
# # You can use whatever password you like
# MYSQL_PASSWORD: "mmuser_password"
# # Password for root access
# MYSQL_ROOT_PASSWORD: "mmuser_password"
# healthcheck:
# test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
# timeout: 20supdat
# retries: 10
# ports:
# # <Port exposed> : <MySQL Port running inside container>
# - "3306:3306"
# expose:
# # Opens port 3306 on the container
# - "3306"
# # Where our data will be persisted
# volumes:
# - ./volumes/db/mysql:/var/lib/mysql
# container_name: cs-repro-mysql
# image: mysql:8
# restart: always
# environment:
# MYSQL_DATABASE: "mattermost"
# # So you don't have to use root, but you can if you like
# MYSQL_USER: "mmuser"
# # You can use whatever password you like
# MYSQL_PASSWORD: "mmuser_password"
# # Password for root access
# MYSQL_ROOT_PASSWORD: "mmuser_password"
# healthcheck:
# test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
# timeout: 20supdat
# retries: 10
# ports:
# # <Port exposed> : <MySQL Port running inside container>
# - "3306:3306"
# expose:
# # Opens port 3306 on the container
# - "3306"
# # Where our data will be persisted
# volumes:
# - ./volumes/db/mysql:/var/lib/mysql