Hello!
I’ve been working on setting up a monitoring solution for my Home Assistant setup. Configuring InfluxDB and Grafana was pretty straightforward. Now, I want to add Prometheus to the mix. However, there isn’t a Prometheus add-on available for Home Assistant.
To address this, I decided to use Portainer, which installed without any issues. I created a stack using the Docker Compose file shared below. The stack started up, but I encountered some confusion regarding how the volumes are being handled.
Although protection mode is disabled on the add-on, Portainer isn’t mounting the existing folder. Instead, it’s trying to create a new folder in /data/compose/20
, with the number increasing each time I attempt to create the stack.
If I let Portainer create the volumes, the stack is created successfully, but no folders are generated on the local file system.
I realize this topic covers multiple aspects, but I’d really like to hear your thoughts on this.
Thanks in advance!
And here’s my current Docker Compose configuration:
volumes:
prometheus_data: {}
prometheus_etc: {}
services:
prometheus:
image: prom/prometheus:2.54.1
container_name: prometheus
volumes:
# - /homeassistant/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml -> does not work
- prometheus_etc:/etc/prometheus
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=200h'
- '--web.enable-lifecycle'
restart: unless-stopped
expose:
- 9090
ports:
- 9090:9090
labels:
org.label-schema.group: "monitoring"