From 7e86fc0c79ee1e8df931afbbeb5e5c900e8ee187 Mon Sep 17 00:00:00 2001
From: Thomas Dunne <700257+mcteo@users.noreply.github.com>
Date: Sun, 8 Dec 2024 02:10:34 +0000
Subject: [PATCH] Update Prometheus's data directory mapping + fixed
permissions error.
A [change](https://github.com/prometheus/prometheus/commit/ceb844aa1ad7511ee22ecfee65fe34ba59a987df) to the Dockerfile for Prometheus has overridden the default data storage directory from `/prometheus/data` to `/prometheus`. This means any new containers created using this template will technically continue to work, but due to the data being stored in a transient docker volume, and not on the intended UnRAID appdata share, the data will not survive the container being recreated.
I noticed this myself when trying to find why Grafana only showed a weeks worth of data, despite the Prometheus being configured by default to retain 15 days. (and I clean up docker volumes every so often).
N.B. This will overwrite the data currently in your docker volume, with your presumedly empty appdata folder. To get around this, I manually copied `/prometheus/*` to `/prometheus/data/` before applying this update.
After making this change on my own server, the Prometheus container refused to start, due to permission denied when reading the new data. I found this was because while the container's process is configured to run as `nobody`, the UID doesn't match the UID of UnRAID's `nobody`, therefore added the `--user 99:100` to override the container's UID got things working smoothly.
---
templates/prometheus.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/templates/prometheus.xml b/templates/prometheus.xml
index 4c2f7b4c..58497a25 100644
--- a/templates/prometheus.xml
+++ b/templates/prometheus.xml
@@ -12,7 +12,8 @@
Productivity:
https://raw.githubusercontent.com/selfhosters/unRAID-CA-templates/master/templates/prometheus.xml
https://raw.githubusercontent.com/selfhosters/unRAID-CA-templates/master/templates/img/prometheus.png
+ --user 99:100
-
+