Browse Source

add: prometheus-bin

master
chimo 2 years ago
parent
commit
2c21a896f1
4 changed files with 89 additions and 0 deletions
  1. +55
    -0
      prometheus-bin/APKBUILD
  2. +8
    -0
      prometheus-bin/prometheus-bin.confd
  3. +21
    -0
      prometheus-bin/prometheus-bin.initd
  4. +5
    -0
      prometheus-bin/prometheus-bin.pre-install

+ 55
- 0
prometheus-bin/APKBUILD View File

@ -0,0 +1,55 @@
# Maintainer: Chimo <chimo@chromic.org>
pkgname="prometheus-bin"
_pkgname="prometheus"
pkgver=2.13.1
pkgrel=0
pkgdesc="The Prometheus monitoring system and time series database."
url="https://github.com/prometheus/prometheus"
arch="x86_64"
license="Apache 2.0"
depends=""
makedepends=""
subpackages="$pkgname-openrc"
install="$pkgname.pre-install"
options="!check"
source="
$_pkgname-$pkgver.tar.gz::https://github.com/$_pkgname/$_pkgname/releases/download/v$pkgver/$_pkgname-$pkgver.linux-amd64.tar.gz
$pkgname.initd
$pkgname.confd
"
builddir="$srcdir/$_pkgname-$pkgver.linux-amd64"
package() {
cd "$builddir"
# binaries
install -D -m755 prometheus \
"$pkgdir"/usr/bin/prometheus
install -D -m755 promtool \
"$pkgdir"/usr/bin/promtool
install -D -m755 tsdb \
"$pkgdir"/usr/bin/tsdb
# etc
confdir="$pkgdir"/etc/prometheus
mkdir -p "$confdir"
cp -r console_libraries "$confdir"
cp -r consoles "$confdir"
install -D -m644 prometheus.yml \
"$confdir"/prometheus.yml
# data
mkdir -p "$pkgdir"/var/lib/prometheus
# service
install -D -m644 "$srcdir"/prometheus-bin.confd \
"$pkgdir"/etc/conf.d/prometheus
install -Dm755 "$srcdir"/prometheus-bin.initd \
"$pkgdir"/etc/init.d/prometheus
}
sha512sums="42ae1133970015e5f439178e229804a247b8356b16e3dfe18cb02a0f8643ace5edc5821b5b4464916f11e5edcf5d046fd08d7891649d91e1aebca735d849601e prometheus-2.13.1.tar.gz
3a51b82126f284472e5d4ffc6b6011b24b34ae202e518ac1794c68366ef8857350b91e050a267a92f6cec27df77d2ffa5b1be8081efdcb3e066bfaf8da1195a7 prometheus-bin.initd
96a386953f16dcd13690377c053205198989e604dd72ea2a91ac83805e6651f06e91b3b6e0b2e1132e3f471b350c75e7fe621f2d3a5826f16dfa247c315377d4 prometheus-bin.confd"

+ 8
- 0
prometheus-bin/prometheus-bin.confd View File

@ -0,0 +1,8 @@
# Run the daemon as this user:
# PROMETHEUS_USER=prometheus
PROMETHEUS_OPTS="--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.libraries=/usr/share/prometheus/console_libraries \
--web.console.templates=/usr/share/prometheus/consoles"

+ 21
- 0
prometheus-bin/prometheus-bin.initd View File

@ -0,0 +1,21 @@
#!/sbin/openrc-run
name="prometheus-bin"
description="Go secure image proxy server service"
supervisor=supervise-daemon
PROMETHEUS_USER=${PROMETHEUS_USER:-prometheus}
LOGS=/var/log/prometheus.log
supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/prometheus"
command_args="$PROMETHEUS_OPTS"
command_user="$PROMETHEUS_USER:$PROMETHEUS_USER"
pidfile="/run/${RC_SVCNAME}.pid"
depend() {
need net
}
start_pre() {
checkpath -f "$LOGS" -m 644 -o "$PROMETHEUS_USER:$PROMETHEUS_USER"
checkpath -d -o "$PROMETHEUS_USER:$PROMETHEUS_USER" -m755 /var/lib/prometheus
}

+ 5
- 0
prometheus-bin/prometheus-bin.pre-install View File

@ -0,0 +1,5 @@
#!/bin/sh
addgroup -S prometheus || true
adduser -SDH -s /sbin/nologin -g prometheus prometheus || true

Loading…
Cancel
Save