~alpine/aports

community/pushgateway: new aport v2 APPLIED

Drew DeVault: 1
 community/pushgateway: new aport

 4 files changed, 66 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.alpinelinux.org/~alpine/aports/patches/3765/mbox | git am -3
Learn more about email & git

[PATCH v2] community/pushgateway: new aport Export this patch

---
 community/pushgateway/APKBUILD                | 44 +++++++++++++++++++
 community/pushgateway/pushgateway.confd       |  4 ++
 community/pushgateway/pushgateway.initd       | 14 ++++++
 community/pushgateway/pushgateway.pre-install |  4 ++
 4 files changed, 66 insertions(+)
 create mode 100644 community/pushgateway/APKBUILD
 create mode 100644 community/pushgateway/pushgateway.confd
 create mode 100644 community/pushgateway/pushgateway.initd
 create mode 100644 community/pushgateway/pushgateway.pre-install

diff --git a/community/pushgateway/APKBUILD b/community/pushgateway/APKBUILD
new file mode 100644
index 0000000000..ebb92eac57
--- /dev/null
+++ b/community/pushgateway/APKBUILD
@@ -0,0 +1,44 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=pushgateway
pkgver=1.4.2
pkgrel=0
pkgdesc="Prometheus push acceptor for ephemeral and batch jobs"
url="https://github.com/prometheus/pushgateway"
arch="all"
license="Apache-2.0"
install="pushgateway.pre-install"
makedepends="go yarn bash"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/prometheus/pushgateway/archive/v$pkgver.tar.gz
	pushgateway.confd
	pushgateway.initd
"
subpackages="$pkgname-openrc"
options="!check" # Broken by integrations we don't care about

build() {
	go mod vendor
	go build \
		-trimpath \
		-mod=vendor \
		-ldflags "-extldflags $LDFLAGS"
}

check() {
	go test ./...
}

package() {
	install -Dm755 pushgateway "$pkgdir"/usr/bin/pushgateway

	install -Dm644 "$srcdir"/pushgateway.confd \
		"$pkgdir"/etc/conf.d/pushgateway
	install -Dm755 "$srcdir"/pushgateway.initd \
		"$pkgdir"/etc/init.d/pushgateway
}

sha512sums="
7b1da7eecf03c4f7b493d025920e93c52333becf7da6a2d7bdd0eb6f9a2a4a5d08b00786d0796682a465d84750e2c8092cdb1c4ca59a08f15b8b586d6eaa5f1a  pushgateway-1.4.2.tar.gz
39b797f6a38b02f84f94cfdbc5c860af060b044eaf98d7ec99909c4abcb9bf6112755bbd21460bfda9825b31715e403fedb6c88158072cd79d985429bcb5cf01  pushgateway.confd
8dec09ad9b420da54f6f9434307c07d905c4bb17c2bc68fc4863e2bc2288ae1c8faf5757485ad4b0ebb89a78e907f6ccaf11f8379e8ab71e5e88f7c741657f6f  pushgateway.initd
"
diff --git a/community/pushgateway/pushgateway.confd b/community/pushgateway/pushgateway.confd
new file mode 100644
index 0000000000..ef34175c7d
--- /dev/null
+++ b/community/pushgateway/pushgateway.confd
@@ -0,0 +1,4 @@
pushgateway_bind_address=':9091'

output_log=/var/log/pushgateway.log
error_log=/var/log/pushgateway.log
diff --git a/community/pushgateway/pushgateway.initd b/community/pushgateway/pushgateway.initd
new file mode 100644
index 0000000000..2975f0cc07
--- /dev/null
+++ b/community/pushgateway/pushgateway.initd
@@ -0,0 +1,14 @@
#!/sbin/openrc-run
name="pushgateway"
description="Prometheus push acceptor for ephemeral and batch jobs"
supervisor=supervise-daemon
command=/usr/bin/pushgateway
command_args="--web.listen-address=$pushgateway_bind_address"
command_user="prometheus:prometheus"

start_pre() {
	[ -n "$output_log" ] && checkpath -f "$output_log" \
		-m 644 -o prometheus:prometheus
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o prometheus:prometheus
}
diff --git a/community/pushgateway/pushgateway.pre-install b/community/pushgateway/pushgateway.pre-install
new file mode 100644
index 0000000000..004fd0bcb9
--- /dev/null
+++ b/community/pushgateway/pushgateway.pre-install
@@ -0,0 +1,4 @@
#!/bin/sh
grep '^prometheus:' /etc/group >/dev/null || addgroup -S prometheus 2>/dev/null
grep '^prometheus:' /etc/passwd >/dev/null || adduser -SDh/var/lib/prometheus \
	-s/sbin/nologin -Gprometheus -gprometheus prometheus prometheus 2>/dev/null
-- 
2.34.0