From e563dbf3e953b429a47690aae2703b650a704cb1 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 26 Feb 2020 11:00:51 -0500 Subject: [PATCH] prom-aggregation-gateway: new aport --- sr.ht/prom-aggregation-gateway/APKBUILD | 44 +++++++++++++++++++ .../prom-aggregation-gateway.confd | 4 ++ .../prom-aggregation-gateway.initd | 15 +++++++ .../prom-aggregation-gateway.pre-install | 4 ++ 4 files changed, 67 insertions(+) create mode 100644 sr.ht/prom-aggregation-gateway/APKBUILD create mode 100644 sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.confd create mode 100644 sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.initd create mode 100644 sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.pre-install diff --git a/sr.ht/prom-aggregation-gateway/APKBUILD b/sr.ht/prom-aggregation-gateway/APKBUILD new file mode 100644 index 0000000..ecbddfe --- /dev/null +++ b/sr.ht/prom-aggregation-gateway/APKBUILD @@ -0,0 +1,44 @@ +# Maintainer: Drew DeVault +pkgname=prom-aggregation-gateway +_commit=2912c3f9fadb640217f4b004e41737fef2b4ae36 +pkgver=0_git20200204 +pkgrel=0 +pkgdesc="An aggregating push gateway for Prometheus" +url="https://github.com/weaveworks/prom-aggregation-gateway" +arch="all" +license="LGPL-3.0-only" +install="prom-aggregation-gateway.pre-install" +makedepends="go" +source=" + $pkgname-$pkgver.tar.gz::https://github.com/weaveworks/prom-aggregation-gateway/archive/$_commit.tar.gz + prom-aggregation-gateway.confd + prom-aggregation-gateway.initd +" +subpackages="$pkgname-openrc" +builddir="$srcdir/$pkgname-$_commit" + +build() { + go mod init github.com/weaveworks/prom-aggregation-gateway + go build \ + -trimpath \ + -mod=vendor \ + -ldflags "-extldflags $LDFLAGS" \ + ./cmd/prom-aggregation-gateway +} + +check() { + go test ./... +} + +package() { + install -Dm755 prom-aggregation-gateway "$pkgdir"/usr/bin/prom-aggregation-gateway + + install -Dm644 "$srcdir"/prom-aggregation-gateway.confd \ + "$pkgdir"/etc/conf.d/prom-aggregation-gateway + install -Dm755 "$srcdir"/prom-aggregation-gateway.initd \ + "$pkgdir"/etc/init.d/prom-aggregation-gateway +} + +sha512sums="1ed2919d05b6f5bdd9d748abc76c69066bc8258da7501d52050f479cd25cd165eaa17c5bb222b7c1f8ecb71829a27dddb0cf526bef03064432f9d4f81665e90c prom-aggregation-gateway-0_git20200204.tar.gz +51986d7caf241a52e81b2a43bb136fbe7110667ba8b75047feaeb3b0e02f82ee3be0e7b91bd795bd49d77bba5a7ac36aeec5a0f35b29c368e83527e77a94fe3c prom-aggregation-gateway.confd +5fcfad70369189b5628fe80f08ab3e9cea029fc291b18606769ad14818330ea8157d9a7d68893a73b891118ea7dcea7c9980698c7a578f5f1ca1637e3699ac7d prom-aggregation-gateway.initd" diff --git a/sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.confd b/sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.confd new file mode 100644 index 0000000..989d65d --- /dev/null +++ b/sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.confd @@ -0,0 +1,4 @@ +prom_aggregation_gateway_bind_address=':9092' + +output_log=/var/log/prom-aggregation-gateway.log +error_log=/var/log/prom-aggregation-gateway.log diff --git a/sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.initd b/sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.initd new file mode 100644 index 0000000..09feb44 --- /dev/null +++ b/sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.initd @@ -0,0 +1,15 @@ +#!/sbin/openrc-run +name="prom-aggregation-gateway" +description="An aggregating push gateway for Prometheus" +supervisor=supervise-daemon +command=/usr/bin/prom-aggregation-gateway +command_args="-listen=$prom_aggregation_gateway_bind_address" +command_user="prometheus:prometheus" +pidfile="/run/${RC_SVCNAME}.pid" + +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/sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.pre-install b/sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.pre-install new file mode 100644 index 0000000..004fd0b --- /dev/null +++ b/sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.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.45.2