From 9777accfe5df92d6e572aea67a05ff4d19bb70ec Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sat, 4 Jan 2020 19:40:40 -0500 Subject: [PATCH] prometheus: fix installation of web templates --- sr.ht/prometheus/APKBUILD | 40 +++++++++++++++++++------ sr.ht/prometheus/prometheus.confd | 8 +++-- sr.ht/prometheus/prometheus.initd | 15 +++++----- sr.ht/prometheus/prometheus.pre-install | 4 +-- 4 files changed, 47 insertions(+), 20 deletions(-) diff --git a/sr.ht/prometheus/APKBUILD b/sr.ht/prometheus/APKBUILD index 67cf2a0..e5594d6 100644 --- a/sr.ht/prometheus/APKBUILD +++ b/sr.ht/prometheus/APKBUILD @@ -1,31 +1,41 @@ # Maintainer: Drew DeVault pkgname=prometheus pkgver=2.15.1 -pkgrel=0 +pkgrel=3 pkgdesc="The Prometheus monitoring system and time series database" url="https://github.com/prometheus/prometheus" arch="all" license="Apache-2.0" install="prometheus.pre-install" -makedepends="go" +makedepends="go yarn bash" source=" $pkgname-$pkgver.tar.gz::https://github.com/prometheus/prometheus/archive/v$pkgver.tar.gz prometheus.confd prometheus.initd " subpackages="$pkgname-openrc" -builddir="$srcdir/$pkgname-$pkgver" options="!check" # Broken by integrations we don't care about build() { + cd web/ui/react-app + yarn --frozen-lockfile + yarn lint + cd ../../../ + ./scripts/build_react_app.sh + cd web/ui + go generate -x -v + cd ../../ + gofmt -w ./web/ui + go build \ - -gcflags "all=-trimpath=$PWD" \ - -asmflags "all=-trimpath=$PWD" \ + -trimpath \ + -mod=vendor \ -ldflags "-extldflags $LDFLAGS" \ + -tags netgo,builtinassets \ ./cmd/prometheus go build \ - -gcflags "all=-trimpath=$PWD" \ - -asmflags "all=-trimpath=$PWD" \ + -trimpath \ + -mod=vendor \ -ldflags "-extldflags $LDFLAGS" \ ./cmd/promtool } @@ -46,8 +56,20 @@ package() { install -Dm644 -t "$pkgdir"/etc/prometheus \ documentation/examples/prometheus.yml + + mkdir -p "$pkgdir"/etc/prometheus/console_libraries + for file in console_libraries/* + do + install -Dm644 -t "$pkgdir"/etc/prometheus/console_libraries/ "$file" + done + + mkdir -p "$pkgdir"/etc/prometheus/consoles + for file in consoles/* + do + install -Dm644 -t "$pkgdir"/etc/prometheus/consoles/ "$file" + done } sha512sums="b08dfa48bddb6e007cd0fd4553847e824d6adfc047d97151b8dd12dbd1f67cfb9301824b320f1cabe9644159e6968b3fd2ee8104a5d53822a9965423c4bb47b5 prometheus-2.15.1.tar.gz -82f90ef730935b9dfc67877098ab0dcada0da941e273b241826b1e9bd2474202f2df5dd976dbed016652219cf0cfd1d77b8df72367ed1ac15c6f0cc38800cac5 prometheus.confd -3eaf6183a3dcf39169383861eff0e15dba16cbd08673815bf936a55ef17803a283c871f1f4534a61d1d0349227122e64a1cf5dac1b10adc504107aba869fff1c prometheus.initd" +24b34e586238d5b331639aa5c43b6a927692f251af2cea2787335eab30d2fc7d46975059595db4697ae0dc1d35b5e23cfc4e4b2e424442c209a05283ca22a239 prometheus.confd +bdc179cb3b8b5d3416e74a0b31002bd7b456b204404579dd40c38cade43eb26b106d16ea2597755035035eca567d34bfa44913eaa28870c3f22e1105d47908ab prometheus.initd" diff --git a/sr.ht/prometheus/prometheus.confd b/sr.ht/prometheus/prometheus.confd index 193f4ad..8cf02ff 100644 --- a/sr.ht/prometheus/prometheus.confd +++ b/sr.ht/prometheus/prometheus.confd @@ -1,2 +1,6 @@ -config_file=/etc/prometheus/prometheus.yml -storage_path=/var/lib/prometheus/data +prometheus_config_file=/etc/prometheus/prometheus.yml +prometheus_storage_path=/var/lib/prometheus/data +prometheus_retention_time=15d + +output_log=/var/log/prometheus.log +error_log=/var/log/prometheus.log diff --git a/sr.ht/prometheus/prometheus.initd b/sr.ht/prometheus/prometheus.initd index 7ea45cf..4464662 100644 --- a/sr.ht/prometheus/prometheus.initd +++ b/sr.ht/prometheus/prometheus.initd @@ -2,15 +2,16 @@ name="prometheus" description="prometheus monitoring system & time series database" supervisor=supervise-daemon -supervise_daemon_args="-1 /var/log/prometheus.log -2 /var/log/prometheus.log" command=/usr/bin/prometheus -command_args="--config.file=$config_file \ - --storage.tsdb.path=$storage_path" +command_args="--config.file=$prometheus_config_file \ + --storage.tsdb.path=$prometheus_storage_path \ + --storage.tsdb.retention.time=$prometheus_retention_time" command_user="prometheus:prometheus" -pidfile="/run/${RC_SVCNAME}.pid" start_pre() { - checkpath -f "/var/log/prometheus.log" -m 644 -o prometheus:prometheus - checkpath -f "$config_file" -m 740 -o prometheus:prometheus - checkpath -d "$storage_path" -m 755 -o prometheus:prometheus + [ -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 "$prometheus_storage_path" -m 755 -o prometheus:prometheus } diff --git a/sr.ht/prometheus/prometheus.pre-install b/sr.ht/prometheus/prometheus.pre-install index 379f50a..004fd0b 100644 --- a/sr.ht/prometheus/prometheus.pre-install +++ b/sr.ht/prometheus/prometheus.pre-install @@ -1,4 +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 \ +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 -- 2.45.2