mirror of
https://github.com/hassio-addons/addon-prometheus.git
synced 2025-05-04 11:11:24 +00:00
fix: make Prometheus run as root
Following guidance in https://github.com/hassio-addons/addon-prometheus/pull/49#discussion_r926048521. Tested in local dev container.
This commit is contained in:
parent
84aa6d580e
commit
d0e295dc83
3 changed files with 2 additions and 8 deletions
|
@ -30,7 +30,6 @@ RUN \
|
|||
\
|
||||
&& curl -J -L -o /tmp/prometheus.tar.gz \
|
||||
"https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.linux-${ARCH}.tar.gz" \
|
||||
&& adduser -s /bin/false -D -H prometheus \
|
||||
&& cd /tmp \
|
||||
&& tar -xvf /tmp/prometheus.tar.gz \
|
||||
&& mkdir -p /etc/prometheus \
|
||||
|
@ -39,7 +38,6 @@ RUN \
|
|||
&& cp -R prometheus-${PROMETHEUS_VERSION}.linux-${ARCH}/console_libraries/ /etc/prometheus/ \
|
||||
&& cp -R prometheus-${PROMETHEUS_VERSION}.linux-${ARCH}/consoles/ /etc/prometheus/ \
|
||||
&& rm -r prometheus-${PROMETHEUS_VERSION}.linux-${ARCH} \
|
||||
&& chown -R prometheus:prometheus /etc/prometheus \
|
||||
&& pip3 install \
|
||||
--no-cache-dir \
|
||||
--prefer-binary \
|
||||
|
|
|
@ -3,11 +3,10 @@ bashio::log.info 'Starting prometheus config generator...'
|
|||
|
||||
if ! bashio::fs.directory_exists /share/prometheus/targets; then
|
||||
mkdir -p /share/prometheus/targets
|
||||
chown -R prometheus:prometheus /share/prometheus/targets
|
||||
fi
|
||||
|
||||
cd /opt/prometheus-configgen || bashio::exit.nok \
|
||||
"Could not change working directory for prometheus-configgen."
|
||||
|
||||
# Run Prometheus
|
||||
exec s6-setuidgid prometheus python3 combiner
|
||||
exec python3 combiner
|
||||
|
|
|
@ -28,18 +28,15 @@ done
|
|||
|
||||
if ! bashio::fs.directory_exists /data/prometheus; then
|
||||
mkdir -p /data/prometheus
|
||||
chown prometheus:prometheus /data/prometheus
|
||||
fi
|
||||
|
||||
if ! bashio::fs.directory_exists /share/prometheus/rules; then
|
||||
mkdir -p /share/prometheus/rules
|
||||
chown -R prometheus:prometheus /share/prometheus/rules
|
||||
fi
|
||||
|
||||
if ! bashio::fs.directory_exists /share/prometheus/targets; then
|
||||
mkdir -p /share/prometheus/targets
|
||||
chown -R prometheus:prometheus /share/prometheus/targets
|
||||
fi
|
||||
|
||||
# Run Prometheus
|
||||
exec s6-setuidgid prometheus /usr/local/bin/prometheus "${options[@]}"
|
||||
exec /usr/local/bin/prometheus "${options[@]}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue