playground/docker-stack/prometheus.yml

65 lines
1.7 KiB
YAML
Raw Normal View History

2022-10-09 16:59:31 +00:00
version: "3.8"
networks:
host-network:
name: host
external: true
prometheus-network:
external: true
traefik-network:
external: true
services:
prometheus-socat-service:
image: docker.io/alpine/socat
hostname: prometheus-socat-service-host
command: tcp-listen:2375,fork,reuseaddr unix-connect:/var/run/docker.sock
environment:
- DS_NODE_NAME="{{.Node.Hostname}}"
- DS_SERVICE_NAME="{{.Service.Name}}"
- DS_TASK_NAME="{{.Task.Name}}"
volumes:
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
networks:
- prometheus-network
deploy:
mode: global
placement:
constraints:
- node.role == manager
prometheus-service:
image: docker.io/prom/prometheus:latest
hostname: prometheus-service-host
tty: true
environment:
- DS_NODE_NAME="{{.Node.Hostname}}"
- DS_SERVICE_NAME="{{.Service.Name}}"
- DS_TASK_NAME="{{.Task.Name}}"
networks:
- prometheus-network
ports:
- target: 9090
published: 9090
protocol: tcp
mode: ingress
volumes:
- type: bind
source: /home/gfs-data/prometheus/etc
target: /etc/prometheus
read_only: true
- type: bind
source: /home/gfs-data/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
deploy:
mode: replicated
replicas: 1