- Drop EnvironmentFile from the service definition

- Explicitly unset $ARGS environment variable. Setting environment
  variables should be done in drop-in systemd configuration files.
- Drop go_nostrip macro. It is not needed with current binutils and
  Go.

OBS-URL: https://build.opensuse.org/package/show/server:monitoring/golang-github-lusitaniae-apache_exporter?expand=0&rev=33
This commit is contained in:
Witek Bedyk 2024-08-19 08:17:25 +00:00 committed by Git OBS Bridge
commit 29b66bb847
11 changed files with 429 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

21
_service Normal file
View File

@ -0,0 +1,21 @@
<services>
<service name="obs_scm" mode="manual">
<param name="url">https://github.com/Lusitaniae/apache_exporter</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="revision">v1.0.8</param>
<param name="versionrewrite-pattern">v(.*)</param>
</service>
<service name="tar" mode="buildtime"/>
<service name="recompress" mode="buildtime">
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
<service name="set_version" mode="manual">
<param name="basename">apache_exporter</param>
</service>
<service name="go_modules" mode="manual">
<param name="archive">apache_exporter-1.0.8.obscpio</param>
</service>
</services>

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9e418791f2b1e01a074873954e7b71251c0dae722402db76122cb15d781f78d4
size 73739

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a8ab7bdd109e5131627024138945b385b220b626bae4ba1623c9671a7dc1eecb
size 73739

4
apache_exporter.obsinfo Normal file
View File

@ -0,0 +1,4 @@
name: apache_exporter
version: 1.0.8
mtime: 1719413284
commit: 887a69584e567f5f94de6b2f8bfde023ba7e697a

View File

@ -0,0 +1,24 @@
# AppArmor profile for prometheus apache-exporter
#include <tunables/global>
profile /usr/bin/prometheus-apache_exporter flags=(attach_disconnected) {
#include <abstractions/base>
network inet stream,
network inet6 stream,
/etc/ld.so.cache r,
/etc/nsswitch.conf r,
/etc/passwd r,
@{PROC}/sys/net/core/somaxconn r,
@{PROC}/@{pid}/fd/ r,
@{PROC}/@{pid}/{stat,limits} r,
@{sys}/kernel/mm/transparent_hugepage/hpage_pmd_size r,
# grant read access to mtail executable
/usr/bin/prometheus-apache_exporter r,
}

View File

@ -0,0 +1,168 @@
-------------------------------------------------------------------
Mon Aug 12 10:55:00 UTC 2024 - Witek Bedyk <witold.bedyk@suse.com>
- Drop EnvironmentFile from the service definition
- Explicitly unset $ARGS environment variable. Setting environment
variables should be done in drop-in systemd configuration files.
-------------------------------------------------------------------
Thu Aug 8 10:25:11 UTC 2024 - Witek Bedyk <witold.bedyk@suse.com>
- Drop go_nostrip macro. It is not needed with current binutils and
Go.
-------------------------------------------------------------------
Mon Jul 8 07:30:16 UTC 2024 - Witek Bedyk <witold.bedyk@suse.com>
- Migrate from `disabled` to `manual` source service type
- Drop BuildRequires: golang-packaging
- Upgrade to version 1.0.8 (bsc#1227341)
* Update prometheus/client_golang to version 1.19.1
* Update x/net to version 0.23.0
- Upgrade to version 1.0.7
* Update protobuf to version 1.33.0
* Update prometheus/client_golang to version 1.19.0
* Update prometheus/common to version 0.46.0
* Standardize landing page
- Upgrade to version 1.0.6
* Update prometheus/exporter-toolkit to version 0.11.0
* Update prometheus/client_golang to version 1.18.0
* Add User-Agent header
- Upgrade to version 1.0.4
* Update x/crypto to version 0.17.0
* Update alecthomas/kingpin/v2 to version 2.4.0
* Update prometheus/common to version 0.45.0
- Upgrade to version 1.0.3
* Update prometheus/client_golang to version 1.17.0
* Update x/net 0.17.0
- Upgrade to version 1.0.2
* Fix security bug in x/net dependency (CVE-2023-3978)
- Upgrade to version 1.0.1
* Update prometheus/exporter-toolkit to version 0.10.0
* Update prometheus/common to version 0.44.0
* Update prometheus/client_golang to version 1.16.0
-------------------------------------------------------------------
Tue Nov 21 15:05:11 UTC 2023 - Marina Latini <marina.latini@suse.com>
- Do not strip if SUSE Linux Enterprise 15 SP3
- Exclude debug for RHEL >= 8
- Build with Go >= 1.20 when the OS is not RHEL
- Spec file clean up
-------------------------------------------------------------------
Mon Sep 4 10:40:18 UTC 2023 - Witek Bedyk <witold.bedyk@suse.com>
- Fix apparmor profile for SLE 12
-------------------------------------------------------------------
Fri Aug 11 12:55:45 UTC 2023 - Witek Bedyk <witold.bedyk@suse.com>
- Do not build with apparmor profile for SLE 12
-------------------------------------------------------------------
Tue Jul 11 11:18:57 UTC 2023 - Witek Bedyk <witold.bedyk@suse.com>
- Upgrade to version 1.0.0 (jsc#PED-5405)
* Improved flag parsing
* Added support for custom headers
- Build with Go 1.19
- Build using promu
- Add _service file
- Fix sandboxing options
- Upgrade to version 0.13.4
* Fix denial of service vulnerability
(CVE-2022-32149, bsc#1204501)
- Upgrade to version 0.13.3
* Fix uncontrolled resource consumption
(CVE-2022-41723, bsc#1208270)
- Upgrade to version 0.13.1
* Fix panic caused by missing flagConfig options
- Upgrade to version 0.13.0
* Fix authentication bypass vulnarability
(CVE-2022-46146, bsc#1208046)
-------------------------------------------------------------------
Sun Sep 25 14:12:03 UTC 2022 - Michael Ströder <michael@stroeder.com>
- corrected comment in AppArmor profile
-------------------------------------------------------------------
Thu Sep 22 17:25:32 UTC 2022 - Michael Ströder <michael@stroeder.com>
- added AppArmor profile
- added sandboxing options to systemd service unit
-------------------------------------------------------------------
Tue Sep 20 09:40:38 UTC 2022 - Witek Bedyk <witold.bedyk@suse.com>
- Exclude s390 architecture (gh#SUSE/spacewalk#19050)
-------------------------------------------------------------------
Sun Mar 13 12:42:00 UTC 2022 - Michael Ströder <michael@stroeder.com>
- Update to upstream release 0.11.0 (jsc#SLE-24791)
* Add TLS support
* Switch to logger, please check --log.level and --log.format
flags
- Update to version 0.10.1
* Bugfix: Reset ProxyBalancer metrics on each scrape to
remove stale data
- Update to version 0.10.0
* Add Apache Proxy and other metrics
- Update to version 0.8.0
* Change commandline flags
* Add metrics: Apache version, request duration total
-------------------------------------------------------------------
Fri Jan 21 20:09:39 UTC 2022 - Stefan Bluhm <stefan.bluhm@clacee.eu>
- Adapted to build on Enterprise Linux 8
-------------------------------------------------------------------
Mon Mar 8 09:40:42 UTC 2021 - Witek Bedyk <witold.bedyk@suse.com>
- Require building with Go 1.15
-------------------------------------------------------------------
Wed Mar 18 17:49:17 UTC 2020 - Joao Cavalheiro <jcavalheiro@suse.com>
- Add support for RedHat 8
+ Adjust dependencies on spec file
+ Disable dwarf compression in go build
-------------------------------------------------------------------
Tue Nov 19 15:18:13 UTC 2019 - Joao Cavalheiro <jcavalheiro@suse.com>
- Update to 0.7
* Handle OS TERM signals
- Changes from 0.6
* Add option to override host name
-------------------------------------------------------------------
Tue Nov 19 13:08:57 UTC 2019 - Joao Cavalheiro <jcavalheiro@suse.com>
- Add support for Red Hat
-------------------------------------------------------------------
Thu Jun 6 09:26:16 UTC 2019 - jmc <jcavalheiro@suse.com>
- Add %license macro for LICENSE file
-------------------------------------------------------------------
Thu Apr 18 09:04:18 UTC 2019 - jcavalheiro@suse.com
- Fix license information in spec file (MIT)
-------------------------------------------------------------------
Wed Apr 17 17:08:16 UTC 2019 - jcavalheiro@suse.com
- Initial commit (v0.5.0)

View File

@ -0,0 +1,150 @@
#
# spec file for package golang-github-lusitaniae-apache_exporter
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2019 João Cavalheiro <jcavalheiro@suse.com>
#
# 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/
#
%if 0%{?rhel}
%if 0%{?rhel} >= 8
# Found compressed .debug_abbrev section, not attempting dwz compression
# DWARF version 0 unhandled
%global debug_package %{nil}
%endif
# Fix ERROR: No build ID note found in
%undefine _missing_build_ids_terminate_build
%endif
%if 0%{?suse_version}
%bcond_without apparmor
%else
%bcond_with apparmor
%endif
%if %{with apparmor} && 0%{?suse_version} > 1320
%bcond_without apparmor_reload
%else
%bcond_with apparmor_reload
%endif
# Templating vars to simplify and standardize Prometheus exporters spec files
%define githubrepo github.com/lusitaniae/apache_exporter
%define upstreamname apache_exporter
%define targetname prometheus-apache_exporter
%define serviceuser prometheus
Name: golang-github-lusitaniae-apache_exporter
Version: 1.0.8
Release: 0
Summary: Apache Exporter for Prometheus
License: MIT
Group: System/Management
URL: http://%{githubrepo}
Source: %{upstreamname}-%{version}.tar.gz
Source1: vendor.tar.gz
Source2: %{targetname}.service
Source3: apparmor-usr.bin.%{targetname}
BuildRequires: fdupes
BuildRequires: golang-github-prometheus-promu
%if 0%{?rhel}
BuildRequires: golang >= 1.18
Requires(pre): shadow-utils
%else
BuildRequires: golang(API) >= 1.20
Requires(pre): shadow
%if %{with apparmor}
%if %{with apparmor_reload}
BuildRequires: apparmor-abstractions
BuildRequires: apparmor-rpm-macros
Recommends: apparmor-abstractions
%else
BuildRequires: apparmor-profiles
%endif
%endif
%endif
ExcludeArch: s390
%{?systemd_ordering}
%description
Exports apache mod_status statistics via HTTP for Prometheus consumption.
%prep
%autosetup -a1 -n %{upstreamname}-%{version}
%build
GOPATH=%{_builddir}/go promu build -v
%install
install -D -m 0755 %{_builddir}/%{upstreamname}-%{version}/%{upstreamname}-%{version} %{buildroot}/%{_bindir}/%{targetname}
install -d -m 0755 %{buildroot}%{_unitdir}
install -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}
install -d -m 0755 %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{targetname}
%if %{with apparmor}
# AppArmor profile
mkdir -p %{buildroot}%{_sysconfdir}/apparmor.d
install -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/apparmor.d/usr.bin.%{targetname}
%endif
%check
%if 0%{?rhel}
# Fix OBS debug_package execution.
rm -f %{buildroot}/usr/lib/debug%{_bindir}/%{targetname}-%{version}-*.debug
%endif
%pre
%if 0%{?suse_version}
%service_add_pre %{targetname}.service
%endif
getent group %{serviceuser} >/dev/null || %{_sbindir}/groupadd -r %{serviceuser}
getent passwd %{serviceuser} >/dev/null || %{_sbindir}/useradd -r -g %{serviceuser} -d %{_localstatedir}/lib/%{serviceuser} -M -s /sbin/nologin %{serviceuser}
%post
%if 0%{?rhel}
%systemd_post %{targetname}.service
%else
%service_add_post %{targetname}.service
%if %{with apparmor_reload}
%apparmor_reload %{_sysconfdir}/apparmor.d/usr.bin.%{targetname}
%endif
%endif
%preun
%if 0%{?rhel}
%systemd_preun %{targetname}.service
%else
%service_del_preun %{targetname}.service
%endif
%postun
%if 0%{?rhel}
%systemd_postun %{targetname}.service
%else
%service_del_postun %{targetname}.service
%endif
%files
%defattr(-,root,root,-)
%doc README.md
%license LICENSE
%{_bindir}/%{targetname}
%{_unitdir}/%{targetname}.service
%{_sbindir}/rc%{targetname}
%if %{with apparmor}
%dir %{_sysconfdir}/apparmor.d
%config %{_sysconfdir}/apparmor.d/usr.bin.%{targetname}
%endif
%changelog

View File

@ -0,0 +1,29 @@
[Unit]
Description=Prometheus exporter for Apache metrics
Documentation=https://github.com/lusitaniae/apache_exporter
[Service]
Restart=always
User=prometheus
Environment=ARGS=
ExecStart=/usr/bin/prometheus-apache_exporter $ARGS
ExecReload=/bin/kill -HUP $MAINPID
TimeoutStopSec=20s
SendSIGKILL=no
# added automatically, for details please see
# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
ProtectSystem=full
ProtectHome=true
PrivateDevices=true
ProtectHostname=true
ProtectClock=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
RestrictRealtime=true
# end of automatic additions
[Install]
WantedBy=multi-user.target

3
vendor.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5f8bc48ed4f4865d8998d837412f049e052a374a52d3630ff713003b8ce37176
size 3094499