diff --git a/loki/.footprint b/loki/.footprint new file mode 100644 index 000000000..eae348069 --- /dev/null +++ b/loki/.footprint @@ -0,0 +1,12 @@ +drwxr-xr-x root/root etc/ +drwxr-xr-x root/root etc/loki/ +-rw-r--r-- root/root etc/loki/loki.yaml +-rw-r--r-- root/root etc/loki/promtail.yaml +drwxr-xr-x root/root etc/rc.d/ +-rwxr-xr-x root/root etc/rc.d/loki +-rwxr-xr-x root/root etc/rc.d/promtail +drwxr-xr-x root/root usr/ +drwxr-xr-x root/root usr/bin/ +-rwxr-xr-x root/root usr/bin/logcli +-rwxr-xr-x root/root usr/bin/loki +-rwxr-xr-x root/root usr/bin/promtail diff --git a/loki/.signature b/loki/.signature new file mode 100644 index 000000000..a6e8ab155 --- /dev/null +++ b/loki/.signature @@ -0,0 +1,7 @@ +untrusted comment: verify with /etc/ports/contrib.pub +RWSagIOpLGJF30Ma1/2pBv4ojOOgCzrnEDGA58ILKfyGpx/4sdfj4THIBpBuIzMspIm9i5EY8VO2zUiHl3h6QThdc/DvbJ1B9Qg= +SHA256 (Pkgfile) = 7a7e9b4c67aa19fe91cc088de58a29593a678a71f594d6eaf26fc6ce045386fd +SHA256 (.footprint) = 3e5479ae1bf8f12f64a8cbf3957ffe87473dd161b6dfdf364134e5bb3999faad +SHA256 (loki-2.9.5.tar.gz) = 811ac5ba12f33fad942a6e16352c12159031310fd8a5904b422e90e09ac2e94a +SHA256 (loki.service) = da7d031bbc6bc21b869878272390775455b8ea08291bbbfaeb95fff07f6b6b07 +SHA256 (promtail.service) = 266b6ddc4c6062c4f034a3340849966fe2983a8605ceeb4e326b131b81c392c4 diff --git a/loki/Pkgfile b/loki/Pkgfile new file mode 100644 index 000000000..69c7afdd5 --- /dev/null +++ b/loki/Pkgfile @@ -0,0 +1,42 @@ +# Description: like Prometheus, but for logs +# URL: https://github.com/grafana/loki +# Maintainer: Tim Biermann, tbier at posteo dot de +# Depends on: go + +name=loki +version=2.9.5 +release=1 +source=(https://github.com/grafana/loki/archive/v$version/$name-$version.tar.gz + loki.service + promtail.service) + +build() { + cd $name-$version + + go mod download + export CGO_LDFLAGS=${LDFLAGS} + export CGO_CFLAGS=${CFLAGS} + export CGO_CPPFLAGS=${CPPFLAGS} + export CGO_CXXFLAGS=${CXXFLAGS} + export GOPROXY=off + for path in cmd/loki cmd/loki-canary cmd/logcli clients/cmd/promtail; do + go build \ + -trimpath \ + -buildmode=pie \ + -mod=readonly \ + -modcacherw \ + -ldflags " \ + -X github.com/grafana/loki/pkg/util/build.Version=$version + -X github.com/grafana/loki/pkg/util/build.BuildDate=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ + -linkmode external" \ + ./$path + done + + install -Dm755 -t $PKG/usr/bin loki + install -Dm644 cmd/loki/loki-local-config.yaml $PKG/etc/loki/loki.yaml + install -Dm755 -t $PKG/usr/bin promtail + install -Dm644 clients/cmd/promtail/promtail-local-config.yaml $PKG/etc/loki/promtail.yaml + install -Dm755 -t $PKG/usr/bin logcli + install -Dm755 $SRC/promtail.service $PKG/etc/rc.d/promtail + install -Dm755 $SRC/loki.service $PKG/etc/rc.d/loki +} diff --git a/loki/loki.service b/loki/loki.service new file mode 100755 index 000000000..8da23f9ab --- /dev/null +++ b/loki/loki.service @@ -0,0 +1,32 @@ +#!/bin/sh +# +# /etc/rc.d/loki: start/stop loki daemon +# + +SSD=/sbin/start-stop-daemon +PROG=/usr/bin/loki +OPTS="-config.file /etc/loki/loki.yaml" + +case $1 in + start) + $SSD --start -b --exec $PROG -- $OPTS ;; + stop) + $SSD --stop --retry 10 --exec $PROG ;; + restart) + $0 stop + $0 start + ;; + status) + $SSD --status --exec $PROG + case $? in + 0) echo "$PROG is running with pid $(pidof $PROG)" ;; + 1) echo "$PROG is not running but the pid file $PID exists" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; + *) + echo "usage: $0 [start|stop|restart|status]" ;; +esac + +# End of file diff --git a/loki/promtail.service b/loki/promtail.service new file mode 100755 index 000000000..d49a496dc --- /dev/null +++ b/loki/promtail.service @@ -0,0 +1,32 @@ +#!/bin/sh +# +# /etc/rc.d/promtail start/stop promtail daemon +# + +SSD=/sbin/start-stop-daemon +PROG=/usr/bin/promtail +OPTS="-config.file /etc/loki/promtail.yaml" + +case $1 in + start) + $SSD --start -b --exec $PROG -- $OPTS ;; + stop) + $SSD --stop --retry 10 --exec $PROG ;; + restart) + $0 stop + $0 start + ;; + status) + $SSD --status --exec $PROG + case $? in + 0) echo "$PROG is running with pid $(pidof $PROG)" ;; + 1) echo "$PROG is not running but the pid file $PID exists" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; + *) + echo "usage: $0 [start|stop|restart|status]" ;; +esac + +# End of file