playground/docker-stack/monitor.yml

106 lines
3.1 KiB
YAML
Raw Permalink Normal View History

2022-10-09 16:59:31 +00:00
version: "3.9"
networks:
host-network:
name: host
external: true
prometheus-network:
external: false
traefik-network:
external: true
services:
prometheus-service:
image: docker.io/prom/prometheus:latest
hostname: prometheus-service-host
networks:
- prometheus-network
volumes:
- type: bind
source: /home/gfs-data/monitor/prometheus/etc
target: /etc/prometheus
read_only: true
- type: bind
source: /home/gfs-data/monitor/prometheus/data
target: /prometheus
read_only: false
##command:
##- --config.file=/etc/prometheus/prometheus.yml
##- --storage.tsdb.path=/prometheus
##- --web.console.libraries=/usr/share/prometheus/console_libraries
##- --web.console.templates=/usr/share/prometheus/consoles
prometheus-node-exporter-service:
image: docker.io/prom/node-exporter:latest
hostname: prometheus-node-exporter-service-host
networks:
- prometheus-network
- host-network
volumes:
- type: bind
source: /
target: /host
read_only: true
bind:
propagation: rslave
pid: host
command:
- --path.rootfs=/host
##- --path.procfs=/host/proc
##- --path.sysfs=/host/sys
##- --collector.filesystem.ignored-mount-points="^/(sys|proc|dev|host|etc)/?.*$$"
##ports:
## - target: 9100
## published: 9100
## protocol: tcp
deploy:
mode: global
##replicas: 3
##placement:
##max_replicas_per_node: 1
##constraints:
## - node.labels.location == home
## - node.hostname == rose
resources:
limits:
memory: 256MB
restart_policy:
condition: on-failure
grafana-service:
image: docker.io/grafana/grafana:latest
hostname: grafana-service-host
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
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