playground/docker-stack/grafana.yml

53 lines
1.6 KiB
YAML

version: "3.9"
networks:
host-network:
name: host
external: true
prometheus-network:
external: true
traefik-network:
external: true
services:
grafana-service:
image: docker.io/grafana/grafana:latest
hostname: grafana-service-host
tty: true
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- DS_NODE_NAME="{{.Node.Hostname}}"
- DS_SERVICE_NAME="{{.Service.Name}}"
- DS_TASK_NAME="{{.Task.Name}}"
networks:
- prometheus-network
- traefik-network
##depends_on:
## - prometheus-service
deploy:
mode: replicated
replicas: 1
placement:
max_replicas_per_node: 1
##constraints:
## - node.labels.location == home
## - node.hostname == rose
resources:
limits:
memory: 1GB
restart_policy:
condition: on-failure
labels:
- traefik.enable=true
##- traefik.docker.network=traefik-network
- traefik.http.routers.grafana-https.entrypoints=websec
- traefik.http.routers.grafana-https.rule=Host(`gf.miflux.com`)
- traefik.http.routers.grafana-https.tls=true
##- traefik.http.routers.grafana-http.entrypoints=web
##- traefik.http.routers.grafana-http.rule=Host(`gf.miflux.com`)
##- traefik.http.routers.grafana-http.tls=false
- traefik.http.services.grafana-service.loadbalancer.server.port=3000
- traefik.http.services.grafana-service.loadbalancer.sticky.cookie=true
- traefik.http.services.grafana-service.loadbalancer.sticky.cookie.name=grafana-sticker