From 882efcb1cf763cae2b5f1e88a4df6239de9d901c Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 12 Jun 2022 22:09:06 +0200 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrades=20add-on=20base?= =?UTF-8?q?=20image=20to=2012.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prometheus/Dockerfile | 18 +++++++++--------- prometheus/build.yaml | 6 +++--- prometheus/config.yaml | 1 + .../rootfs/etc/cont-init.d/prometheus.sh | 6 +++++- .../rootfs/etc/fix-attrs.d/01-prometheus | 1 - .../etc/services.d/prometheus-configgen/finish | 10 ++++++---- .../etc/services.d/prometheus-configgen/run | 2 +- .../rootfs/etc/services.d/prometheus/finish | 10 ++++++---- .../rootfs/etc/services.d/prometheus/run | 2 +- 9 files changed, 32 insertions(+), 24 deletions(-) mode change 100644 => 100755 prometheus/rootfs/etc/cont-init.d/prometheus.sh delete mode 100644 prometheus/rootfs/etc/fix-attrs.d/01-prometheus mode change 100644 => 100755 prometheus/rootfs/etc/services.d/prometheus-configgen/finish mode change 100644 => 100755 prometheus/rootfs/etc/services.d/prometheus/finish diff --git a/prometheus/Dockerfile b/prometheus/Dockerfile index 21f4c4b..c081a79 100755 --- a/prometheus/Dockerfile +++ b/prometheus/Dockerfile @@ -1,4 +1,4 @@ -ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:11.1.0 +ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:12.0.0 # hadolint ignore=DL3006 FROM ${BUILD_FROM} @@ -18,15 +18,15 @@ RUN \ && if [ "${BUILD_ARCH}" = "aarch64" ]; then ARCH="arm64"; fi \ \ && apk --no-cache add \ - python3=3.9.7-r4 \ - py3-idna=3.3-r0 \ - py3-certifi=2020.12.5-r1 \ - py3-chardet=4.0.0-r2 \ - py3-yaml=5.4.1.1-r1 \ - py3-urllib3=1.26.7-r0 \ - py3-requests=2.26.0-r1 \ + python3=3.10.4-r \ + py3-idna=3.3-r2 \ + py3-certifi=2021.10.8-r0 \ + py3-chardet=4.0.0-r3 \ + py3-yaml=6.0-r0 \ + py3-urllib3=1.26.9-r0 \ + py3-requests=2.27.1-r0 \ && apk --no-cache add --virtual .builddeps \ - py-pip=20.3.4-r1 \ + py-pip=22.1.1-r0 \ \ && 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" \ diff --git a/prometheus/build.yaml b/prometheus/build.yaml index 566bd51..bbd995f 100644 --- a/prometheus/build.yaml +++ b/prometheus/build.yaml @@ -1,8 +1,8 @@ --- build_from: - aarch64: ghcr.io/hassio-addons/base/aarch64:11.1.0 - amd64: ghcr.io/hassio-addons/base/amd64:11.1.0 - armv7: ghcr.io/hassio-addons/base/armv7:11.1.0 + aarch64: ghcr.io/hassio-addons/base/aarch64:12.0.0 + amd64: ghcr.io/hassio-addons/base/amd64:12.0.0 + armv7: ghcr.io/hassio-addons/base/armv7:12.0.0 codenotary: base_image: codenotary@frenck.dev signer: codenotary@frenck.dev diff --git a/prometheus/config.yaml b/prometheus/config.yaml index f98839c..eeecb47 100644 --- a/prometheus/config.yaml +++ b/prometheus/config.yaml @@ -9,6 +9,7 @@ startup: services ingress: true ingress_port: 9090 ingress_entry: graph +init: false panel_icon: mdi:chart-timeline panel_title: Prometheus arch: diff --git a/prometheus/rootfs/etc/cont-init.d/prometheus.sh b/prometheus/rootfs/etc/cont-init.d/prometheus.sh old mode 100644 new mode 100755 index 7f4f38e..eede632 --- a/prometheus/rootfs/etc/cont-init.d/prometheus.sh +++ b/prometheus/rootfs/etc/cont-init.d/prometheus.sh @@ -1,6 +1,10 @@ -#!/usr/bin/with-contenv bashio +#!/command/with-contenv bashio # ============================================================================== # Home Assistant Community Add-on: Prometheus # Configures Prometheus # ============================================================================== echo "${SUPERVISOR_TOKEN}" > '/run/home-assistant.token' + +mkdir -p /data/prometheus +find /data/prometheus -not -perm 0644 -type f -exec chmod 0660 {} \; +find /data/prometheus -not -perm 0755 -type d -exec chmod 0770 {} \; diff --git a/prometheus/rootfs/etc/fix-attrs.d/01-prometheus b/prometheus/rootfs/etc/fix-attrs.d/01-prometheus deleted file mode 100644 index 1a1eb87..0000000 --- a/prometheus/rootfs/etc/fix-attrs.d/01-prometheus +++ /dev/null @@ -1 +0,0 @@ -/data/prometheus true prometheus 0660 0770 diff --git a/prometheus/rootfs/etc/services.d/prometheus-configgen/finish b/prometheus/rootfs/etc/services.d/prometheus-configgen/finish old mode 100644 new mode 100755 index c2a8d04..b560db5 --- a/prometheus/rootfs/etc/services.d/prometheus-configgen/finish +++ b/prometheus/rootfs/etc/services.d/prometheus-configgen/finish @@ -1,9 +1,11 @@ -#!/usr/bin/execlineb -S0 +#!/command/with-contenv bashio # ============================================================================== # Home Assistant Community Add-on: Prometheus # Take down the S6 supervision tree when Prometheus fails # ============================================================================== -if { s6-test ${1} -ne 0 } -if { s6-test ${1} -ne 256 } +if [[ "${1}" -ne 0 ]] && [[ "${1}" -ne 256 ]]; then + bashio::log.warning "Prometheus config crashed, halting add-on" + exec /run/s6/basedir/bin/halt +fi -s6-svscanctl -t /var/run/s6/services +bashio::log.info "Prometheus config stopped, restarting..." diff --git a/prometheus/rootfs/etc/services.d/prometheus-configgen/run b/prometheus/rootfs/etc/services.d/prometheus-configgen/run index 7219eff..d1efb9d 100755 --- a/prometheus/rootfs/etc/services.d/prometheus-configgen/run +++ b/prometheus/rootfs/etc/services.d/prometheus-configgen/run @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bashio +#!/command/with-contenv bashio bashio::log.info 'Starting prometheus config generator...' if ! bashio::fs.directory_exists /share/prometheus/targets; then diff --git a/prometheus/rootfs/etc/services.d/prometheus/finish b/prometheus/rootfs/etc/services.d/prometheus/finish old mode 100644 new mode 100755 index c2a8d04..9733507 --- a/prometheus/rootfs/etc/services.d/prometheus/finish +++ b/prometheus/rootfs/etc/services.d/prometheus/finish @@ -1,9 +1,11 @@ -#!/usr/bin/execlineb -S0 +#!/command/with-contenv bashio # ============================================================================== # Home Assistant Community Add-on: Prometheus # Take down the S6 supervision tree when Prometheus fails # ============================================================================== -if { s6-test ${1} -ne 0 } -if { s6-test ${1} -ne 256 } +if [[ "${1}" -ne 0 ]] && [[ "${1}" -ne 256 ]]; then + bashio::log.warning "Prometheus crashed, halting add-on" + exec /run/s6/basedir/bin/halt +fi -s6-svscanctl -t /var/run/s6/services +bashio::log.info "Prometheus stopped, restarting..." diff --git a/prometheus/rootfs/etc/services.d/prometheus/run b/prometheus/rootfs/etc/services.d/prometheus/run index deb569a..19c8174 100755 --- a/prometheus/rootfs/etc/services.d/prometheus/run +++ b/prometheus/rootfs/etc/services.d/prometheus/run @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bashio +#!/command/with-contenv bashio # shellcheck disable=SC2191 # ============================================================================== # Home Assistant Community Add-on: Prometheus