Files
computer-playbook/roles/web-app-prometheus/meta/volumes.yml
kevinveenbirkenbachandClaude Opus 5.5 a522b459ec fix(web-app-prometheus): bind the docker data root cAdvisor actually reads
cAdvisor bound a hardcoded /var/lib/docker/. When the daemon keeps its
data root elsewhere, swarm rejects the task because the bind source does
not exist ("invalid mount config for type bind: bind source path does not
exist: /var/lib/docker/") and the stack never converges. In main run
37856203791 all 18 swarm jobs that deploy Prometheus failed this way after
scripts/tests/deploy/utils/filesystem/docker_dataroot.sh moved every node's
data root to /mnt/docker-fs/docker, on ext4, btrfs and zfs alike.

The role now reads DockerRootDir from the daemon on STACK_HOST and binds
that path as source and target. cAdvisor v0.55.1 takes its storage dir from
docker info, so the target has to follow the daemon's root instead of
staying at /var/lib/docker. The probe needs the container CLI and a running
daemon, which a single-role compose deploy only gets later from
sys-svc-container inside sys-stk-backend, so the role loads it first under
the usual run-once guard.

Verified with a local compose deploy of variant 2: the rendered compose file
carries /var/lib/docker:/var/lib/docker:ro from the probe and cAdvisor runs
healthy.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 09:30:43 +02:00

108 lines
2.3 KiB
YAML

---
data:
type: volume
name: prometheus_data
mounts:
- service: prometheus
target: /prometheus
alertmanager_data:
type: volume
name: prometheus_alertmanager_data
mounts:
- service: alertmanager
target: /alertmanager
prometheus_config:
type: config
source: "{{ [lookup('container', 'web-app-prometheus', 'directories.config'), 'prometheus.yml'] | path_join }}"
mode: "0444"
mounts:
- service: prometheus
target: /etc/prometheus/prometheus.yml
alert_rules:
type: config
source: "{{ [lookup('container', 'web-app-prometheus', 'directories.config'), 'alert_rules.yml'] | path_join }}"
mode: "0444"
mounts:
- service: prometheus
target: /etc/prometheus/alert_rules.yml
blackbox_config:
type: config
source: "{{ [lookup('container', 'web-app-prometheus', 'directories.config'), 'blackbox.yml'] | path_join }}"
mode: "0444"
mounts:
- service: blackbox-exporter
target: /etc/blackbox_exporter/config.yml
alertmanager_config:
type: config
source: "{{ [lookup('container', 'web-app-prometheus', 'directories.config'), 'alertmanager.yml'] | path_join }}"
mode: "0444"
mounts:
- service: alertmanager
target: /etc/alertmanager/alertmanager.yml
host_rootfs:
type: bind
source: "/"
read_only: true
mounts:
- service: cadvisor
target: &rootfs_target /rootfs
- service: node-exporter
target: *rootfs_target
host_var_run:
type: bind
source: "/var/run"
read_only: true
mounts:
- service: cadvisor
target: /var/run
host_sys:
type: bind
source: "/sys"
read_only: true
mounts:
- service: cadvisor
target: /sys
- service: node-exporter
target: /host/sys
host_var_lib_docker:
type: bind
source: &docker_root "{{ prometheus_docker_info.stdout }}"
read_only: true
mounts:
- service: cadvisor
target: *docker_root
host_dev_disk:
type: bind
source: "/dev/disk/"
read_only: true
mounts:
- service: cadvisor
target: /dev/disk
when: "{{ DEPLOYMENT_MODE == 'compose' }}"
host_proc:
type: bind
source: "/proc"
read_only: true
mounts:
- service: node-exporter
target: /host/proc
metrics_textfile:
type: bind
source: "{{ DIR_METRICS_TEXTFILE }}"
read_only: true
mounts:
- service: node-exporter
target: /host/textfile