Compose-Examples/examples/grafana-monitoring/docker-compose.yml

116 lines
3.3 KiB
YAML
Raw Normal View History

2023-02-15 21:45:31 +00:00
version: "2"
services:
loki:
2024-09-27 19:34:33 +00:00
image: grafana/loki:2.9.10
2023-02-15 21:45:31 +00:00
hostname: loki
container_name: loki
volumes:
2023-02-25 00:57:42 +00:00
- ./volume-data/loki:/etc/loki # place loki-config.yml
2023-02-15 21:45:31 +00:00
ports:
- "127.0.0.1:3100:3100"
restart: unless-stopped
user: 1000:1000
command: -config.file=/etc/loki/loki-config.yml
#networks:
# - monitoring_default
2023-02-15 21:45:31 +00:00
promtail:
image: grafana/promtail:latest
container_name: promtail
depends_on:
- loki
hostname: promtail
volumes:
- /var/log:/var/log:ro # let promtail access the docker host's log files
2023-02-25 00:57:42 +00:00
- ./volume-data/promtail:/etc/promtail # place promtail-config.yml
#- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/traefik/logs:/var/log/traefik # let promtail access your traefik reverse logs
2023-02-15 21:45:31 +00:00
restart: unless-stopped
command: -config.file=/etc/promtail/promtail-config.yml
#networks:
# - monitoring_default
2023-02-15 21:45:31 +00:00
influxdb:
2024-09-27 19:34:33 +00:00
image: influxdb:1.8
2023-02-15 21:45:31 +00:00
container_name: influxdb
hostname: influxdb
restart: unless-stopped
volumes:
- ./volume-data/influxdb/data:/var/lib/influxdb
2023-02-25 00:57:42 +00:00
- ./volume-data/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf:ro # place infuxdb.conf
- ./volume-data/influxdb/init:/docker-entrypoint-initdb.d # place create-database.iql for database init
2023-02-15 21:45:31 +00:00
environment:
- INFLUXDB_ADMIN_USER=admin
- INFLUXDB_ADMIN_PASSWORD=SuperDuperAdminPW
#networks:
# - monitoring_default
2023-02-15 21:45:31 +00:00
telegraf:
image: telegraf:latest
restart: unless-stopped
user: telegraf:$(stat -c '%g' /var/run/docker.sock) # see: https://www.influxdata.com/blog/docker-run-telegraf-as-non-root/
2023-02-15 21:45:31 +00:00
container_name: telegraf
hostname: telegraf
dns:
- 1.1.1.1
- 8.8.8.8
depends_on:
- influxdb
volumes:
2023-02-25 00:57:42 +00:00
- ./volume-data/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro # place telegraf.conf
2023-02-15 21:45:31 +00:00
- /:/hostfs:ro
- /etc:/hostfs/etc:ro
- /proc:/hostfs/proc:ro
- /sys:/hostfs/sys:ro
- /var/run/utmp:/var/run/utmp:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- HOST_ETC=/hostfs/etc
- HOST_PROC=/hostfs/proc
- HOST_SYS=/hostfs/sys
- HOST_MOUNT_PREFIX=/hostfs
#networks:
# - monitoring_default
2023-02-15 21:45:31 +00:00
grafana:
container_name: grafana
hostname: grafana
user: 1000:1000
depends_on:
- influxdb
- loki
- promtail
image: grafana/grafana:latest
restart: unless-stopped
#environment:
# - GF_SERVER_ROOT_URL=https://grafana.example.com # optional
volumes:
- ./volume-data/grafana:/var/lib/grafana
ports:
- 3000:3000
#networks:
# - monitoring_default
2023-02-15 21:45:31 +00:00
#labels:
# - traefik.enable=true
# - traefik.http.routers.grafana.rule=Host(`grafana.example.com`)
# - traefik.http.services.grafana.loadbalancer.server.port=3000
# - traefik.docker.network=proxy
# # Part for local lan services only
# - traefik.http.routers.grafana.middlewares=local-ipwhitelist@file
2024-10-29 16:13:10 +00:00
#prometheus:
# image: prom/prometheus
# container_name: prometheus
# restart: unless-stopped
# expose:
# - 9090
# volumes:
# - ./volume-data/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
# #networks:
# # - monitoring_default
#networks:
# monitoring_default:
# external: true