Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/production/docker/docker-compose.yaml

210 lines
5.4 KiB

networks:
loki:
volumes:
prometheus:
grafana:
alertmanager-data:
loki:
services:
# Since the Loki containers are running as user 10001 and the mounted data volume is owned by root,
# Loki would not have permissions to create the directories.
# Therefore the init container changes permissions of the mounted directory.
init:
image: &lokiImage grafana/loki:latest
user: root
volumes:
- ./loki:/loki
networks:
- loki
grafana:
image: grafana/grafana:12.3.1@sha256:2175aaa91c96733d86d31cf270d5310b278654b03f5718c59de12a865380a31f
ports:
- "3000:3000"
environment:
GF_AUTH_ANONYMOUS_ENABLED: "true"
GF_AUTH_DISABLE_LOGIN_FORM: "true"
GF_AUTH_ANONYMOUS_ORG_ROLE: "Admin"
volumes:
- ./config/datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yml
- grafana:/var/lib/grafana
networks:
- loki
prometheus:
image: prom/prometheus:v3.9.1@sha256:1f0f50f06acaceb0f5670d2c8a658a599affe7b0d8e78b898c1035653849a702
ports:
- 9090
volumes:
- ./config/prometheus.yaml:/etc/prometheus/prometheus.yml
- prometheus:/prometheus
command:
[
'--log.level=debug',
'--config.file=/etc/prometheus/prometheus.yml',
'--enable-feature=remote-write-receiver',
'--query.lookback-delta=30s'
]
networks:
- loki
# for testing purposes only, disable in production
log-generator:
image: mingrammer/flog
platform: linux/amd64
command:
- --loop
- --format=json
- --number=10 # number of log lines to generate per second
- --delay=100ms # delay between log lines
- --output=/var/log/generated-logs.txt
- --overwrite
- --type=log
volumes:
- ./loki/:/var/log/
promtail:
image: grafana/promtail:latest
volumes:
- ./loki/:/var/log/
- ./config:/etc/promtail/
ports:
- 9080
command: -config.file=/etc/promtail/promtail.yaml
networks:
- loki
minio:
image: minio/minio
entrypoint:
- sh
- -euc
- |
mkdir -p /data/loki-data && \
mkdir -p /data/loki-ruler &&
minio server --address "0.0.0.0:9000" --console-address "0.0.0.0:9001" /data
environment:
- MINIO_ROOT_USER=loki
- MINIO_ROOT_PASSWORD=supersecret
- MINIO_PROMETHEUS_AUTH_TYPE=public
- MINIO_UPDATE=off
ports:
- "9000:9000"
- "9001:9001"
volumes:
- ./.data/minio:/data
networks:
- loki
loki-gateway:
image: nginx:latest
volumes:
- ./config/nginx.conf:/etc/nginx/nginx.conf
ports:
- "8080:80"
- "3100"
networks:
- loki
loki-read:
image: *lokiImage
volumes:
- ./config:/etc/loki/
# only needed for interactive debugging with dlv
# cap_add:
# - SYS_PTRACE
# security_opt:
# - apparmor=unconfined
ports:
- "3100"
- "7946"
# uncomment to use interactive debugging
# - "40000-40002:40000" # makes the replicas available on ports 40000, 40001, 40002
command: "-config.file=/etc/loki/loki.yaml -target=read -legacy-read-mode=false"
networks:
- loki
restart: always
deploy:
mode: replicated
replicas: 3
# Native healthcheck using loki -health command (no shell required)
healthcheck:
test: ["CMD", "/usr/bin/loki", "-health"]
start_period: 30s
interval: 30s
timeout: 10s
retries: 3
loki-write:
image: *lokiImage
volumes:
- ./config:/etc/loki/
# only needed for interactive debugging with dlv
# cap_add:
# - SYS_PTRACE
# security_opt:
# - apparmor=unconfined
ports:
- "3100"
- "7946"
# uncomment to use interactive debugging
# - "50000-50002:40000" # makes the replicas available on ports 50000, 50001, 50002
command: "-config.file=/etc/loki/loki.yaml -target=write"
networks:
- loki
restart: always
deploy:
mode: replicated
replicas: 3
# Native healthcheck using loki -health command (no shell required)
healthcheck:
test: ["CMD", "/usr/bin/loki", "-health"]
start_period: 30s
interval: 30s
timeout: 10s
retries: 3
loki-backend:
image: *lokiImage
volumes:
- ./config:/etc/loki/
- ./rules:/loki/rules:ro
# only needed for interactive debugging with dlv
# cap_add:
# - SYS_PTRACE
# security_opt:
# - apparmor=unconfined
ports:
- "3100"
- "7946"
# uncomment to use interactive debugging
# - "60000-60002:40000" # makes the replicas available on ports 60000, 60001, 60002
command: "-config.file=/etc/loki/loki.yaml -target=backend -legacy-read-mode=false"
networks:
- loki
restart: always
deploy:
mode: replicated
replicas: 3
# # Native healthcheck using loki -health command (no shell required)
healthcheck:
test: ["CMD", "/usr/bin/loki", "-health"]
start_period: 30s
interval: 30s
timeout: 10s
retries: 3
# alertmanager to enable receiving alerts
alertmanager:
image: prom/alertmanager:v0.30.1@sha256:286ad8838533a5a01d89bd09643f43d2b68b65203123b5700e54a8f80ff9c1f4
restart: unless-stopped
ports:
- "9093:9093"
volumes:
- "./config:/config"
- alertmanager-data:/data
command: --config.file=/config/alertmanager.yml --log.level=debug
networks:
- loki