~dricottone/huttese-apk

64da979039a8e4439615569e3bb2c2e2be177097 — Drew DeVault 3 years ago cdb6611
chartsrv: new aport
A sr.ht/chartsrv/APKBUILD => sr.ht/chartsrv/APKBUILD +43 -0
@@ 0,0 1,43 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=chartsrv
pkgver=1.0.1
pkgrel=0
pkgdesc="A web service for generating charts from prometheus data"
url="https://sr.ht/~sircmpwn/chartsrv"
arch="all"
license="MIT"
install="chartsrv.pre-install"
makedepends="go"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	chartsrv.confd
	chartsrv.initd
"
subpackages="$pkgname-openrc"

build() {
	go mod vendor
	go build \
		-trimpath \
		-mod=vendor \
		-ldflags "-extldflags $LDFLAGS"
}

check() {
	go test ./...
}

package() {
	install -Dm755 chartsrv "$pkgdir"/usr/bin/chartsrv

	install -Dm644 "$srcdir"/chartsrv.confd \
		"$pkgdir"/etc/conf.d/chartsrv
	install -Dm755 "$srcdir"/chartsrv.initd \
		"$pkgdir"/etc/init.d/chartsrv
}

sha512sums="
51513eb25dc32511b3072fc7c5609d302450d15519216aae7cd8803f4d22095cb6cf8d9a183b96692d5f6908d45d23f45a66dda95da6857e93f0fbab3d4699c3  chartsrv-1.0.1.tar.gz
27459c5acb17fbb6f7d536fc21aff7aac1ef13d5c79441242a6d99f818758b053fdf27b294d80336c699b0dec0fc844d870cd5d46469356f3c90f792953da26a  chartsrv.confd
be2c253987df10975a821c26d028919a59d336bd3679fe7cb9c107ec6c494c24f50b35950fd2d38bebaade999284cf77e54a6342caf6cf0d0bab711735987497  chartsrv.initd
"

A sr.ht/chartsrv/chartsrv.confd => sr.ht/chartsrv/chartsrv.confd +5 -0
@@ 0,0 1,5 @@
# Upstream Prometheus source
chartsrv_upstream='https://metrics.sr.ht'

output_log=/var/log/chartsrv.log
error_log=/var/log/chartsrv.log

A sr.ht/chartsrv/chartsrv.initd => sr.ht/chartsrv/chartsrv.initd +15 -0
@@ 0,0 1,15 @@
#!/sbin/openrc-run
name="chartsrv"
description="Web service for rendering charts from Prometheus data"
supervisor=supervise-daemon
command=/usr/bin/chartsrv
command_args="$chartsrv_upstream"
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
}

A sr.ht/chartsrv/chartsrv.pre-install => sr.ht/chartsrv/chartsrv.pre-install +4 -0
@@ 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