42 lines
1.4 KiB
YAML
42 lines
1.4 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
prometheus:
|
|
image: prom/prometheus:v2.51.2
|
|
secrets:
|
|
- basic_auth
|
|
volumes:
|
|
- prometheus-data:/prometheus:rw
|
|
configs:
|
|
- source: prometheus_yml
|
|
target: /etc/prometheus/prometheus.yml
|
|
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"
|
|
- "--storage.tsdb.retention.time=${PROMETHEUS_RETENTION_TIME}"
|
|
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}"
|
|
- "traefik.http.routers.${STACK_NAME}-prometheus.middlewares=basicauth@file"
|
|
|
|
configs:
|
|
prometheus_yml:
|
|
template_driver: golang
|
|
name: ${STACK_NAME}_prometheus_yml_${PROMETHEUS_YML_VERSION}
|
|
file: prometheus.yml.tmpl
|
|
|
|
volumes:
|
|
prometheus-data:
|