# Contributor: Michael Pirogov # Maintainer: Michael Pirogov pkgname=loki pkgver=2.8.2 pkgrel=1 pkgdesc="Like Prometheus, but for logs" options="net" url="https://github.com/grafana/loki" license="Apache-2.0" # limited by 64 bit, ppc fails tests arch="x86_64 aarch64 riscv64" makedepends="go bash" checkdepends="tzdata" subpackages="$pkgname-logcli $pkgname-promtail-openrc:promtail_openrc $pkgname-promtail $pkgname-openrc" source="$pkgname-$pkgver.tar.gz::https://github.com/grafana/loki/archive/refs/tags/v$pkgver.tar.gz $pkgname.initd $pkgname.confd $pkgname-promtail.confd $pkgname-promtail.initd goflags.patch " export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}" export GOTMPDIR="${GOTMPDIR:-"$srcdir"}" export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}" export GOFLAGS="$GOFLAGS -modcacherw -trimpath" build() { make -j1 \ BUILD_IN_CONTAINER=false \ GOMOD=readonly \ GIT_REVISION="alpine-r$pkgrel" \ GIT_BRANCH=main \ IMAGE_TAG=$pkgver \ logcli loki promtail } check() { # not stable test for fluent-bit # tsdb/index fails on aarch64 # shell check suggests to break it # shellcheck disable=SC2046 TZ=UTC GOGC=10 go test -p=2 $(go list ./... | grep -Ev 'fluent-bit|stores/tsdb/index') } package() { mkdir -p "$pkgdir"/etc/$pkgname cp "$builddir"/cmd/loki/loki-local-config.yaml "$pkgdir"/etc/$pkgname install -Dm0755 cmd/$pkgname/$pkgname -t "$pkgdir"/usr/bin install -Dm0755 cmd/logcli/logcli -t "$pkgdir"/usr/bin install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname install -Dm755 "$srcdir"/$pkgname-promtail.initd "$pkgdir"/etc/init.d/$pkgname-promtail install -Dm644 "$srcdir"/$pkgname-promtail.confd "$pkgdir"/etc/conf.d/$pkgname-promtail install -D clients/cmd/promtail/promtail-local-config.yaml -t "$pkgdir"/etc/$pkgname/ install -Dm0755 clients/cmd/promtail/promtail -t "$pkgdir"/usr/bin/ } logcli() { pkgdesc="Loki log client" amove usr/bin/logcli } promtail() { pkgdesc="Promtail client" amove etc/$pkgname/promtail-local-config.yaml amove usr/bin/promtail } promtail_openrc() { pkgdesc="Promtail client (Open RC init scripts)" install_if="openrc loki-promtail=$pkgver-r$pkgrel" amove etc/init.d/$pkgname-promtail amove etc/conf.d/$pkgname-promtail } sha512sums=" c5bf00262cb133362a1779cf8d2c57d5bb24ad3be23a99e3cdc92e561dcf33cf6a1f13af78340319f0b56ff029ae8d2d764574dcb6a08dc815d9b57dd6c593f0 loki-2.8.2.tar.gz 469920d90daebf142db5dc5d3f2e972f59f5f5dc86684c4dcd5924a33ac7db305561006050ad42393296977ea27f1ce1cd78f78c71de351335167b41e4631a85 loki.initd b4c281e191e7620ffe19d3fcc0b5669f54051a8108f0abc5b1aec2f2026452e02e3c26c3885e1e857cb6007bbc41c1f964e6d25d73bdfe170b67b63ecd9f14fd loki.confd f7d33f03d51c3cc5cda082e72f56ec821c60f70f42923a215652517835b66a68d7db3b246cd1a53ce0b2c003fe31f7e6cca06965ba792e92117d7e91abce829f loki-promtail.confd ff72431ba978880cc58914302b2ec1e48ef3d16b2a667dc82deaa3d2d890331170757dcac48ba0b145c988e70e85c240c94da335894d2c9d114fa811007f1111 loki-promtail.initd 302f14596207037fb7ee892e5c214e857c30cf358b00ae51be2e1639f7e0bbf005d63d16a6c9b3384174827d7ed5c70d873e08050c1635e8a8c5c930ca85df68 goflags.patch "