forked from pool/golang-github-prometheus-prometheus
Accepting request 720580 from home:gladiac:branches:server:monitoring
Uses $ARGS in sysconfig and service file now. OBS-URL: https://build.opensuse.org/request/show/720580 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/golang-github-prometheus-prometheus?expand=0&rev=16
This commit is contained in:
parent
2c7e43427f
commit
e4a9cf08d9
@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 31 10:46:13 UTC 2019 - Andreas Schneider <asn@cryptomilk.org>
|
||||
|
||||
- Build with PIE
|
||||
+ Added prometheus-buildmode-pie.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 31 06:47:55 UTC 2019 - Andreas Schneider <asn@cryptomilk.org>
|
||||
|
||||
- Only package required files (reduces rpm size by 4 MB)
|
||||
- Add sysconfig file
|
||||
- Add firewall config file
|
||||
- Use variables for defining user and group
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 25 16:34:29 UTC 2019 - Joao Cavalheiro <jcavalheiro@suse.com>
|
||||
|
||||
|
@ -17,6 +17,9 @@
|
||||
#
|
||||
|
||||
|
||||
%global prometheus_user prometheus
|
||||
%global prometheus_group %{prometheus_user}
|
||||
|
||||
%{go_nostrip}
|
||||
|
||||
Name: golang-github-prometheus-prometheus
|
||||
@ -29,25 +32,19 @@ Url: https://prometheus.io/
|
||||
Source: prometheus-%{version}.tar.xz
|
||||
Source1: prometheus.service
|
||||
Source2: prometheus.yml
|
||||
Source3: prometheus.sysconfig
|
||||
Source4: prometheus.firewall.xml
|
||||
Patch1: 0001-Do-not-force-the-pure-Go-name-resolver.patch
|
||||
# Lifted from Debian's prometheus package
|
||||
Patch2: 0002-Default-settings.patch
|
||||
# Uyuni service discovery support
|
||||
Patch3: 0003-Add-Uyuni-service-discovery.patch
|
||||
%ifarch aarch64
|
||||
# For some reason the aarch64 build fails with:
|
||||
# + promu build
|
||||
# > prometheus
|
||||
# # github.com/prometheus/prometheus/cmd/prometheus
|
||||
# /usr/lib64/go/pkg/tool/linux_arm64/link: running gcc failed: exit status 1
|
||||
# /usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../aarch64-suse-linux/bin/ld: cannot find -lpthread
|
||||
# /usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../aarch64-suse-linux/bin/ld: cannot find -lc
|
||||
# collect2: error: ld returned 1 exit status
|
||||
# Adding glibc-devel-static fixes it, but it's odd that this isn't
|
||||
# also a problem on x86_64.
|
||||
BuildRequires: glibc-devel-static
|
||||
%endif
|
||||
# Add -buildmode=pie
|
||||
Patch4: prometheus-buildmode-pie.patch
|
||||
BuildRequires: fdupes
|
||||
# Adding glibc-devel-static seems to be required for linking if building
|
||||
# with -buildmode=pie
|
||||
BuildRequires: glibc-devel-static
|
||||
BuildRequires: golang-github-prometheus-promu
|
||||
BuildRequires: golang-packaging
|
||||
BuildRequires: xz
|
||||
@ -55,6 +52,7 @@ BuildRequires: golang(API) >= 1.12
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%{?systemd_requires}
|
||||
Requires(pre): shadow
|
||||
Requires(post): %fillup_prereq
|
||||
%{go_provides}
|
||||
|
||||
%description
|
||||
@ -68,35 +66,46 @@ Prometheus's main features are:
|
||||
- multiple modes of graphing and dashboarding support
|
||||
|
||||
%prep
|
||||
%setup -q -n prometheus-%{version}
|
||||
%patch1 -p 1
|
||||
%patch2 -p 1
|
||||
%patch3 -p 1
|
||||
%autosetup -p1 -n prometheus-%{version}
|
||||
|
||||
%build
|
||||
%goprep github.com/prometheus/prometheus
|
||||
GOPATH=%{_builddir}/go promu build
|
||||
|
||||
%install
|
||||
%goinstall
|
||||
install -D -m0755 %{_builddir}/prometheus-%{version}/prometheus %{buildroot}/%{_bindir}/prometheus
|
||||
install -D -m0755 %{_builddir}/prometheus-%{version}/promtool %{buildroot}/%{_bindir}/promtool
|
||||
%gosrc
|
||||
install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/prometheus.service
|
||||
install -Dd -m 0755 %{buildroot}%{_sbindir}
|
||||
install -m 0755 -d %{buildroot}%{_datarootdir}/prometheus
|
||||
cp -fr console_libraries/ consoles/ %{buildroot}%{_datarootdir}/prometheus
|
||||
|
||||
install -m 0755 -d %{buildroot}%{_unitdir}
|
||||
install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/prometheus.service
|
||||
|
||||
install -d -m 0755 %{buildroot}%{_sbindir}
|
||||
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcprometheus
|
||||
install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/prometheus/prometheus.yml
|
||||
install -Dd -m 0750 %{buildroot}%{_localstatedir}/lib/prometheus
|
||||
install -Dd -m 0750 %{buildroot}%{_localstatedir}/lib/prometheus/metrics
|
||||
%gofilelist
|
||||
%fdupes %{buildroot}/%{_prefix}
|
||||
|
||||
install -d -m 0755 %{buildroot}%{_sysconfdir}/prometheus
|
||||
install -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/prometheus/prometheus.yml
|
||||
|
||||
install -m 0755 -d %{buildroot}%{_fillupdir}
|
||||
install -m 0644 %{SOURCE3} %{buildroot}%{_fillupdir}/sysconfig.prometheus
|
||||
|
||||
install -m 0755 -d %{buildroot}%{_libdir}/firewalld/services/
|
||||
install -m 0644 %{SOURCE4} %{buildroot}%{_libdir}/firewalld/services/prometheus.xml
|
||||
|
||||
install -d -m 0755 %{buildroot}%{_sharedstatedir}/prometheus
|
||||
install -d -m 0755 %{buildroot}%{_sharedstatedir}/prometheus/data
|
||||
install -d -m 0755 %{buildroot}%{_sharedstatedir}/prometheus/metrics
|
||||
|
||||
%fdupes %{buildroot}/%{_datarootdir}
|
||||
|
||||
%pre
|
||||
getent group %{prometheus_group} >/dev/null || %{_sbindir}/groupadd -r %{prometheus_group}
|
||||
getent passwd %{prometheus_user} >/dev/null || %{_sbindir}/useradd -r -g %{prometheus_group} -d %{_localstatedir}/lib/prometheus -s /sbin/nologin %{prometheus_user}
|
||||
%service_add_pre prometheus.service
|
||||
getent group prometheus >/dev/null || %{_sbindir}/groupadd -r prometheus
|
||||
getent passwd prometheus >/dev/null || %{_sbindir}/useradd -r -g prometheus -d %{_localstatedir}/lib/prometheus -s /sbin/nologin prometheus
|
||||
|
||||
%post
|
||||
%fillup_only -n prometheus
|
||||
%service_add_post prometheus.service
|
||||
|
||||
%preun
|
||||
@ -105,7 +114,10 @@ getent passwd prometheus >/dev/null || %{_sbindir}/useradd -r -g prometheus -d %
|
||||
%postun
|
||||
%service_del_postun prometheus.service
|
||||
|
||||
%files -f file.lst
|
||||
%verifyscript
|
||||
%fillup_only -n prometheus
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc README.md
|
||||
%license LICENSE
|
||||
@ -113,9 +125,15 @@ getent passwd prometheus >/dev/null || %{_sbindir}/useradd -r -g prometheus -d %
|
||||
%{_bindir}/promtool
|
||||
%{_unitdir}/prometheus.service
|
||||
%{_sbindir}/rcprometheus
|
||||
%dir %attr(0750, prometheus, prometheus) %{_localstatedir}/lib/prometheus
|
||||
%dir %attr(0750, prometheus, prometheus) %{_localstatedir}/lib/prometheus/metrics
|
||||
%{_datarootdir}/prometheus
|
||||
%{_fillupdir}/sysconfig.prometheus
|
||||
%dir %attr(0700,%{prometheus_user},%{prometheus_group}) %{_sharedstatedir}/prometheus
|
||||
%dir %attr(0700,%{prometheus_user},%{prometheus_group}) %{_sharedstatedir}/prometheus/data
|
||||
%dir %attr(0700,%{prometheus_user},%{prometheus_group}) %{_sharedstatedir}/prometheus/metrics
|
||||
%dir %{_sysconfdir}/prometheus
|
||||
%config(noreplace) %{_sysconfdir}/prometheus/prometheus.yml
|
||||
%dir %{_libdir}/firewalld
|
||||
%dir %{_libdir}/firewalld/services
|
||||
%{_libdir}/firewalld/services/prometheus.xml
|
||||
|
||||
%changelog
|
||||
|
13
prometheus-buildmode-pie.patch
Normal file
13
prometheus-buildmode-pie.patch
Normal file
@ -0,0 +1,13 @@
|
||||
Index: prometheus-2.11.1/.promu.yml
|
||||
===================================================================
|
||||
--- prometheus-2.11.1.orig/.promu.yml 2019-07-31 12:44:46.190247145 +0200
|
||||
+++ prometheus-2.11.1/.promu.yml 2019-07-31 12:45:18.354547518 +0200
|
||||
@@ -10,7 +10,7 @@ build:
|
||||
path: ./cmd/prometheus
|
||||
- name: promtool
|
||||
path: ./cmd/promtool
|
||||
- flags: -mod=vendor -a
|
||||
+ flags: -mod=vendor -buildmode=pie -a
|
||||
ldflags: |
|
||||
-X github.com/prometheus/common/version.Version={{.Version}}
|
||||
-X github.com/prometheus/common/version.Revision={{.Revision}}
|
6
prometheus.firewall.xml
Normal file
6
prometheus.firewall.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<service>
|
||||
<short>Prometheus</short>
|
||||
<description>Prometheus monitoring system and time series database.</description>
|
||||
<port protocol="tcp" port="9090"/>
|
||||
</service>
|
9
prometheus.sysconfig
Normal file
9
prometheus.sysconfig
Normal file
@ -0,0 +1,9 @@
|
||||
## Path:
|
||||
## Description: Prometheus monitoring server settings
|
||||
## Type: string
|
||||
## Default: ""
|
||||
## ServiceRestart: prometheus
|
||||
#
|
||||
# Command line options for prometheus
|
||||
#
|
||||
ARGS=""
|
Loading…
Reference in New Issue
Block a user