File VictoriaLogs.spec of Package VictoriaLogs

#
# spec file for package VictoriaLogs
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           VictoriaLogs
Version:        1.28.0
Release:        0
Summary:        Open source user-friendly database for logs from VictoriaMetrics
License:        Apache-2.0
URL:            https://docs.victoriametrics.com/victorialogs/
Source0:        https://github.com/VictoriaMetrics/VictoriaLogs/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.zst
Source2:        victoria-logs.service
Source3:        system-user-victorialogs.conf
Patch0:         go-flags.patch
BuildRequires:  golang-packaging
BuildRequires:  openssl
BuildRequires:  sysuser-tools
BuildRequires:  systemd-rpm-macros
BuildRequires:  zstd

%description
Fast and easy to use database for logs, which can efficiently handle terabytes of logs.

%prep
%autosetup -p1 -a1

%build
%make_build victoria-logs vlutils

%install
install -D -m 0755 ./bin/victoria-logs %{buildroot}%{_bindir}/victoria-logs
install    -m 0755 ./bin/vlogscli %{buildroot}%{_bindir}
install -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/victoria-logs.service
mkdir -p %{buildroot}%{_sysusersdir}
install    -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/
mkdir -p %{buildroot}%{_localstatedir}/lib/victoria-logs
%sysusers_generate_pre %{SOURCE3} VictoriaLogs system-user-victorialogs.conf

%pre -f VictoriaLogs.pre
%service_add_pre victoria-logs.service

%post
%service_add_post victoria-logs.service

%preun
%service_del_preun victoria-logs.service

%postun
%service_del_postun victoria-logs.service

%files
%license LICENSE
%doc README.md
%{_bindir}/victoria-logs
%{_bindir}/vlogscli
%{_unitdir}/victoria-logs.service
%{_sysusersdir}/system-user-victorialogs.conf
%dir %attr(-,victoria-logs,victoria-logs) %{_localstatedir}/lib/victoria-logs

%changelog
openSUSE Build Service is sponsored by