From 4f35eca9501909c87ca6591f35e6c5fb617e5ba6 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Thu, 30 Jan 2025 20:46:45 -0600 Subject: [PATCH] app-metrics/prometheus: add 3.1.0 Closes: https://bugs.gentoo.org/905861 Closes: https://bugs.gentoo.org/947414 Signed-off-by: William Hubbs --- app-metrics/prometheus/Manifest | 3 ++ app-metrics/prometheus/files/prometheus-3.confd | 25 +++++++++ app-metrics/prometheus/files/prometheus-3.initd | 40 ++++++++++++++ app-metrics/prometheus/files/prometheus-3.service | 20 +++++++ app-metrics/prometheus/prometheus-3.1.0.ebuild | 63 +++++++++++++++++++++++ 5 files changed, 151 insertions(+) create mode 100644 app-metrics/prometheus/files/prometheus-3.confd create mode 100644 app-metrics/prometheus/files/prometheus-3.initd create mode 100644 app-metrics/prometheus/files/prometheus-3.service create mode 100644 app-metrics/prometheus/prometheus-3.1.0.ebuild diff --git a/app-metrics/prometheus/Manifest b/app-metrics/prometheus/Manifest index b393e94cab9f..613b21cf8c9c 100644 --- a/app-metrics/prometheus/Manifest +++ b/app-metrics/prometheus/Manifest @@ -1,3 +1,6 @@ DIST prometheus-2.52.0-assets.tar.xz 40948988 BLAKE2B 6c5812c7b0470e796f9f052be4c4248ee4dcacbaeccd0aa5bb136a4775ce939870f9b366cd87ec325cd93364e69e04b1bbef461842d6fe850cd7e3d9d08fd652 SHA512 0f12548dd97a0aa19379a3090fcad7002cd2917cff59937630302edb6d9f6be49b91476111f9ef23bc3f4a009f2a9ff871e1fa78a765543fd7ac9eacd0233228 DIST prometheus-2.52.0-deps.tar.xz 136485640 BLAKE2B aba4869ca0aa810c9651737f9089c0a5c64ec6f54f9bb1fec7e8e51fbc3042033e4935128af59cf5f9059e2815119e95b1bd8db4d1ce316f2a5af2d32913e2c4 SHA512 11c63ba8a96a8cad655d6f66accb4528d4562c21f9cec671d63120246d3a963690d0d27b0e41e3a24882e2c111b42e0f678d244ebb8a712a794f90eb9b415b5c DIST prometheus-2.52.0.tar.gz 6192779 BLAKE2B 488483b32ee0927f2d0aa5d7bd1f82dee39c0e8273244a0260421f1523c2555541d35d02d869d2a35b434d41ff3210ce9da4a5430ae1f5a41a9d7e250d24246f SHA512 6ad5825ee6dfe6ba82ad8f091cb1fd8bfaf323558f0171c8e16fccb070fa99865cc9e9137a60405a5ec7c90706469cefefbe25c47e47bc37c30de671981955e3 +DIST prometheus-3.1.0-assets.tar.xz 78517784 BLAKE2B df17c7a545d1efe770d70d0d250d03bc8c1887df34fedde3a785de1c03004de209c0d30287bd7abd134550afac39152c57a3e37271ca3baa5487e40b3352f300 SHA512 96293cc3395e5a3a7a7b64ee3c8372255e1cfe9986145f09656a82dfea19019fff517ffd622de9edfa93fa62bb02dac09cd1e85bec105190eae359aa0e88a1f9 +DIST prometheus-3.1.0-deps.tar.xz 126208728 BLAKE2B 36007a7ea302badaee745a49fb706f870c62c6ed9dd1ad5616ebf70e5cde05b5f7d8143c3d1a1f6bfbaca7dae1b00fb0d83347814245fe2a6db10073a85b6175 SHA512 1740230d930bf038e5d7eb1655e506bda88f2161be9d831ab06902d7559c12973367d13b05aa9c0d3f44a8f9cd9a0ac1e14a2e162da775e6f1cee4b97e0e18cf +DIST prometheus-3.1.0.tar.gz 4973352 BLAKE2B ac8f68002f3924f79ee2a75aed8ea585fc09a9d0188e2b5e97152896717f04855124335ca6713e97c399109c6d087c1098dd2dc1485440dca775c5e34a5a52ef SHA512 9e61ba2aae62319f0da8b01a52d033f504adb5155955cc0d74bef251aa06b7a01f9df8e3347ceb1031826ec7518773423a342c6ee526b9d48577701594c973bc diff --git a/app-metrics/prometheus/files/prometheus-3.confd b/app-metrics/prometheus/files/prometheus-3.confd new file mode 100644 index 000000000000..48aaab780b62 --- /dev/null +++ b/app-metrics/prometheus/files/prometheus-3.confd @@ -0,0 +1,25 @@ +# additional arguments for Prometheus +# +# command_args should not be set in this file. Instead, you should set +# prometheus_args. +# +# The default settings are listed below. +# If you are not changing these settings, you do +# not need to include them in prometheus_args. +# +# To migrate from using command_args to prometheus_args, drop any of the +# default settings below that you have set the same way then switch to +# prometheus_args. +# +# The new behavior is that prometheus_args will be appended to these +# defaults allowing anything you add to override them. +# +#The default settings are: +# +# --web.enable-lifecycle +# --config.file=/etc/prometheus/prometheus.yml +# --storage.tsdb.path=/var/lib/prometheus/data +# --web.listen-address=0.0.0.0:9090 +# --web.enable-admin-api +# +prometheus_args="" diff --git a/app-metrics/prometheus/files/prometheus-3.initd b/app-metrics/prometheus/files/prometheus-3.initd new file mode 100644 index 000000000000..4cf7e157c1e9 --- /dev/null +++ b/app-metrics/prometheus/files/prometheus-3.initd @@ -0,0 +1,40 @@ +#!/sbin/openrc-run +# Copyright 2016-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +description="Prometheus monitoring system and time series database" +pidfile=/var/run/${RC_SVCNAME}.pid +user=${user:-${RC_SVCNAME}} +group=${group:-${RC_SVCNAME}} +command_user=${user}:${group} + +command="/usr/bin/prometheus" +command_args=" + --web.enable-lifecycle + --config.file=/etc/prometheus/prometheus.yml + --storage.tsdb.path=/var/lib/prometheus/data + --web.listen-address=0.0.0.0:9090 + --web.enable-admin-api + ${prometheus_args}" +command_background="true" +error_log=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log +output_log=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log + +extra_started_commands="reload" + +depend() { + after net +} + +reload() { + ebegin "Reloading configuration for ${RC_SVCNAME}" + case "$supervisor" in + supervise-daemon) + supervise-daemon ${RC_SVCNAME} --signal HUP + ;; + *) + start-stop-daemon --signal HUP --pidfile "${pidfile}" + ;; + esac + eend $? "Failed to reload ${RC_SVCNAME}" +} diff --git a/app-metrics/prometheus/files/prometheus-3.service b/app-metrics/prometheus/files/prometheus-3.service new file mode 100644 index 000000000000..a3a7e5813662 --- /dev/null +++ b/app-metrics/prometheus/files/prometheus-3.service @@ -0,0 +1,20 @@ +[Unit] +Description=Prometheus +Wants=network-online.target +After=network-online.target + +[Service] +Type=simple +User=prometheus +Group=prometheus +ExecStart=/usr/bin/prometheus \ + --web.enable-lifecycle \ + --config.file=/etc/prometheus/prometheus.yml \ + --storage.tsdb.path="/var/lib/prometheus/data" \ + --web.listen-address=0.0.0.0:9090 \ + --web.enable-admin-api + +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/app-metrics/prometheus/prometheus-3.1.0.ebuild b/app-metrics/prometheus/prometheus-3.1.0.ebuild new file mode 100644 index 000000000000..d5df0158a22f --- /dev/null +++ b/app-metrics/prometheus/prometheus-3.1.0.ebuild @@ -0,0 +1,63 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit go-module systemd + +GIT_COMMIT=7086161a93b262aa0949dbf2aba15a5a7b13e0a3 +MY_PV=v${PV/_rc/-rc.} + +# To create the assets tarball run the following: +# git checkout +# make assets-compress +# tar -acf web/ui + +DESCRIPTION="Prometheus monitoring system and time series database" +HOMEPAGE="https://prometheus.io" +SRC_URI="https://github.com/prometheus/prometheus/archive/${MY_PV}.tar.gz -> ${P}.tar.gz + https://dev.gentoo.org/~williamh/dist/${P}-deps.tar.xz + https://dev.gentoo.org/~williamh/dist/${P}-assets.tar.xz" + +LICENSE="Apache-2.0 BSD BSD-2 ISC MIT MPL-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~riscv" + +COMMON_DEPEND="acct-group/prometheus + acct-user/prometheus" +DEPEND="!app-metrics/prometheus-bin + ${COMMON_DEPEND}" +RDEPEND="${COMMON_DEPEND}" + +BDEPEND=">=dev-util/promu-0.3.0" + +RESTRICT=" test" + +src_prepare() { + default + sed -i \ + -e "s/{{.Branch}}/HEAD/" \ + -e "s/{{.Revision}}/${GIT_COMMIT}/" \ + -e "s/{{.Version}}/${PV}/" \ + .promu.yml || die + cp -a -u "${WORKDIR}"/web/ui web || die "cp failed" +} + +src_compile() { + emake PROMU="${EPREFIX}"/usr/bin/promu common-build plugins +} + +src_install() { + dobin prometheus promtool + dodoc -r documentation/{images,*.md} *.md docs + insinto /etc/prometheus + doins -r documentation/examples/prometheus.yml + insinto /usr/share/prometheus + doins -r documentation/examples + + systemd_dounit "${FILESDIR}"/prometheus-3.service + newinitd "${FILESDIR}"/prometheus-3.initd prometheus + newconfd "${FILESDIR}"/prometheus-3.confd prometheus + keepdir /var/log/prometheus /var/lib/prometheus + fowners prometheus:prometheus /var/log/prometheus /var/lib/prometheus +} -- 2.11.4.GIT