commit: 24113fb2216b36e591a8dcdffdb377084c73cc39 Author: William Hubbs <williamh <AT> gentoo <DOT> org> AuthorDate: Fri Mar 28 17:40:14 2025 +0000 Commit: William Hubbs <williamh <AT> gentoo <DOT> org> CommitDate: Fri Mar 28 17:40:49 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=24113fb2
app-metrics/prometheus: add 3.2.1 Closes: https://bugs.gentoo.org/952110 Signed-off-by: William Hubbs <williamh <AT> gentoo.org> app-metrics/prometheus/Manifest | 3 + app-metrics/prometheus/files/prometheus-3.2.confd | 22 ++++++ app-metrics/prometheus/files/prometheus-3.2.initd | 37 ++++++++++ .../prometheus/files/prometheus-3.2.service | 17 +++++ app-metrics/prometheus/prometheus-3.2.1.ebuild | 79 ++++++++++++++++++++++ 5 files changed, 158 insertions(+) diff --git a/app-metrics/prometheus/Manifest b/app-metrics/prometheus/Manifest index 613b21cf8c9c..1b2c4e76a120 100644 --- a/app-metrics/prometheus/Manifest +++ b/app-metrics/prometheus/Manifest @@ -4,3 +4,6 @@ DIST prometheus-2.52.0.tar.gz 6192779 BLAKE2B 488483b32ee0927f2d0aa5d7bd1f82dee3 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 +DIST prometheus-3.2.1-assets.tar.xz 78754104 BLAKE2B 142dcf8bf5e2fd7d241f5ed0e7d9ed5beaea413b631a8c80b93766aa7554ef125c769d262b6af23efd128eb787d40c673e75dde917fe0ded9518581194c80901 SHA512 8f1b74397d111676a091dc58730e180a9d350726d2195daebd40dad8f90deb7e226919864e4bb7206a1b95cb082e227a19c3406ff53eee177874a0b53e5accc9 +DIST prometheus-3.2.1-deps.tar.xz 137051124 BLAKE2B a0b74c935bfcfc2dc369ed9e3474e4da25f69a1da6d602524b21958858550f892d1c7e1b4d414e9c075445055608910c21b3e72b82076313f733b39e03c42b2e SHA512 b187411b7e3586c638a9c7cdbf3289255e8fee987a95f17e2d606ebfbd31e4926472990ad7d92a0b416592a227a0e238be64b2ce8444312134ce050d619b4e52 +DIST prometheus-3.2.1.tar.gz 5001971 BLAKE2B f341e177c94ca949fa374603d57356ba191daa7ffd5f2edda532cdb4b977f25dbbb241e6a08dc04dbc6aac4c0cf4e5db951c0add5fd92451fecacb9eac2e422f SHA512 6e6a972c23efaba80699d2f82f4ca3fbe2bc81644d9a4540a3a82c556009a5388a2e81e7548792fa01f7cfea8727d3aa8c9e4bc0f0538f0016e0a88502399c51 diff --git a/app-metrics/prometheus/files/prometheus-3.2.confd b/app-metrics/prometheus/files/prometheus-3.2.confd new file mode 100644 index 000000000000..b6857c42ab02 --- /dev/null +++ b/app-metrics/prometheus/files/prometheus-3.2.confd @@ -0,0 +1,22 @@ +# 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. +# +#The default settings are: +# +# --config.file=/etc/prometheus/prometheus.yml +# --storage.tsdb.path=/var/lib/prometheus/data +# +prometheus_args="" diff --git a/app-metrics/prometheus/files/prometheus-3.2.initd b/app-metrics/prometheus/files/prometheus-3.2.initd new file mode 100644 index 000000000000..21242af90625 --- /dev/null +++ b/app-metrics/prometheus/files/prometheus-3.2.initd @@ -0,0 +1,37 @@ +#!/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=" + --config.file=/etc/prometheus/prometheus.yml + --storage.tsdb.path=/var/lib/prometheus/data + ${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.2.service b/app-metrics/prometheus/files/prometheus-3.2.service new file mode 100644 index 000000000000..816a4bab3072 --- /dev/null +++ b/app-metrics/prometheus/files/prometheus-3.2.service @@ -0,0 +1,17 @@ +[Unit] +Description=Prometheus Server +Documentation=https://prometheus.io/docs/ +Wants=network-online.target +After=network-online.target + +[Service] +Type=simple +User=prometheus +Group=prometheus +Restart=always +ExecStart=/usr/bin/prometheus \ + --config.file=/etc/prometheus/prometheus.yml \ + --storage.tsdb.path=/var/lib/prometheus/data + +[Install] +WantedBy=multi-user.target diff --git a/app-metrics/prometheus/prometheus-3.2.1.ebuild b/app-metrics/prometheus/prometheus-3.2.1.ebuild new file mode 100644 index 000000000000..805da2cb56a2 --- /dev/null +++ b/app-metrics/prometheus/prometheus-3.2.1.ebuild @@ -0,0 +1,79 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit go-module systemd eapi9-ver + +GIT_COMMIT=804c49d58f3f3784c77c9c8ec17c9062092cae27 +MY_PV=v${PV/_rc/-rc.} + +# To create the assets tarball run the following: +# git checkout <tag> +# make assets-compress +# tar -acf <tarball> 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.17.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_newunit "${FILESDIR}"/prometheus-3.2.service prometheus.service + newinitd "${FILESDIR}"/prometheus-3.2.initd prometheus + newconfd "${FILESDIR}"/prometheus-3.2.confd prometheus + keepdir /var/log/prometheus /var/lib/prometheus + fowners prometheus:prometheus /var/log/prometheus /var/lib/prometheus +} + +pkg_postinst() { + # added 2025-03-28 to warn about a fix for version 3.1.0 + if ver_replacing -eq 3.1.0; then + ewarn "The systemd service has been renamed from prometheus-3 to prometheus." + fi + # added 2025-03-28 for version 3.2.1 + if ver_replacing -lt 3.2; then + ewarn "The --web.enable-lifecycle and --web.enable-admin-api options have been removed" + ewarn "from the default command line." + ewarn "If you need these options, please enable them in /etc/prometheus/prometheus.yml" + elog + elog "The --web.listen-address option was removed from the default command line" + elog "because we were using the default upstream setting." + fi +}
