commit:     9474d05471b0017b8ed79a6fed8e417e65cd08d3
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 17 18:10:58 2025 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Jan 17 18:13:35 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9474d054

app-metrics/postgres_exporter: add 0.16.0, add systemd service

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 app-metrics/postgres_exporter/Manifest             |  2 +
 .../files/postgres_exporter.service                | 14 ++++++
 .../postgres_exporter-0.16.0.ebuild                | 50 ++++++++++++++++++++++
 3 files changed, 66 insertions(+)

diff --git a/app-metrics/postgres_exporter/Manifest 
b/app-metrics/postgres_exporter/Manifest
index 5bc51b57b3b2..12405126f0dc 100644
--- a/app-metrics/postgres_exporter/Manifest
+++ b/app-metrics/postgres_exporter/Manifest
@@ -2,3 +2,5 @@ DIST postgres_exporter-0.10.1-deps.tar.xz 106506900 BLAKE2B 
3f32d804d9bd07a91ac6
 DIST postgres_exporter-0.10.1.tar.gz 73157 BLAKE2B 
bc56dfdd50878615768fc4e4a193784b73ee48cb1b2743deae21d6caf5db60e3eabe2987cee27742081bea1c506a9c96fb11808304a0007c5e2e252a1e4cb752
 SHA512 
75ba08354174980d55fb1deed1035323d89f3331f0c366165a0262b4081b99d083f14dbcdd7539836399d0d69a75a296cb978a42d94ff0b1c0bcb8f3933fcabc
 DIST postgres_exporter-0.15.0-deps.tar.xz 10107168 BLAKE2B 
2c63161629b7a7aa7e4ca8332f1ad140bfd4c6d496cf860964da4b1897ca67e8716f22db35df6e0558c2764442afea657f3d3e2406762f14b88bf2266f2464f7
 SHA512 
91a0d8b471ef06635ee3520c8b2a15e19ebb9427356602752f0b35d87efacc129709cac50873f94305edf85149d0b9bb0b2cf6d2bfa8d1ec88e6c6a6be1f4880
 DIST postgres_exporter-0.15.0.tar.gz 86818 BLAKE2B 
bf4b3f842c98e82c54eb8393271bd9879a93cd8f28b2fcafa09bbb907caf96c4b728139b08074f1de08295b18d61aaa29b4fb53321164c8b4fc93545f7da5b7a
 SHA512 
332700809454dba11e1e6b9cbc46be9683925a6c692e110efa1204ce1ad1457a8d2237ee8af20f1ee6d5c663266fc1629da6f4f5ff9151faf294a26af8be7682
+DIST postgres_exporter-0.16.0-deps.tar.xz 42043172 BLAKE2B 
0a7adca9f8f93e8bef092492c6b8f6478ca27c61bb31ac9b4427a11579b9a5c232996ae2c9e24d8d04daacb8a6e407468181a6a0a7871fe0b6293de28c4f3194
 SHA512 
f87f1d6e6a5390092b188fcf6510c54d88036ad493bc996d9b2b72941d21606cd7a14e10b9b7cb85800c7ae99400983704309b9edfddc4b9f4adf83cf8d1dde3
+DIST postgres_exporter-0.16.0.tar.gz 88742 BLAKE2B 
2cb8240a350b80bb2681d65f4ba1030f47effb45e9b3e21d260e9bd8ecb8e76d05cf7523b6e0bf973c27457ac547851c71162826a4f88c52b35cce1e22fc0c24
 SHA512 
a4930ec95e0b5eb08712814a99662bdadbdcefd77f9950ca8ffc8015f1df09345aa7992ed2848e5aad505db249be79a0c5d0d8550a9e138f29b3a82e5229ef0e

diff --git a/app-metrics/postgres_exporter/files/postgres_exporter.service 
b/app-metrics/postgres_exporter/files/postgres_exporter.service
new file mode 100644
index 000000000000..d80f6725f7f6
--- /dev/null
+++ b/app-metrics/postgres_exporter/files/postgres_exporter.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=PostgreSQL Exporter
+Documentation="https://github.com/prometheus-community/postgres_exporter";
+
+[Service]
+User=postgres_exporter
+#Environment=DATA_SOURCE_URI=localhost:5432/postgres?sslmode=disable
+#Environment=DATA_SOURCE_USER=postgres
+#Environment=DATA_SOURCE_PASS=password
+#Environment=DATA_SOURCE_PASS_FILE=/path/to/passwordfile
+ExecStart=/usr/bin/postgres_exporter
+
+[Install]
+WantedBy=multi-user.target

diff --git a/app-metrics/postgres_exporter/postgres_exporter-0.16.0.ebuild 
b/app-metrics/postgres_exporter/postgres_exporter-0.16.0.ebuild
new file mode 100644
index 000000000000..83f78935d115
--- /dev/null
+++ b/app-metrics/postgres_exporter/postgres_exporter-0.16.0.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit go-module edo systemd
+
+GIT_COMMIT=a324fe37bca5193a293118b940b3df7ab3a8505c
+
+DESCRIPTION="PostgreSQL stats exporter for Prometheus"
+HOMEPAGE="https://github.com/prometheus-community/postgres_exporter";
+SRC_URI="https://github.com/prometheus-community/postgres_exporter/archive/v${PV}.tar.gz
 -> ${P}.tar.gz"
+SRC_URI+=" 
https://dev.gentoo.org/~arthurzam/distfiles/app-metrics/${PN}/${P}-deps.tar.xz";
+
+LICENSE="Apache-2.0 BSD MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+DEPEND="
+       acct-group/postgres_exporter
+       acct-user/postgres_exporter
+"
+RDEPEND="${DEPEND}"
+BDEPEND="dev-util/promu"
+
+RESTRICT="test"
+
+src_prepare() {
+       default
+       sed -i \
+               -e "s/{{.Branch}}/HEAD/" \
+               -e "s/{{.Revision}}/${GIT_COMMIT}/" \
+               .promu.yml || die "sed failed"
+}
+
+src_compile() {
+       edo promu build -v --prefix bin
+}
+
+src_install() {
+       dobin bin/*
+       dodoc README.md queries.yaml
+
+       newinitd "${FILESDIR}"/${PN}.initd ${PN}
+       newconfd "${FILESDIR}"/${PN}.confd ${PN}
+       systemd_dounit "${FILESDIR}"/${PN}.service
+
+       keepdir /var/log/${PN}
+       fowners ${PN}:${PN} /var/log/${PN}
+}

Reply via email to