File mimir.spec of Package mimir
#
# spec file for package mimir
#
# Copyright (c) 2024 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/
#
%global services mimir.service
Name: mimir
Version: 3.0.0
Release: 0
Summary: A horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus
License: AGPL-3.0
URL: https://grafana.com/oss/mimir/
Source0: %{name}-%{version}.tar.zst
Source2: mimir.conf
Patch: build.patch
BuildRequires: golang-packaging
BuildRequires: go >= 1.25.1
BuildRequires: zstd
BuildRequires: pkgconfig(systemd)
BuildRequires: sysuser-shadow
BuildRequires: sysuser-tools
%{?systemd_ordering}
%{?sysusers_requires}
%description
Grafana Mimir is an open source software project that provides a scalable long-term storage for Prometheus. Some of the core strengths of Grafana Mimir include:
Easy to install and maintain: Grafana Mimir’s extensive documentation, tutorials, and deployment tooling make it quick to get started. Using its monolithic mode, you can get Grafana Mimir up and running with just one binary and no additional dependencies. Once deployed, the best-practice dashboards, alerts, and runbooks packaged with Grafana Mimir make it easy to monitor the health of the system.
Massive scalability: You can run Grafana Mimir's horizontally-scalable architecture across multiple machines, resulting in the ability to process orders of magnitude more time series than a single Prometheus instance. Internal testing shows that Grafana Mimir handles up to 1 billion active time series.
Global view of metrics: Grafana Mimir enables you to run queries that aggregate series from multiple Prometheus instances, giving you a global view of your systems. Its query engine extensively parallelizes query execution, so that even the highest-cardinality queries complete with blazing speed.
Cheap, durable metric storage: Grafana Mimir uses object storage for long-term data storage, allowing it to take advantage of this ubiquitous, cost-effective, high-durability technology. It is compatible with multiple object store implementations, including AWS S3, Google Cloud Storage, Azure Blob Storage, OpenStack Swift, as well as any S3-compatible object storage.
High availability: Grafana Mimir replicates incoming metrics, ensuring that no data is lost in the event of machine failure. Its horizontally scalable architecture also means that it can be restarted, upgraded, or downgraded with zero downtime, which means no interruptions to metrics ingestion or querying.
Natively multi-tenant: Grafana Mimir’s multi-tenant architecture enables you to isolate data and queries from independent teams or business units, making it possible for these groups to share the same cluster. Advanced limits and quality-of-service controls ensure that capacity is shared fairly among tenants.
%prep
%autosetup -p1
%build
MIMIR_VERSION="github.com/grafana/mimir/pkg/util/version"
for i in mimir mimirtool ; do
go build -mod=vendor -buildmode=pie -ldflags "-X ${MIMIR_VERSION}.Branch=main -X ${MIMIR_VERSION}.Revision=mimir-%{version} -X ${MIMIR_VERSION}.Version=%{version}" -mod=vendor -buildmode=pie -tags netgo,stringlabels -o ${i} ./cmd/${i}
done
perl -p -i.bak -e 's|\$OS_ENV_DIR|/etc/default|g;s|/usr/local|/usr|g' packaging/nfpm/mimir/mimir.service
diff -u packaging/nfpm/mimir/mimir.service{.bak,} ||:
%sysusers_generate_pre %{SOURCE2} %{name} %{name}.conf
%install
install -D -m 0644 -t %{buildroot}%{_unitdir}/ packaging/nfpm/mimir/mimir.service
install -D -m 0644 -t %{buildroot}%{_sysusersdir}/ %{SOURCE2}
install -D -m 0755 -t %{buildroot}%{_bindir}/ mimir mimirtool
install -D -m 0750 -d %{buildroot}/var/lib/mimir %{buildroot}%{_sysconfdir}/mimir
install -D -m 0640 -t %{buildroot}%{_sysconfdir}/mimir packaging/nfpm/mimir/*.yml
install -D -m 0644 packaging/nfpm/mimir/mimir.env %{buildroot}/etc/default/mimir
%check
./mimir --version
%pre -f %{name}.pre
%service_add_pre %{services}
%preun
%service_del_preun %{services}
%post
%service_add_post %{services}
%postun
%service_del_postun %{services}
%files
%license LICENSE LICENSING.md
%doc ADOPTERS.md CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md GOVERNANCE.md MAINTAINERS.md README.md SECURITY.md
%config(noreplace) /etc/default/mimir
%config(noreplace) %attr(-,root,mimir) %{_sysconfdir}/mimir
%{_unitdir}/mimir.service
%{_sysusersdir}/%{name}.conf
%{_bindir}/mimir
%{_bindir}/mimirtool
%dir %attr(-,mimir,mimir) /var/lib/mimir
%changelog