|
| 1 | +networks: |
| 2 | + logging: |
| 3 | + driver: bridge |
| 4 | + |
| 5 | +volumes: |
| 6 | + loki-data: |
| 7 | + grafana-data: |
| 8 | + |
| 9 | +services: |
| 10 | + |
| 11 | + loki: |
| 12 | + image: grafana/loki:{{ loki_version }} |
| 13 | + container_name: loki |
| 14 | + ports: |
| 15 | + - "{{ loki_port }}:{{ loki_port }}" |
| 16 | + volumes: |
| 17 | + - {{ monitoring_dir }}/loki/config.yml:/etc/loki/config.yml:ro |
| 18 | + - loki-data:/loki |
| 19 | + command: -config.file=/etc/loki/config.yml |
| 20 | + networks: |
| 21 | + - logging |
| 22 | + healthcheck: |
| 23 | + test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:{{ loki_port }}/ready || exit 1"] |
| 24 | + interval: 10s |
| 25 | + timeout: 5s |
| 26 | + retries: 5 |
| 27 | + start_period: 20s |
| 28 | + deploy: |
| 29 | + resources: |
| 30 | + limits: |
| 31 | + cpus: '{{ loki_cpu_limit }}' |
| 32 | + memory: {{ loki_memory_limit }} |
| 33 | + restart: unless-stopped |
| 34 | + |
| 35 | + promtail: |
| 36 | + image: grafana/promtail:{{ promtail_version }} |
| 37 | + container_name: promtail |
| 38 | + volumes: |
| 39 | + - {{ monitoring_dir }}/promtail/config.yml:/etc/promtail/config.yml:ro |
| 40 | + - /var/lib/docker/containers:/var/lib/docker/containers:ro |
| 41 | + - /var/run/docker.sock:/var/run/docker.sock:ro |
| 42 | + command: -config.file=/etc/promtail/config.yml |
| 43 | + networks: |
| 44 | + - logging |
| 45 | + depends_on: |
| 46 | + loki: |
| 47 | + condition: service_healthy |
| 48 | + deploy: |
| 49 | + resources: |
| 50 | + limits: |
| 51 | + cpus: '{{ promtail_cpu_limit }}' |
| 52 | + memory: {{ promtail_memory_limit }} |
| 53 | + restart: unless-stopped |
| 54 | + |
| 55 | + grafana: |
| 56 | + image: grafana/grafana:{{ grafana_version }} |
| 57 | + container_name: grafana |
| 58 | + ports: |
| 59 | + - "{{ grafana_port }}:3000" |
| 60 | + volumes: |
| 61 | + - grafana-data:/var/lib/grafana |
| 62 | + environment: |
| 63 | + - GF_AUTH_ANONYMOUS_ENABLED=false |
| 64 | + - GF_SECURITY_ADMIN_USER={{ grafana_admin_user }} |
| 65 | + - GF_SECURITY_ADMIN_PASSWORD={{ grafana_admin_password }} |
| 66 | + networks: |
| 67 | + - logging |
| 68 | + depends_on: |
| 69 | + loki: |
| 70 | + condition: service_healthy |
| 71 | + healthcheck: |
| 72 | + test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1"] |
| 73 | + interval: 10s |
| 74 | + timeout: 5s |
| 75 | + retries: 5 |
| 76 | + start_period: 30s |
| 77 | + deploy: |
| 78 | + resources: |
| 79 | + limits: |
| 80 | + cpus: '{{ grafana_cpu_limit }}' |
| 81 | + memory: {{ grafana_memory_limit }} |
| 82 | + restart: unless-stopped |
0 commit comments