132 lines
4.2 KiB
YAML
132 lines
4.2 KiB
YAML
---
|
|
version: "3.8"
|
|
|
|
services:
|
|
app:
|
|
image: grafana/grafana:8.4.4
|
|
volumes:
|
|
- grafana-data:/var/lib/grafana:rw
|
|
configs:
|
|
- source: grafana_datasources_yml
|
|
target: /etc/grafana/provisioning/datasources/datasources.yml
|
|
- source: grafana_dashboards_yml
|
|
target: /etc/grafana/provisioning/dashboards/dashboards.yml
|
|
- source: grafana_swarm_dashboard_json
|
|
target: /var/lib/grafana/dashboards/docker-swarm-nodes.json
|
|
- source: grafana_stacks_dashboard_json
|
|
target: /var/lib/grafana/dashboards/docker-swarm-stacks.json
|
|
- source: grafana_traefik_dashboard_json
|
|
target: /var/lib/grafana/dashboards/traefik.json
|
|
networks:
|
|
- proxy
|
|
- internal
|
|
environment:
|
|
- GF_SMTP_HOST
|
|
- GF_SMTP_ENABLED
|
|
- GF_SMTP_FROM_ADDRESS
|
|
- GF_SMTP_SKIP_VERIFY
|
|
- GF_SECURITY_ALLOW_EMBEDDING
|
|
- GF_INSTALL_PLUGINS=grafana-piechart-panel
|
|
- GF_SERVER_ROOT_URL=https://${GRAFANA_DOMAIN}
|
|
deploy:
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.services.${STACK_NAME}-grafana.loadbalancer.server.port=3000"
|
|
- "traefik.http.routers.${STACK_NAME}-grafana.rule=Host(`${GRAFANA_DOMAIN}`)"
|
|
- "traefik.http.routers.${STACK_NAME}-grafana.entrypoints=web-secure"
|
|
- "traefik.http.routers.${STACK_NAME}-grafana.tls=true"
|
|
- "traefik.http.routers.${STACK_NAME}-grafana.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
|
healthcheck:
|
|
test: "wget -q http://localhost:3000/ -O/dev/null"
|
|
interval: 5s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
prometheus:
|
|
image: prom/prometheus:v2.34.0
|
|
volumes:
|
|
- prometheus-data:/prometheus:rw
|
|
configs:
|
|
- source: prometheus_yml
|
|
target: /etc/prometheus/prometheus.yml
|
|
networks:
|
|
- proxy
|
|
- internal
|
|
deploy:
|
|
restart_policy:
|
|
condition: on-failure
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.services.${STACK_NAME}_prometheus.loadbalancer.server.port=9090"
|
|
- "traefik.http.routers.${STACK_NAME}-prometheus.rule=Host(`${PROMETHEUS_DOMAIN}`)"
|
|
- "traefik.http.routers.${STACK_NAME}-prometheus.entrypoints=web-secure"
|
|
- "traefik.http.routers.${STACK_NAME}-prometheus.tls=true"
|
|
- "traefik.http.routers.${STACK_NAME}-prometheus.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
|
healthcheck:
|
|
test: "wget -q http://localhost:9090/graph -O/dev/null"
|
|
interval: 5s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
loki:
|
|
image: grafana/loki:2.0.0
|
|
command: -config.file=/etc/loki/local-config.yaml
|
|
networks:
|
|
- internal
|
|
deploy:
|
|
endpoint_mode: dnsrr
|
|
ports:
|
|
- target: 3100
|
|
published: 3100
|
|
protocol: tcp
|
|
mode: host
|
|
configs:
|
|
- source: loki_yml
|
|
target: /etc/loki/local-config.yaml
|
|
volumes:
|
|
- loki-data:/loki
|
|
secrets:
|
|
- loki_aws_secret_access_key
|
|
|
|
configs:
|
|
prometheus_yml:
|
|
template_driver: golang
|
|
name: ${STACK_NAME}_prometheus_yml_${PROMETHEUS_YML_VERSION}
|
|
file: prometheus.yml.tmpl
|
|
loki_yml:
|
|
template_driver: golang
|
|
name: ${STACK_NAME}_loki_yml_${LOKI_YML_VERSION}
|
|
file: loki.yml.tmpl
|
|
grafana_datasources_yml:
|
|
name: ${STACK_NAME}_grafana_datasources_yml_${GRAFANA_DATASOURCES_YML_VERSION}
|
|
file: grafana-datasources.yml
|
|
grafana_dashboards_yml:
|
|
name: ${STACK_NAME}_grafana_dashboards_yml_${GRAFANA_DASHBOARDS_YML_VERSION}
|
|
file: grafana-dashboards.yml
|
|
grafana_swarm_dashboard_json:
|
|
name: ${STACK_NAME}_grafana_swarm_dashboard_json_${GRAFANA_SWARM_DASHBOARD_JSON_VERSION}
|
|
file: grafana-swarm-dashboard.json
|
|
grafana_stacks_dashboard_json:
|
|
name: ${STACK_NAME}_grafana_stacks_dashboard_json_${GRAFANA_STACKS_DASHBOARD_JSON_VERSION}
|
|
file: grafana-stacks-dashboard.json
|
|
grafana_traefik_dashboard_json:
|
|
name: ${STACK_NAME}_grafana_traefik_dashboard_json_${GRAFANA_TRAEFIK_DASHBOARD_JSON_VERSION}
|
|
file: grafana-traefik-dashboard.json
|
|
|
|
volumes:
|
|
prometheus-data:
|
|
grafana-data:
|
|
loki-data:
|
|
|
|
networks:
|
|
proxy:
|
|
external: true
|
|
internal:
|
|
|
|
secrets:
|
|
loki_aws_secret_access_key:
|
|
external: true
|
|
name: ${STACK_NAME}_loki_aws_secret_access_key_${SECRET_LOKI_AWS_ACCESS_KEY_VERSION}
|