aboutsummaryrefslogtreecommitdiffstats
path: root/community/alertmanager
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-01-08 09:19:39 -0500
committerLeo <thinkabit.ukim@gmail.com>2020-01-09 09:17:04 +0100
commita9ae5d0cb30e26868f3c407a783d15a54617ff91 (patch)
tree7318458e95734341180aa0696789afdf42edde2a /community/alertmanager
parent4f4fc4a3c8a4a60225f5cbc4eb7fe4c0ac6e6424 (diff)
downloadaports-a9ae5d0cb30e26868f3c407a783d15a54617ff91.tar.bz2
aports-a9ae5d0cb30e26868f3c407a783d15a54617ff91.tar.xz
community/alertmanager: new aport
This package is running in production at SourceHut.
Diffstat (limited to 'community/alertmanager')
-rw-r--r--community/alertmanager/APKBUILD59
-rw-r--r--community/alertmanager/alertmanager.confd6
-rw-r--r--community/alertmanager/alertmanager.initd17
-rw-r--r--community/alertmanager/alertmanager.pre-install4
4 files changed, 86 insertions, 0 deletions
diff --git a/community/alertmanager/APKBUILD b/community/alertmanager/APKBUILD
new file mode 100644
index 0000000000..e61bbb2526
--- /dev/null
+++ b/community/alertmanager/APKBUILD
@@ -0,0 +1,59 @@
+# Maintainer: Drew DeVault <sir@cmpwn.com>
+pkgname=alertmanager
+pkgver=0.20.0
+pkgrel=0
+pkgdesc="Prometheus Alertmanager"
+url="https://github.com/prometheus/alertmanager"
+arch="all"
+license="Apache-2.0"
+install="$pkgname.pre-install"
+makedepends="go"
+source="
+ $pkgname-$pkgver.tar.gz::https://github.com/prometheus/alertmanager/archive/v$pkgver.tar.gz
+ alertmanager.confd
+ alertmanager.initd
+"
+subpackages="$pkgname-openrc"
+builddir="$srcdir/$pkgname-$pkgver"
+options="!check" # timing-sensitive upstream tests
+
+build() {
+ ldflags="-extldflags $LDFLAGS \
+ -X github.com/prometheus/common/version.Version=$pkgver \
+ -X github.com/prometheus/common/version.Revision=$pkgrel \
+ -X github.com/prometheus/common/version.Branch=Alpine \
+ -X github.com/prometheus/common/version.BuildUser=Alpine \
+ -X github.com/prometheus/common/version.BuildDate=2020-01-08"
+ go build \
+ -trimpath \
+ -mod=vendor \
+ -ldflags "$ldflags" \
+ ./cmd/alertmanager
+ go build \
+ -trimpath \
+ -mod=vendor \
+ -ldflags "$ldflags" \
+ ./cmd/amtool
+}
+
+check() {
+ go test ./...
+}
+
+package() {
+ install -Dm755 alertmanager "$pkgdir"/usr/bin/alertmanager
+ install -Dm755 amtool "$pkgdir"/usr/bin/amtool
+
+ install -Dm755 "$srcdir"/alertmanager.initd \
+ "$pkgdir"/etc/init.d/alertmanager
+ install -Dm644 "$srcdir"/alertmanager.confd \
+ "$pkgdir"/etc/conf.d/alertmanager
+ install -dm644 "$pkgdir"/var/lib/alertmanager/data
+
+ install -Dm644 examples/ha/alertmanager.yml \
+ "$pkgdir"/etc/alertmanager/alertmanager.yml
+}
+
+sha512sums="4bb9353e6ce9b149c5f22a2c305829112dfdf87f9b74e6075a45be0e07fe0f17e869ef9be4bb5e9c53d215dd1f534b1b5a707dd981efce8c5bcae4c1d6ce18bb alertmanager-0.20.0.tar.gz
+58420cf10ed51ec389d21ffdd5b4a0e588f0dc78b1069e32d0db1e0215f64c1c980d8f539ae902839f2f9342090b50ce1db756839f3676ee18b77548ce8f99c8 alertmanager.confd
+783636612f4521a042e890b3c53fa8c859574a533f540f01bbbb2b12d28b7998c69592e4c5f4d8868d32401ed93ae92ab1fa03129cc9a741d1221cd76eb4fb6b alertmanager.initd"
diff --git a/community/alertmanager/alertmanager.confd b/community/alertmanager/alertmanager.confd
new file mode 100644
index 0000000000..e2304e8691
--- /dev/null
+++ b/community/alertmanager/alertmanager.confd
@@ -0,0 +1,6 @@
+alertmanager_args=
+alertmanager_config_file=/etc/alertmanager/alertmanager.yml
+alertmanager_storage_path=/var/lib/alertmanager/data
+
+output_log=/var/log/alertmanager.log
+error_log=/var/log/alertmanager.log
diff --git a/community/alertmanager/alertmanager.initd b/community/alertmanager/alertmanager.initd
new file mode 100644
index 0000000000..15ef617520
--- /dev/null
+++ b/community/alertmanager/alertmanager.initd
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+name="alertmanager"
+description="alert manager for the prometheus monitoring system"
+supervisor=supervise-daemon
+command=/usr/bin/alertmanager
+command_args="--config.file=$alertmanager_config_file \
+ --storage.path=$alertmanager_storage_path \
+ $alertmanager_args"
+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
+ checkpath -d "$alertmanager_storage_path" -m 755 -o prometheus:prometheus
+}
diff --git a/community/alertmanager/alertmanager.pre-install b/community/alertmanager/alertmanager.pre-install
new file mode 100644
index 0000000000..004fd0bcb9
--- /dev/null
+++ b/community/alertmanager/alertmanager.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