73 lines
2.0 KiB
RPMSpec
73 lines
2.0 KiB
RPMSpec
%define debug_package %{nil}
|
|
%ifarch aarch64
|
|
%global hostarch arm64
|
|
%endif
|
|
%ifarch x86_64
|
|
%global hostarch amd64
|
|
%endif
|
|
|
|
Name: pushgateway
|
|
Version: 1.4.1
|
|
Release: 1
|
|
Summary: Prometheus pushgateway.
|
|
License: ASL 2.0
|
|
URL: https://github.com/prometheus/%{name}
|
|
Source0: https://github.com/prometheus/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
|
|
Source1: %{name}.service
|
|
Source2: %{name}.default
|
|
Source3: vendor.tar.gz
|
|
Patch0: 0001-fix-promu-dependence-and-fix-not-found-web.patch
|
|
|
|
BuildRequires: golang >= 1.13
|
|
BuildRequires: promu
|
|
%{?systemd_requires}
|
|
Requires(pre): shadow-utils
|
|
|
|
%description
|
|
The Prometheus Pushgateway exists to allow ephemeral and batch jobs to expose their metrics to Prometheus.
|
|
Since these kinds of jobs may not exist long enough to be scraped, they can instead push their metrics to a Pushgateway.
|
|
The Pushgateway then exposes these metrics to Prometheus.
|
|
|
|
%prep
|
|
%autosetup -p1 -n %{name}-%{version}
|
|
%setup -T -D -a 3 -n %{name}-%{version}
|
|
|
|
%build
|
|
mkdir -p $(pwd)/bin
|
|
export GOBIN=$(pwd)/bin
|
|
go build -mod=vendor -o bin ./ ...
|
|
|
|
%install
|
|
mkdir -p %{buildroot}%{_bindir}
|
|
install -D -m 755 bin/%{name} %{buildroot}%{_bindir}/
|
|
mkdir -vp %{buildroot}%{_sharedstatedir}/prometheus
|
|
install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
|
|
install -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/default/%{name}
|
|
|
|
%pre
|
|
getent group prometheus >/dev/null || groupadd -r prometheus
|
|
getent passwd prometheus >/dev/null || \
|
|
useradd -r -g prometheus -d %{_sharedstatedir}/prometheus -s /sbin/nologin \
|
|
-c "Prometheus services" prometheus
|
|
exit 0
|
|
|
|
%post
|
|
%systemd_post %{name}.service
|
|
|
|
%preun
|
|
%systemd_preun %{name}.service
|
|
|
|
%postun
|
|
%systemd_postun %{name}.service
|
|
|
|
%files
|
|
%defattr(-,root,root,-)
|
|
%{_bindir}/*
|
|
%{_unitdir}/%{name}.service
|
|
%config(noreplace) %{_sysconfdir}/default/%{name}
|
|
%dir %attr(755, prometheus, prometheus)%{_sharedstatedir}/prometheus
|
|
|
|
%changelog
|
|
* Wed Jul 14 2021 baizhonggui <baizhonggui@huawei.com> - 1.4.1-1
|
|
- Package init
|