From 06c053e6cd71ee0fbbf30ff91f1a03bb2b0135e8 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 21 Apr 2019 19:17:07 -0400 Subject: [PATCH] prometheus/alertmanager: new APKBUILD --- prometheus/alertmanager/APKBUILD | 43 ++++++++++++++++++++++ prometheus/alertmanager/alertmanager.initd | 21 +++++++++++ 2 files changed, 64 insertions(+) create mode 100644 prometheus/alertmanager/APKBUILD create mode 100644 prometheus/alertmanager/alertmanager.initd diff --git a/prometheus/alertmanager/APKBUILD b/prometheus/alertmanager/APKBUILD new file mode 100644 index 0000000..84ef49c --- /dev/null +++ b/prometheus/alertmanager/APKBUILD @@ -0,0 +1,43 @@ +# Maintainer: Drew DeVault +pkgname=alertmanager +pkgver=0.16.2 +pkgrel=0 +pkgdesc="Prometheus Alertmanager" +url="https://github.com/prometheus/alertmanager" +arch="all" +license="Apache-2.0" +makedepends="go bzr" +source=" + $pkgname-$pkgver.tar.gz::https://github.com/prometheus/alertmanager/archive/v$pkgver.tar.gz + alertmanager.initd +" +subpackages="$pkgname-openrc" +builddir="$srcdir/$pkgname-$pkgver" +options="!check" # broken time tests upstream + +build() { + cd "$builddir" + go build -o alertmanager cmd/alertmanager/main.go + go build -o amtool cmd/amtool/main.go +} + +check() { + cd "$builddir" + go test ./... +} + +package() { + cd "$builddir" + install -Dm755 alertmanager "$pkgdir"/usr/bin/alertmanager + install -Dm755 amtool "$pkgdir"/usr/bin/amtool + + install -Dm755 examples/ha/alertmanager.yml \ + "$pkgdir"/etc/alertmanager/alertmanager.yml + install -d -m755 -o 211 -g 211 "$pkgdir"/var/lib/alertmanager + + install -Dm755 "$srcdir"/alertmanager.initd \ + "$pkgdir"/etc/init.d/alertmanager +} + +sha512sums="94012739c5c9691ff34bb521e220e00de13ef866451ffaaa8d45f85c228c6b515a84550a819b351db36e3da7c17a0fa397b5b1c6a4cbc3451442f5064a0184a3 alertmanager-0.16.2.tar.gz +40c5fd04ce4d501bbd33b16abab77d47fee98cb035f9786ae231f052edbc8c6e2a3c09505269ab2c7ff6c44f3a3c129f54df7c8abe92033750666097b77668fe alertmanager.initd" diff --git a/prometheus/alertmanager/alertmanager.initd b/prometheus/alertmanager/alertmanager.initd new file mode 100644 index 0000000..b9c6de3 --- /dev/null +++ b/prometheus/alertmanager/alertmanager.initd @@ -0,0 +1,21 @@ +#!/sbin/openrc-run +name="alertmanager" +description="prometheus alertmanager" + +depend() { + need net +} + +start() { + ebegin "Starting $name" + start-stop-daemon -C --background --make-pidfile --pidfile /run/$name.pid \ + --exec /usr/bin/alertmanager -- \ + --config.file=/etc/alertmanager/alertmanager.yml + eend $? +} + +stop() { + ebegin "Stopping $name" + start-stop-daemon --stop --exec /usr/bin/alertmanager --pidfile /run/$name.pid + eend $? +} -- 2.45.2