|
|
2ea307 |
#
|
|
|
2ea307 |
# spec file for package loki
|
|
|
2ea307 |
#
|
|
|
ce7fcd |
# Copyright (c) 2022 SUSE LLC
|
|
|
2ea307 |
#
|
|
|
2ea307 |
# All modifications and additions to the file contributed by third parties
|
|
|
2ea307 |
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
2ea307 |
# upon. The license for this file, and modifications and additions to the
|
|
|
2ea307 |
# file, is the same license as for the pristine package itself (unless the
|
|
|
2ea307 |
# license for the pristine package is not an Open Source License, in which
|
|
|
2ea307 |
# case the license is the MIT License). An "Open Source License" is a
|
|
|
2ea307 |
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
2ea307 |
# published by the Open Source Initiative.
|
|
|
2ea307 |
|
|
|
2ea307 |
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
|
|
2ea307 |
#
|
|
|
2ea307 |
|
|
|
201e24 |
|
|
|
a24c53 |
%global loki_datadir /var/lib/loki
|
|
|
a24c53 |
%global promtail_datadir /var/lib/promtail
|
|
|
a24c53 |
|
|
|
2ea307 |
Name: loki
|
|
|
2774b6 |
Version: 2.6.1+git.1658128747.6bd05c9a4
|
|
|
2ea307 |
Release: 0
|
|
|
105194 |
Summary: Loki: like Prometheus, but for logs
|
|
|
2ea307 |
License: Apache-2.0
|
|
|
2ea307 |
Group: System/Monitoring
|
|
|
201e24 |
URL: https://grafana.com/loki
|
|
|
2ea307 |
Source: %{name}-%{version}.tar.bz2
|
|
|
2ea307 |
Source1: loki.service
|
|
|
2ea307 |
Source2: promtail.service
|
|
|
2ea307 |
Source3: sysconfig.loki
|
|
|
2ea307 |
Source4: sysconfig.promtail
|
|
|
a24c53 |
Source99: series
|
|
|
105194 |
Patch0: harden_promtail.service.patch
|
|
|
a24c53 |
Patch1: proper-data-directories.patch
|
|
|
2ea307 |
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
2ea307 |
BuildRequires: golang-packaging
|
|
|
2ea307 |
BuildRequires: systemd-devel
|
|
|
038cc4 |
BuildRequires: golang(API) = 1.17
|
|
|
105194 |
Requires: logcli = %{version}
|
|
|
2ea307 |
Requires: group(loki)
|
|
|
201e24 |
Requires: user(loki)
|
|
|
2ea307 |
Requires(post): %fillup_prereq
|
|
|
2ea307 |
%systemd_ordering
|
|
|
2ea307 |
|
|
|
2774b6 |
###%%{go_nostrip}
|
|
|
2ea307 |
|
|
|
2ea307 |
%description
|
|
|
2ea307 |
Loki is a horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by Prometheus.
|
|
|
2ea307 |
|
|
|
ba00df |
This package contains the Loki server
|
|
|
ba00df |
|
|
|
ba00df |
%package -n promtail
|
|
|
ba00df |
Summary: Promtail Client
|
|
|
ba00df |
Group: System/Monitoring
|
|
|
ba00df |
|
|
|
ba00df |
%description -n promtail
|
|
|
ba00df |
Loki is a horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by Prometheus.
|
|
|
ba00df |
|
|
|
ba00df |
This package contains the Promtail client.
|
|
|
ba00df |
|
|
|
105194 |
%package -n logcli
|
|
|
105194 |
Summary: LogCLI tool
|
|
|
105194 |
Group: System/Monitoring
|
|
|
105194 |
|
|
|
105194 |
%description -n logcli
|
|
|
105194 |
Loki is a horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by Prometheus.
|
|
|
105194 |
|
|
|
105194 |
This package contains the LogCLI command-line tool.
|
|
|
105194 |
|
|
|
2ea307 |
%prep
|
|
|
a24c53 |
%autosetup -p1 %{name}-%{version}
|
|
|
2ea307 |
|
|
|
2ea307 |
%build
|
|
|
2ea307 |
%define buildpkg github.com/grafana/loki/pkg/build
|
|
|
2ea307 |
export CGO_ENABLED=0
|
|
|
2ea307 |
export GOFLAGS="-mod=vendor -buildmode=pie -tags=netgo"
|
|
|
2ea307 |
export GOLDFLAGS="-s -w -X %{buildpkg}.Version=%{version} \
|
|
|
2ea307 |
-X %{buildpkg}.Revision=%{release} \
|
|
|
2ea307 |
-X %{buildpkg}.Branch=NA \
|
|
|
2ea307 |
-X %{buildpkg}.BuildUser=NA \
|
|
|
2ea307 |
-X %{buildpkg}.BuildDate=NA"
|
|
|
2ea307 |
|
|
|
2ea307 |
go build -ldflags="$GOLDFLAGS" ./cmd/loki
|
|
|
2ea307 |
go build -ldflags="$GOLDFLAGS" ./cmd/logcli
|
|
|
105194 |
CGO_ENABLED=1 go build -ldflags="$GOLDFLAGS" ./clients/cmd/promtail
|
|
|
2ea307 |
|
|
|
2ea307 |
%install
|
|
|
2ea307 |
|
|
|
2ea307 |
# Service files for Loki and promtail
|
|
|
2ea307 |
install -Dm644 %{SOURCE1} %{buildroot}%{_unitdir}/loki.service
|
|
|
2ea307 |
install -Dm644 %{SOURCE2} %{buildroot}%{_unitdir}/promtail.service
|
|
|
2ea307 |
install -Dm644 %{SOURCE3} %{buildroot}%{_fillupdir}/sysconfig.loki
|
|
|
2ea307 |
install -Dm644 %{SOURCE4} %{buildroot}%{_fillupdir}/sysconfig.promtail
|
|
|
2ea307 |
install -dm755 %{buildroot}%{_sbindir}
|
|
|
2ea307 |
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcloki
|
|
|
2ea307 |
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcpromtail
|
|
|
2ea307 |
|
|
|
2ea307 |
# Config files
|
|
|
a24c53 |
install -Dm640 cmd/loki/loki-local-config.yaml \
|
|
|
2ea307 |
%{buildroot}%{_sysconfdir}/loki/loki.yaml
|
|
|
a24c53 |
install -Dm640 clients/cmd/promtail/promtail-local-config.yaml \
|
|
|
2ea307 |
%{buildroot}%{_sysconfdir}/loki/promtail.yaml
|
|
|
2ea307 |
|
|
|
2ea307 |
# Binaries
|
|
|
2ea307 |
install -dm755 %{buildroot}%{_bindir}
|
|
|
2ea307 |
install -Dm755 loki %{buildroot}%{_bindir}
|
|
|
2ea307 |
install -Dm755 promtail %{buildroot}%{_bindir}
|
|
|
2ea307 |
install -Dm755 logcli %{buildroot}%{_bindir}
|
|
|
2ea307 |
|
|
|
a24c53 |
install -D -d -m 0750 %{buildroot}%{promtail_datadir} %{buildroot}%{loki_datadir}
|
|
|
a24c53 |
|
|
|
2ea307 |
%pre
|
|
|
ba00df |
%service_add_pre loki.service
|
|
|
2ea307 |
|
|
|
2ea307 |
%post
|
|
|
03faf6 |
%fillup_only
|
|
|
ba00df |
%service_add_post loki.service
|
|
|
2ea307 |
|
|
|
2ea307 |
%preun
|
|
|
ba00df |
%service_del_preun loki.service
|
|
|
2ea307 |
|
|
|
2ea307 |
%postun
|
|
|
2ea307 |
%service_del_postun loki.service promtail.service
|
|
|
2ea307 |
|
|
|
ba00df |
%pre -n promtail
|
|
|
ba00df |
%service_add_pre promtail.service
|
|
|
ba00df |
|
|
|
ba00df |
%post -n promtail
|
|
|
ba00df |
%fillup_only -n promtail
|
|
|
ba00df |
%service_add_post promtail.service
|
|
|
ba00df |
|
|
|
ba00df |
%preun -n promtail
|
|
|
ba00df |
%service_del_preun promtail.service
|
|
|
ba00df |
|
|
|
ba00df |
%postun -n promtail
|
|
|
ba00df |
%service_del_postun promtail.service
|
|
|
ba00df |
|
|
|
2ea307 |
%files
|
|
|
2ea307 |
%license LICENSE
|
|
|
2ea307 |
%doc README.md
|
|
|
2ea307 |
%{_unitdir}/loki.service
|
|
|
2ea307 |
%{_fillupdir}/sysconfig.loki
|
|
|
2ea307 |
%{_bindir}/loki
|
|
|
2ea307 |
%dir %{_sysconfdir}/loki
|
|
|
a24c53 |
%config(noreplace) %attr(-,root,loki) %{_sysconfdir}/loki/loki.yaml
|
|
|
2ea307 |
%{_sbindir}/rcloki
|
|
|
a24c53 |
%dir %attr(-,loki,loki) %{loki_datadir}/
|
|
|
ba00df |
|
|
|
ba00df |
%files -n promtail
|
|
|
ba00df |
%{_unitdir}/promtail.service
|
|
|
ba00df |
%{_fillupdir}/sysconfig.promtail
|
|
|
ba00df |
%{_bindir}/promtail
|
|
|
a24c53 |
%dir %{_sysconfdir}/loki
|
|
|
ba00df |
%config(noreplace) %{_sysconfdir}/loki/promtail.yaml
|
|
|
2ea307 |
%{_sbindir}/rcpromtail
|
|
|
a24c53 |
%dir %{promtail_datadir}/
|
|
|
2ea307 |
|
|
|
105194 |
%files -n logcli
|
|
|
105194 |
%{_bindir}/logcli
|
|
|
105194 |
|
|
|
2ea307 |
%changelog
|