Update Prometheus's data directory mapping + fixed permissions error. #535
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A change 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'snobody
, therefore added the--user 99:100
to override the container's UID got things working smoothly. On UnRAID, UID 99 maps tonobody
, and GID 100 maps tousers
, which should be the default permissions, but you might have to runchown -r nobody:users /mnt/user/appdata/prometheus/
if you copied the data from volume to share, as mentioned above.