[app-admin/loki] interim version, not really tested.
This commit is contained in:
1
app-admin/loki/Manifest
Normal file
1
app-admin/loki/Manifest
Normal file
@@ -0,0 +1 @@
|
||||
DIST loki-2.9.10.tar.gz 46118052 BLAKE2B 44543f1df61b47e5815251ac05e6b4bdbfee86f39f6f4ecfcb122e9d4eb631b581890a67f68a43c272695ab493707de76d47289aab87078eb08f7b37403fc6ba SHA512 d9c1bbdbd7c04de6ea61de269a3eeb015e1342cfef5567b91a04324f586ce16d24462a9fe56b8c5c1376b677da229768653b41623b092aa4ca6a057d4667edfe
|
||||
5
app-admin/loki/files/loki.confd
Normal file
5
app-admin/loki/files/loki.confd
Normal file
@@ -0,0 +1,5 @@
|
||||
# The loki config file
|
||||
LOKI_CONF="/etc/loki/loki-local-config.yaml"
|
||||
|
||||
# Add any extra options to pass to loki to this setting.
|
||||
#LOKI_OPTS=""
|
||||
11
app-admin/loki/files/loki.initd
Normal file
11
app-admin/loki/files/loki.initd
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
configfile="${LOKI_CONF:-/etc/loki/loki-local-config.yaml}"
|
||||
|
||||
command=/usr/bin/loki
|
||||
command_args="-config.file=${configfile}
|
||||
${LOKI_OPTS}"
|
||||
command_background=yes
|
||||
command_user=loki:grafana
|
||||
make_pidfile=yes
|
||||
pidfile=/var/run/loki.pid
|
||||
17
app-admin/loki/files/loki.service
Normal file
17
app-admin/loki/files/loki.service
Normal file
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Loki
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=loki
|
||||
Group=grafana
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
EnvironmentFile=/etc/conf.d/loki
|
||||
Environment=LOKI_CONF=/etc/loki/loki-local-config.yaml
|
||||
ExecStart=/usr/bin/loki -config.file=${LOKI_CONF} ${LOKI_OPTS}
|
||||
PIDFile=/run/loki.pid
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
65
app-admin/loki/loki-2.9.10.ebuild
Normal file
65
app-admin/loki/loki-2.9.10.ebuild
Normal file
@@ -0,0 +1,65 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit go-module systemd
|
||||
|
||||
DESCRIPTION="Like Prometheus, but for logs."
|
||||
HOMEPAGE="https://grafana.com/loki"
|
||||
SRC_URI="https://github.com/grafana/loki/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
LICENSE="Apache-2.0"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64"
|
||||
|
||||
IUSE="+server tools systemd"
|
||||
|
||||
RESTRICT="mirror strip"
|
||||
|
||||
RDEPEND="acct-group/grafana
|
||||
acct-user/${PN}"
|
||||
DEPEND="${RDEPEND}"
|
||||
|
||||
src_compile() {
|
||||
BUILD_VERSION="${PV}"
|
||||
BUILD_REVISION="${PV}"
|
||||
BUILD_USER="${P}"
|
||||
BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
|
||||
|
||||
VPREFIX="github.com/grafana/${PN}/vendor/github.com/prometheus/common/version"
|
||||
|
||||
EGO_LDFLAGS="-s -w -X ${VPREFIX}.Version=${BUILD_VERSION} -X ${VPREFIX}.Revision=${BUILD_REVISION} -X ${VPREFIX}.BuildUser=${BUILD_USER} -X ${VPREFIX}.BuildDate=${BUILD_DATE}"
|
||||
|
||||
if use server; then
|
||||
einfo "Building cmd/${PN}/${PN}..."
|
||||
CGO_ENABLED=0 go build -ldflags "-extldflags \"-static\" ${EGO_LDFLAGS}" -tags netgo -mod vendor -o cmd/${PN}/${PN} ./cmd/${PN} || die
|
||||
fi
|
||||
if use tools; then
|
||||
einfo "Building cmd/logcli/logcli..."
|
||||
CGO_ENABLED=0 go build -ldflags "-extldflags \"-static\" ${EGO_LDFLAGS}" -tags netgo -mod vendor -o cmd/logcli/logcli ./cmd/logcli || die
|
||||
einfo "Building cmd/${PN}-canary/${PN}-canary..."
|
||||
CGO_ENABLED=0 go build -ldflags "-extldflags \"-static\" ${EGO_LDFLAGS}" -tags netgo -mod vendor -o cmd/${PN}-canary/${PN}-canary ./cmd/${PN}-canary || die
|
||||
fi
|
||||
}
|
||||
|
||||
src_install() {
|
||||
if use server; then
|
||||
dobin "${S}/cmd/${PN}/${PN}"
|
||||
|
||||
newconfd "${FILESDIR}/${PN}.confd" "${PN}"
|
||||
newinitd "${FILESDIR}/${PN}.initd" "${PN}"
|
||||
use systemd && systemd_newunit "${FILESDIR}"/${PN}.service ${PN}.service
|
||||
|
||||
insinto "/etc/${PN}"
|
||||
doins "${S}/cmd/${PN}/${PN}-local-config.yaml"
|
||||
keepdir "/etc/${PN}"
|
||||
keepdir "/var/lib/${PN}"
|
||||
fowners ${PN}:grafana "/etc/${PN}"
|
||||
fowners ${PN}:grafana "/var/lib/${PN}"
|
||||
fi
|
||||
if use tools; then
|
||||
dobin "${S}/cmd/logcli/logcli"
|
||||
dobin "${S}/cmd/${PN}-canary/${PN}-canary"
|
||||
fi
|
||||
}
|
||||
14
app-admin/loki/metadata.xml
Normal file
14
app-admin/loki/metadata.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE pkgmetadata
|
||||
SYSTEM 'http://www.gentoo.org/dtd/metadata.dtd'>
|
||||
<pkgmetadata>
|
||||
<use>
|
||||
<flag name="fluent-bit">Build the fluent-bit plugin to publish from app-admin/fluent-bit</flag>
|
||||
<flag name="promtail">Build the promtail log gathering agent</flag>
|
||||
<flag name="server">Build the loki server</flag>
|
||||
<flag name="tools">Build the loki tools logcli and loki-canary</flag>
|
||||
</use>
|
||||
<upstream>
|
||||
<remote-id type="github">grafana/loki</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
Reference in New Issue
Block a user