aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwener <wenermail@gmail.com>2020-09-14 13:20:46 +0000
committerLeo <thinkabit.ukim@gmail.com>2020-09-16 12:22:39 +0000
commite373aac8ae9047190f59cde9b14362e17a145319 (patch)
treee3552269567c2107cb6637d2a9668ad2778d7f2f
parent5c10c01b5f9d2a901471b0fa645989fd1d81d95e (diff)
downloadaports-e373aac8ae9047190f59cde9b14362e17a145319.tar.gz
aports-e373aac8ae9047190f59cde9b14362e17a145319.tar.bz2
aports-e373aac8ae9047190f59cde9b14362e17a145319.tar.xz
testing/thanos: new aport
-rw-r--r--testing/thanos/APKBUILD66
-rw-r--r--testing/thanos/thanos.confd3
-rw-r--r--testing/thanos/thanos.initd17
-rw-r--r--testing/thanos/thanos.pre-install4
4 files changed, 90 insertions, 0 deletions
diff --git a/testing/thanos/APKBUILD b/testing/thanos/APKBUILD
new file mode 100644
index 0000000000..1decc8aaac
--- /dev/null
+++ b/testing/thanos/APKBUILD
@@ -0,0 +1,66 @@
+# Contributor: wener <wenermail@gmail.com>
+# Maintainer: wener <wenermail@gmail.com>
+pkgname=thanos
+pkgver=0.15.0
+pkgrel=0
+pkgdesc="Highly available Prometheus setup with long term storage capabilities. CNCF Sandbox project."
+url="https://github.com/thanos-io/thanos"
+arch="all"
+license="Apache-2.0"
+install="thanos.pre-install"
+makedepends="go prometheus tzdata"
+subpackages="$pkgname-openrc"
+source="
+ $pkgname-$pkgver.tar.gz::https://github.com/thanos-io/thanos/archive/v$pkgver.tar.gz
+ thanos.initd
+ thanos.confd
+ "
+
+build() {
+ GOFLAGS="$GOFLAGS -trimpath"
+ GOLDFLAGS="
+ -extldflags '-static'
+ -X github.com/prometheus/common/version.Version=$pkgver
+ -X github.com/prometheus/common/version.Revision=AlpineLinux
+ -X github.com/prometheus/common/version.Branch=master
+ -X github.com/prometheus/common/version.BuildUser=$USER@$HOSTNAME
+ -X github.com/prometheus/common/version.BuildDate=$(date -u "+%Y%m%d-%H:%M:%S" ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH})
+ "
+
+ go build \
+ $GOFLAGS \
+ -ldflags "$GOLDFLAGS" \
+ ./cmd/thanos
+}
+
+check() {
+ # some tests need external storage credentials or running server
+ # pkg/cacheutil go 1.15 compact
+ # pkg/pool alloc too much memory
+ go test $(go list ./... | grep -v \
+ -e 'test/e2e' \
+ -e 'pkg/shipper' \
+ -e 'pkg/store' \
+ -e 'objstore/objtesting' \
+ -e 'pkg/promclient' \
+ -e 'pkg/rules' \
+ -e 'pkg/compact' \
+ -e 'pkg/block' \
+ -e 'pkg/query' \
+ -e 'pkg/cacheutil' \
+ -e 'pkg/pool' \
+ )
+}
+
+package() {
+ install -Dm755 thanos "$pkgdir"/usr/bin/thanos
+
+ install -m755 -D "$srcdir"/$pkgname.initd \
+ "$pkgdir"/etc/init.d/$pkgname
+ install -m644 -D "$srcdir"/$pkgname.confd \
+ "$pkgdir"/etc/conf.d/$pkgname
+}
+
+sha512sums="3c1bc7d797c429356d842e2cb4efdbcbe15ca8a1c54a343f5db9d3734855596ec85b0b80b09b0f3a9a6aa9cfb9683e7188fefad4128b65768d8c298d3afa1e30 thanos-0.15.0.tar.gz
+8407adbc29d90d36550ad16555d0b881d1d1745fba7bf5f4bd4a66bdf4abe196321106881dbba569c7e123d6abfbe78714b6e108b1e3c69b051270c3a46ba5c8 thanos.initd
+c1bc9d71828b176eed964d5f673ea5e5d368f25ca21a3b12dcb8f8987f8bf12f35c06849d7fc4e6ffae52d98a5e636bdb63333930fe640c48e4d02a0b8db620a thanos.confd"
diff --git a/testing/thanos/thanos.confd b/testing/thanos/thanos.confd
new file mode 100644
index 0000000000..5cb315be49
--- /dev/null
+++ b/testing/thanos/thanos.confd
@@ -0,0 +1,3 @@
+
+THANOS_EXEC="sidecar"
+THANOS_OPTIONS=""
diff --git a/testing/thanos/thanos.initd b/testing/thanos/thanos.initd
new file mode 100644
index 0000000000..be5b0bb418
--- /dev/null
+++ b/testing/thanos/thanos.initd
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+
+name=thanos
+description="Highly available Prometheus setup with long term storage capabilities"
+command="/usr/bin/thnaos"
+command_args="$THANOS_EXEC $THANOS_OPTS"
+
+rc_ulimit="${THANOS_ULIMIT:--n 65536}"
+
+start_stop_daemon_args="--user prometheus:prometheus"
+pidfile="/run/$name.pid"
+
+depend() {
+ need net
+ after firewall prometheus
+}
diff --git a/testing/thanos/thanos.pre-install b/testing/thanos/thanos.pre-install
new file mode 100644
index 0000000000..004fd0bcb9
--- /dev/null
+++ b/testing/thanos/thanos.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