Skip to content

Instantly share code, notes, and snippets.

@mjf
Last active December 20, 2020 10:58
Show Gist options
  • Save mjf/5bcbf134c21f73f0efee5658161a7bce to your computer and use it in GitHub Desktop.
Save mjf/5bcbf134c21f73f0efee5658161a7bce to your computer and use it in GitHub Desktop.
RPM specfiles for the recent HAProxy and InfluxDB OSS 2 releases
# RPM specfile for the HAProxy Load Balancer
# Copyright (C) 2017-2019 Matouš Jan Fialka, <https://mjf.cz/>
# Released under the terms of "The MIT License"
# Usage: rpmbuild -ba haproxy.spec \
# [-D'with_libslz 1'] \
# [-D'with_51degrees_addon 1'] \
# [-D'addon_51degrees_trie 1'] \
# [--undefine=_disable_source_fetch]
# global
%global _hardened_build 1
%global _performance_build 1
# package release
%define package_name haproxy
%define package_release 1
%define package_vendor mjf
# haproxy
%define haproxy_version 2.2
%define haproxy_release 0
%define haproxy_user haproxy
%define haproxy_uid 188
%define haproxy_group %{haproxy_user}
%define haproxy_gid %{haproxy_uid}
%define haproxy_homedir %{_localstatedir}/lib/haproxy
%define haproxy_confdir %{_sysconfdir}/haproxy
%define haproxy_tmpfilesdir %{_sysconfdir}/tmpfiles.d
%define haproxy_libdir %{_sharedstatedir}/haproxy
%define haproxy_chrootdir %{_var}/empty/haproxy
%define haproxy_rundir /run/haproxy
# library
%define openssl_version 1.1.1g
%define libslz_version ff537154e7f5f2fffdbef1cd8c52b564c1b00067
# add-ons
%define addon_51degrees_version 3.2.21.1
%if %{defined addon_51degrees_trie}
%define with_51degrees_addon 1
%endif
# package information
Name: %{package_name}
Version: %{haproxy_version}.%{haproxy_release}
Release: %{package_release}.%{package_vendor}%{?dist}
Summary: HAProxy Load Balancer
URL: https://www.haproxy.org
License: GPLv2+
Group: HAProxy
Provides: %{package_name}%{?_isa} = %{version}-%{release}
Conflicts: %{package_name}%{?_isa} < %{version}-%{release}
# requirements
Requires: epel-release
Requires: ius-release
Requires: lua53u
Requires(pre): shadow-utils
Requires(preun): systemd
Requires(post): systemd
Requires(postun): systemd
# build requirements
BuildRequires: gcc
BuildRequires: systemd-devel
BuildRequires: pcre-devel
BuildRequires: zlib-devel
BuildRequires: lua53u-devel
BuildRequires: python-sphinx
# sources
Source0: https://www.haproxy.org/download/%{haproxy_version}/src/haproxy-%{version}.tar.gz
Source1: https://www.openssl.org/source/openssl-%{openssl_version}.tar.gz
%if %{defined with_libslz}
Source2: http://git.1wt.eu/web?p=libslz.git;a=snapshot;h=%{libslz_version};sf=tar#/libslz-%{libslz_version}.tar
%endif
%if %{defined with_51degrees_addon}
Source3: https://github.com/51Degrees/Device-Detection/archive/v%{addon_51degrees_version}.tar.gz#/51degrees-%{addon_51degrees_version}.tar.gz
%endif
Source4: halog.1.gz
# description
%if %{defined with_51degrees_addon}
%if %{defined addon_51degrees_trie}
%if %{defined with_libslz}
%description
HAProxy Load Balancer with recent OpenSSL, LibSLZ, 51Degrees/trie and Prometheus metrics service
%else
%description
HAProxy Load Balancer with recent OpenSSL, 51Degrees/trie and Prometheus metrics service
%endif
%else
%if %{defined with_libslz}
%description
HAProxy Load Balancer with recent OpenSSL, LibSLZ, 51Degrees and Prometheus metrics service
%else
%description
HAProxy Load Balancer with recent OpenSSL, 51Degrees and Prometheus metrics service
%endif
%endif
%else
%if %{defined with_libslz}
%description
HAProxy Load Balancer with recent OpenSSL, LibSLZ and Prometheus metrics service
%else
%description
HAProxy Load Balancer with recent OpenSSL and Prometheus metrics service
%endif
%endif
# miscellanea
%define __perl_requires %{nil}
%prep
%setup -q -n %{package_name}-%{version}
%build
mkdir -p %{_tmppath}/local
# make openssl
tar -xzvf %{SOURCE1} -C %{_tmppath}/local
pushd %{_tmppath}/local/openssl-%{openssl_version}
./Configure --prefix=%{_tmppath}/local \
-DSSL_ALLOW_ADH \
no-shared \
no-tls1 \
no-weak-ssl-ciphers \
no-zlib \
%ifarch %ix86 x86_64
linux-x86_64
%endif
old_rpm_opt_flags="$RPM_OPT_FLAGS"
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wa,--noexecstack -DPURIFY"
%{__make} -j$(nproc) %{?_smp_mflags}
%{__make} -j$(nproc) install_sw
RPM_OPT_FLAGS="$old_rpm_opt_flags"
popd
# make libslz
%if %{defined with_libslz}
rm -r -f %{_tmppath}/local/libslz{,-%{libslz_version}}
tar -xvf %{SOURCE2} -C %{_tmppath}/local
mv %{_tmppath}/local/libslz{,-%{libslz_version}}
pushd %{_tmppath}/local/libslz-%{libslz_version}
%{__make} -j$(nproc)
%{__make} -j$(nproc) install-static
popd
%endif
# make 51degrees
%if %{defined with_51degrees_addon}
tar -xzvf %{SOURCE3} -C %{_tmppath}/local
%endif
# make haproxy
%{__make} -j$(nproc) %{?_smp_mflags} ARCH=%{_target_cpu} TARGET=linux-glibc \
%ifarch %ix86 x86_64
USE_REGPARM=1 \
%endif
USE_LINUX_TPROXY=1 \
USE_TFO=1 \
USE_NS=1 \
USE_SYSTEMD=1 \
USE_OPENSSL=1 \
%if %{defined with_libslz}
USE_SLZ=1 \
%else
USE_ZLIB=1 \
%endif
USE_PCRE=1 \
USE_PCRE_JIT=1 \
USE_LUA=1 \
%if %{defined with_51degrees_addon}
USE_51DEGREES=1 \
%endif
SSL_LIB=%{_tmppath}/local/lib \
SSL_INC=%{_tmppath}/local/include \
LUA_LIB_NAME=lua-5.3 \
LUA_LIB=%{_libdir}/lua/5.3 \
LUA_INC=%{_includedir}/lua-5.3 \
%if %{defined with_51degrees_addon}
%if %{defined addon_51degrees_trie}
51DEGREES_SRC=%{_tmppath}/local/Device-Detection-%{addon_51degrees_version}/src/trie \
%else
51DEGREES_SRC=%{_tmppath}/local/Device-Detection-%{addon_51degrees_version}/src/pattern \
%endif
%endif
%if %{defined with_libslz}
SLZ_INC=%{_tmppath}/local/libslz \
SLZ_LIB=%{_tmppath}/local/libslz \
%endif
ADDINC='%{optflags}' \
ADDLIB='%{__global_ldflags} -pthread' \
DEFINE='-DTCP_USER_TIMEOUT=18 -DMAX_SESS_STKCTR=12' \
EXTRA_OBJS='contrib/prometheus-exporter/service-prometheus.o'
# make halog
%{__make} -C contrib/halog
# make haproxy tools
%{__make} -C contrib/hpack
%{__make} -C contrib/ip6range
%{__make} -C contrib/iprange
%{__make} -C contrib/tcploop
# make manuals
pushd doc/lua-api
%{__make} man
gzip -9 _build/man/haproxy-lua.1
popd
# make systemd service
cat >haproxy.service <<- EOT
[Unit]
Description=HAProxy Load Balancer
Documentation=whatis:haproxy man:haproxy(1) http://cbonte.github.io/haproxy-dconv/%{haproxy_version}/intro.html
After=network-online.target
Wants=network-online.target
[Service]
UMask=077
AssertPathExists=%{_sysconfdir}/sysconfig/haproxy
EnvironmentFile=-%{_sysconfdir}/sysconfig/haproxy
ExecStartPre=%{_sbindir}/haproxy -f "\$CONFIGDIR" -C "\$CONFIGDIR" -c -q -L "\$LOCAL_PEER_NAME"
#ExecStartPre=-%{_bindir}/mkdir "%{haproxy_chrootdir}/dev"
#ExecStartPre=-%{_bindir}/mknod "%{haproxy_chrootdir}/dev/random" c 1 8
#ExecStartPre=-%{_bindir}/mknod "%{haproxy_chrootdir}/dev/urandom" c 1 9
ExecStart=%{_sbindir}/haproxy -Ws -f "\$CONFIGDIR" -C "\$CONFIGDIR" -p "\$MASTER_PIDFILE" -sf "\$(cat \$MASTER_PIDFILE)" -L "\$LOCAL_PEER_NAME" \$EXTRA_START_OPTS
ExecReload=%{_sbindir}/haproxy -f "\$CONFIGDIR" -C "\$CONFIGDIR" -c -q -L "\$LOCAL_PEER_NAME" \$EXTRA_RELOAD_OPTS
ExecReload=%{_bindir}/kill -USR2 \$MAINPID
ExecStopPost=%{_bindir}/rm "\$MASTER_SOCKET" "\$MASTER_PIDFILE" "\$STATS_SOCKET"
Type=notify
NotifyAccess=main
KillMode=mixed
KillSignal=USR1
Restart=always
SuccessExitStatus=143
OOMScoreAdjust=-999
NoNewPrivileges=true
ProtectHome=true
ProtectSystem=true
SystemCallFilter=~@cpu-emulation @keyring @module @obsolete @raw-io @reboot @swap @sync
[Install]
WantedBy=multi-user.target
EOT
# make sysconfig
cat >haproxy.sysconfig <<- EOT
CONFIGDIR='%{_sysconfdir}/haproxy'
MASTER_PIDFILE='%{haproxy_rundir}/master.pid'
MASTER_SOCKET='%{haproxy_rundir}/master.sock'
STATS_SOCKET='%{haproxy_rundir}/stats.sock'
LOCAL_PEER_NAME="\$HOSTNAME"
EXTRA_START_OPTS="-S \$MASTER_SOCKET"
EXTRA_RELOAD_OPTS=""
EOT
# make haproxy config
cat >haproxy.cfg <<- EOT
global
user haproxy
group haproxy
chroot %{haproxy_chrootdir}
stats socket \$STATS_SOCKET mode 0600 expose-fd listeners level user
stats timeout 2m
defaults
mode tcp
timeout client 5s
timeout connect 5s
timeout server 5s
frontend stats
bind *:8404
mode http
option http-use-htx
http-request use-service prometheus-exporter if { path /metrics }
stats enable
stats uri /stats
stats refresh 10s
EOT
cat >haproxy.tmpfiles <<- EOT
d %{haproxy_rundir} 0700 %{haproxy_user} %{haproxy_group} -
EOT
%clean
[ %{buildroot} = / ] || rm -r -f %{buildroot}
[ %{_tmppath}/local = / ] || rm -r -f %{_tmppath}/local
%pre
getent group %{haproxy_group} &>/dev/null || \
groupadd %{haproxy_group} \
-r \
-g %{haproxy_gid}
getent passwd %{haproxy_user} &>/dev/null || \
useradd %{haproxy_user} \
-r \
-u %{haproxy_uid} \
-g %{haproxy_group} \
-d %{haproxy_homedir} \
-c 'HAProxy Load Balancer' \
-s /sbin/nologin
exit 0
%install
umask 077
%{__make} install-bin DESTDIR=%{buildroot} PREFIX=%{_prefix}
%{__make} install-man DESTDIR=%{buildroot} PREFIX=%{_prefix}
install -d %{buildroot}%{haproxy_chrootdir}
install -d %{buildroot}%{haproxy_confdir}
install -d %{buildroot}%{haproxy_homedir}
install -d %{buildroot}%{haproxy_libdir}
install -d %{buildroot}%{haproxy_rundir}
# haproxy package
install -D doc/lua-api/_build/man/haproxy-lua.1.gz %{buildroot}%{_mandir}/man1/haproxy-lua.1.gz
install -D haproxy.cfg %{buildroot}%{haproxy_confdir}/haproxy.cfg
install -D haproxy.tmpfiles %{buildroot}%{haproxy_tmpfilesdir}/haproxy.conf
install -D haproxy.service %{buildroot}%{_unitdir}/haproxy.service
install -D haproxy.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/haproxy
# haproxy-halog package
install -D contrib/halog/halog %{buildroot}%{_sbindir}/halog
install -D %{SOURCE4} %{buildroot}%{_mandir}/man1/halog.1.gz
# haproxy-tools package
install -D contrib/hpack/decode %{buildroot}%{_bindir}/decode
install -D contrib/ip6range/ip6range %{buildroot}%{_bindir}/ip6range
install -D contrib/iprange/iprange %{buildroot}%{_bindir}/iprange
install -D contrib/tcploop/tcploop %{buildroot}%{_bindir}/tcploop
%post
%systemd_post haproxy.service
%preun
%systemd_preun haproxy.service
%postun
%systemd_postun_with_restart haproxy.service
%files
%defattr(-,root,root,-)
%attr(0700,root,root) %dir %{haproxy_confdir}
%attr(0700,root,root) %dir %{haproxy_homedir}
%attr(0700,root,root) %dir %{haproxy_libdir}
%attr(0700,%{haproxy_user},%{haproxy_group}) %dir %{haproxy_chrootdir}
%attr(0700,%{haproxy_user},%{haproxy_group}) %dir %{haproxy_rundir}
%attr(0755,root,root) %{_sbindir}/haproxy
%attr(0644,root,root) %{_unitdir}/haproxy.service
%attr(0644,root,root) %config(noreplace) %{haproxy_confdir}/haproxy.cfg
%attr(0644,root,root) %config(noreplace) %{haproxy_tmpfilesdir}/haproxy.conf
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/haproxy
%attr(0644,root,root) %doc CHANGELOG
%attr(0644,root,root) %doc CONTRIBUTING
%attr(0644,root,root) %doc INSTALL
%attr(0644,root,root) %doc LICENSE
%attr(0644,root,root) %doc MAINTAINERS
%attr(0644,root,root) %doc README
%attr(0644,root,root) %doc ROADMAP
%attr(0644,root,root) %doc SUBVERS
%attr(0644,root,root) %doc VERDATE
%attr(0644,root,root) %doc VERSION
%if %{defined with_51degrees_addon}
%attr(0644,root,root) %doc doc/51Degrees-device-detection.txt
%endif
%attr(0644,root,root) %doc doc/architecture.txt
%attr(0644,root,root) %doc doc/configuration.txt
%attr(0644,root,root) %doc doc/gpl.txt
%attr(0644,root,root) %doc doc/internals/acl.txt
%attr(0644,root,root) %doc doc/intro.txt
%attr(0644,root,root) %doc doc/lgpl.txt
%attr(0644,root,root) %doc doc/management.txt
%attr(0644,root,root) %doc doc/network-namespaces.txt
%attr(0644,root,root) %doc doc/proxy-protocol.txt
%attr(0644,root,root) %doc doc/proxy-protocol.txt
%attr(0644,root,root) %doc doc/SPOE.txt
%attr(0644,root,root) %doc %{_mandir}/man1/haproxy.1.gz
%attr(0644,root,root) %doc %{_mandir}/man1/haproxy-lua.1.gz
%attr(0644,root,root) %license LICENSE
%attr(0644,root,root) %license doc/gpl.txt
%attr(0644,root,root) %license doc/lgpl.txt
# haproxy-halog package
%package halog
Summary: HAProxy Log Statistics Reporter
Group: HAProxy
%description halog
HAProxy tool for log statistics reporting
%files halog
%defattr(-,root,root,-)
%attr(0755,root,root) %{_sbindir}/halog
%attr(0644,root,root) %doc %{_mandir}/man1/halog.1.gz
# haproxy-tools package
%package tools
Summary: HAProxy Tools
Group: HAProxy
%description tools
HAProxy tools for HPACK decoding, TCP testing, debugging and more
%files tools
%defattr(-,root,root,-)
%attr(0755,root,root) %{_bindir}/decode
%attr(0755,root,root) %{_bindir}/ip6range
%attr(0755,root,root) %{_bindir}/iprange
%attr(0755,root,root) %{_bindir}/tcploop
%changelog
* Mon Jul 8 2020 Matouš Jan Fialka <[email protected]> - 2.2.0-1.mjf.el7.centos
- Update to HAProxy v2.2.0, OpenSSL v1.1.1g, LibSLZ ff537154e7 and 51Degrees v3.2.21.1
* Mon Jun 22 2020 Matouš Jan Fialka <[email protected]> - 2.1.7-1.mjf.el7.centos
- Update to HAProxy v2.1.7, OpenSSL v1.1.1g, LibSLZ ff537154e7 and 51Degrees v3.2.21.1
* Mon Jun 22 2020 Matouš Jan Fialka <[email protected]> - 2.1.4-2.mjf.el7.centos
- Update to HAProxy v2.1.4, OpenSSL v1.1.1g, LibSLZ ff537154e7 and 51Degrees v3.2.21.1
* Mon May 4 2020 Matouš Jan Fialka <[email protected]> - 2.1.4-1.mjf.el7.centos
- Update to HAProxy v2.1.4, OpenSSL v1.1.1g, LibSLZ ff537154e7 and 51Degrees v3.2.21.1
* Fri Dec 27 2019 Matouš Jan Fialka <[email protected]> - 2.1.2-1.mjf.el7.centos
- Update to HAProxy v2.1.2
* Wed Dec 18 2019 Matouš Jan Fialka <[email protected]> - 2.1.1-1.mjf.el7.centos
- Update to HAProxy v2.1.1
* Tue Nov 26 2019 Matouš Jan Fialka <[email protected]> - 2.1.0-1.mjf.el7.centos
- Update to HAProxy v2.1.0
* Mon Nov 18 2019 Matouš Jan Fialka <[email protected]> - 2.0.9-1.mjf.el7.centos
- Update to HAProxy v2.0.9
* Wed Nov 13 2019 Matouš Jan Fialka <[email protected]> - 2.0.8-2.mjf.el7.centos
- Add EXTRA_START_OPTS and EXTRA_RELOAD_OPTS instead of just EXTRA_OPTS
* Thu Oct 24 2019 Matouš Jan Fialka <[email protected]> - 2.0.8-1.mjf.el7.centos
- Update to HAProxy v2.0.8, add -C option to the haproxy.service
* Fri Oct 11 2019 Matouš Jan Fialka <[email protected]> - 2.0.7-3.mjf.el7.centos
- Add epel-release installation requirent
* Wed Oct 9 2019 Matouš Jan Fialka <[email protected]> - 2.0.7-2.mjf.el7.centos
- Add Prometheus metrics service to HAProxy v2.0.7
* Thu Oct 3 2019 Matouš Jan Fialka <[email protected]> - 2.0.7-1.mjf.el7.centos
- Update to HAProxy v2.0.7 and to OpenSSL v1.1.1d
* Wed Sep 4 2019 Matouš Jan Fialka <[email protected]> - 2.0.5-1.mjf.el7.centos
- Update to HAProxy v2.0.5
* Wed Aug 7 2019 Matouš Jan Fialka <[email protected]> - 2.0.4-1.mjf.el7.centos
- Update to HAProxy v2.0.4
* Tue Jul 9 2019 Matouš Jan Fialka <[email protected]> - 2.0.1-1.mjf.el7.centos
- Update to HAProxy v2.0.1 and OpenSSL 1.1.1c, removed "contrib/debug/flags"
* Tue Apr 9 2019 Matouš Jan Fialka <[email protected]> - 1.9.6-1.mjf.el7.centos
- Update to HAProxy v1.9.6 and LibSLZ and 51Degrees v3.2.20.4
* Thu Mar 21 2019 Matouš Jan Fialka <[email protected]> - 1.9.5-1.mjf.el7.centos
- Update to HAProxy v1.9.5 and LibSLZ commit 2969ecdb8ce24ff5a595f6e3ffba4db5b8b80aa3
* Thu Feb 21 2019 Matouš Jan Fialka <[email protected]> - 1.9.4-2.mjf.el7.centos
- Add manual page for halog(1)
* Thu Feb 14 2019 Matouš Jan Fialka <[email protected]> - 1.9.4-1.mjf.el7.centos
- Update to HAProxy v1.9.4
* Thu Jan 31 2019 Matouš Jan Fialka <[email protected]> - 1.9.3-1.mjf.el7.centos
- Update to HAProxy v1.9.3
- Add support for LibSLZ
- Add support for /etc/tmpfiles.d for /run/haproxy directory
- Improve SystemD unit file
* Thu Jan 24 2019 Matouš Jan Fialka <[email protected]> - 1.9.2-3.mjf.el7.centos
- Compile HAProxy with MAX_SESS_STKCTR=12 (sticky counters "sc0-11")
- Improve HAProxy configuration
* Mon Jan 21 2019 Matouš Jan Fialka <[email protected]> - 1.9.2-2.mjf.el7.centos
- SystemD service and configuration template improvements
* Fri Jan 18 2019 Matouš Jan Fialka <[email protected]> - 1.9.2-1.mjf.el7.centos
- Update to HAProxy v1.9.2 with OpenSSL v1.1.1a without TLS1 and weak ciphers
* Tue Jan 8 2019 Matouš Jan Fialka <[email protected]> - 1.9.0-1.mjf-el7.centos
- Update to HAProxy v1.9.0 with OpenSSL v1.1.1a and 51Degrees v3.2.18.5
- Improve SystemD unit and prepare chroot and runtime directories
- Rename the resulting RPM packages to just haproxy-*
- Create separate RPM packages for HALog and some of the contributed tools
* Mon Nov 5 2018 Matouš Jan Fialka <[email protected]> - 1.8.14-2.mjf-el7.centos
- Cleanup of the RPM spec file
* Mon Oct 1 2018 Matouš Jan Fialka <[email protected]> - 1.8.14-1.mjf.el7.centos
- Update to HAProxy v1.8.14 with OpenSSL v1.1.1
* Tue Jul 31 2018 Matouš Jan Fialka <[email protected]> - 1.8.13-1.mjf.el7.centos
- Update to HAProxy v1.8.13
* Mon Jul 23 2018 Matouš Jan Fialka <[email protected]> - 1.8.12-1.mjf.el7.centos
- Update to HAProxy v1.8.12 with OpenSSL v1.1.1-pre8
* Fri May 11 2018 Matouš Jan Fialka <[email protected]> - 1.8.8-1.mjf.el7.centos
- Update to HAProxy v1.8.8 with OpenSSL v1.1.1-pre6
* Wed Apr 4 2018 Matouš Jan Fialka <[email protected]> - 1.8.5-1.mjf.el7.centos
- Update to HAProxy v1.8.5 with OpenSSL v1.1.1-pre4, add -pthread to ADDLIB
* Wed Jan 3 2018 Matouš Jan Fialka <[email protected]> - 1.8.3-1.mjf.el7.centos
- Update to HAProxy v1.8.3, add DEFINE=-DTCP_USER_TIMEOUT=18 for make
* Mon Dec 4 2017 Matouš Jan Fialka <[email protected]> - 1.8.1-1.mjf.el7.centos
- Initial packaging
# vi:nowrap:
# RPM specfile for the InfluxDB OSS 2 Time Series Platform
# Copyright (C) 2020 Matouš Jan Fialka, <https://mjf.cz/>
# Released under the terms of "The MIT License"
# Usage: rpmbuild -ba influxdb2.spec [--undefine=_disable_source_fetch]
# global
%global _hardened_build 1
%global _performance_build 1
# package release
%define package_name influxdb2
%define package_release 1
%define package_vendor mjf
# influxdb2
%define influxdb2_version 2.0.0
%define influxdb2_release beta.13
%define influxdb2_user influxdb2
%define influxdb2_uid 199
%define influxdb2_group %{influxdb2_user}
%define influxdb2_gid %{influxdb2_uid}
%define influxdb2_homedir %{_localstatedir}/lib/influxdb2
%define influxdb2_rundir /run
# package information
Name: %{package_name}
Version: %{influxdb2_version}.%{influxdb2_release}
Release: %{package_release}.%{package_vendor}%{?dist}
Summary: InfluxDB OSS 2 Time Series Platform
URL: https://www.influxdata.com/products/influxdb-overview/
License: MIT
Group: Network Servers
Provides: %{package_name}%{?_isa} = %{version}-%{release}
Conflicts: %{package_name}%{?_isa} < %{version}-%{release}
# requirements
Requires(pre): shadow-utils
Requires(preun): systemd
Requires(post): systemd
Requires(postun): systemd
# sources
Source0: https://dl.influxdata.com/influxdb/releases/influxdb_%{influxdb2_version}-%{influxdb2_release}_linux_amd64.tar.gz
# description
%description
The InfluxDB 2 time series platform is purpose-built to collect, store, process
and visualize metrics and events. InfluxDB OSS 2 is the open source version of
InfluxDB 2.
# miscellanea
%define __perl_requires %{nil}
%prep
%setup -q -n influxdb_%{influxdb2_version}-%{influxdb2_release}_linux_amd64
%build
# make influx{,d}2 files
mv influx{,2}
mv influxd{,2}
# make systemd service
cat >influxd2.service <<- EOT
[Unit]
Description=InfluxDB OSS 2 Time Series Platform
Documentation=https://v2.docs.influxdata.com/v2.0/
After=network.target
AssertPathExists=%{_sysconfdir}/sysconfig/influxd2
AssertPathExists=%{influxdb2_homedir}
AssertPathExists=%{influxdb2_homedir}/engine
[Service]
UMask=077
EnvironmentFile=-%{_sysconfdir}/sysconfig/influxd2
ExecStart=%{_sbindir}/influxd2 \$INFLUXD2_OPTS
User=%{influxdb2_user}
Group=%{influxdb2_group}
Restart=on-failure
OOMScoreAdjust=-999
NoNewPrivileges=true
ProtectHome=true
ProtectSystem=true
[Install]
WantedBy=multi-user.target
EOT
# make sysconfig
cat >influxd2.sysconfig <<- EOT
INFLUXD2_OPTS="--reporting-disabled --bolt-path %{influxdb2_homedir}/influxd.bolt --engine-path %{influxdb2_homedir}/engine --http-bind-address=0.0.0.0:9999"
EOT
%clean
[ %{buildroot} = / ] || rm -r -f %{buildroot}
%pre
getent group %{influxdb2_group} &>/dev/null || \
groupadd %{influxdb2_group} \
-r \
-g %{influxdb2_gid}
getent passwd %{influxdb2_user} &>/dev/null || \
useradd %{influxdb2_user} \
-r \
-u %{influxdb2_uid} \
-g %{influxdb2_group} \
-d %{influxdb2_homedir} \
-c 'InfluxDB OSS 2 Time Series Platform' \
-s /sbin/nologin
exit 0
%install
umask 077
install -d %{buildroot}%{influxdb2_homedir}
install -d %{buildroot}%{influxdb2_homedir}/engine
install -D influx2 %{buildroot}%{_bindir}/influx2
install -D influxd2 %{buildroot}%{_sbindir}/influxd2
install -D influxd2.service %{buildroot}%{_unitdir}/influxd2.service
install -D influxd2.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/influxd2
%post
%systemd_post influxd2.service
%preun
%systemd_preun influxd2.service
%postun
%systemd_postun_with_restart influxd2.service
%files
%defattr(-,root,root,-)
%attr(0700,%{influxdb2_user},%{influxdb2_group}) %dir %{influxdb2_homedir}
%attr(0700,%{influxdb2_user},%{influxdb2_group}) %dir %{influxdb2_homedir}/engine
%attr(0755,root,root) %{_bindir}/influx2
%attr(0755,root,root) %{_sbindir}/influxd2
%attr(0644,root,root) %{_unitdir}/influxd2.service
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/influxd2
%changelog
* Wed Jul 8 2020 Matouš Jan Fialka <[email protected]> - 2.0.0.beta.13-1.mjf.el8.centos
- Update to version 2.0.0.beta.13
* Wed Jun 16 2020 Matouš Jan Fialka <[email protected]> - 2.0.0.beta.12-1.mjf.el8.centos
- Update to version 2.0.0.beta.12
* Wed Jun 10 2020 Matouš Jan Fialka <[email protected]> - 2.0.0.beta.10-1.mjf.el8.centos
- Initial packaging
# vi:nowrap:
help:
@ echo 'haproxy[-libslz][-51degrees[-trie]]'
@ echo 'influxdb2'
all:
@ echo 'not supported'
clean:
@ rpmbuild-clean
haproxy:
@ rpmbuild -ba ~/rpmbuild/SPECS/haproxy.spec --undefine=_disable_source_fetch
haproxy-51degrees:
@ rpmbuild -ba ~/rpmbuild/SPECS/haproxy.spec -D'with_51degrees_addon 1' --undefine=_disable_source_fetch
haproxy-51degrees-trie:
@ rpmbuild -ba ~/rpmbuild/SPECS/haproxy.spec -D'with_51degrees_addon 1' -D'addon_51degrees_trie 1' --undefine=_disable_source_fetch
haproxy-libslz:
@ rpmbuild -ba ~/rpmbuild/SPECS/haproxy.spec -D'with_libslz 1' --undefine=_disable_source_fetch
haproxy-libslz-51degrees:
@ rpmbuild -ba ~/rpmbuild/SPECS/haproxy.spec -D'with_libslz 1' -D'with_51degrees_addon 1' --undefine=_disable_source_fetch
haproxy-libslz-51degrees-trie:
@ rpmbuild -ba ~/rpmbuild/SPECS/haproxy.spec -D'with_libslz 1' -D'with_51degrees_addon 1' -D'addon_51degrees_trie 1' --undefine=_disable_source_fetch
influxdb2:
@ rpmbuild -ba ~/rpmbuild/SPECS/influxdb2.spec --undefine=_disable_source_fetch
# vi:ft=make:nowrap:
.TH HALOG "1" "July 2013" "halog" "User Commands"
.SH NAME
halog \- HAProxy log statistics reporter
.SH SYNOPSIS
.B halog
[\fI-h|--help\fR]
.br
.B halog
[\fIoptions\fR] <LOGFILE
.SH DESCRIPTION
.B halog
reads HAProxy log data from stdin and extracts and displays lines matching
user-specified criteria.
.SH OPTIONS
.SS Input filters \fR(several filters may be combined)
.TP
\fB\-H\fR
Only match lines containing HTTP logs (ignore TCP)
.TP
\fB\-E\fR
Only match lines without any error (no 5xx status)
.TP
\fB\-e\fR
Only match lines with errors (status 5xx or negative)
.TP
\fB\-rt\fR|\fB\-RT\fR <time>
Only match response times larger|smaller than <time>
.TP
\fB\-Q\fR|\fB\-QS\fR
Only match queued requests (any queue|server queue)
.TP
\fB\-tcn\fR|\fB\-TCN\fR <code>
Only match requests with/without termination code <code>
.TP
\fB\-hs\fR|\fB\-HS\fR <[min][:][max]>
Only match requests with HTTP status codes within/not within min..max. Any of
them may be omitted. Exact code is checked for if no ':' is specified.
.SS
Modifiers
.TP
\fB\-v\fR
Invert the input filtering condition
.TP
\fB\-q\fR
Don't report errors/warnings
.TP
\fB\-m\fR <lines>
Limit output to the first <lines> lines
.SS
Output filters \fR\- only one may be used at a time
.TP
\fB\-c\fR
Only report the number of lines that would have been printed
.TP
\fB\-pct\fR
Output connect and response times percentiles
.TP
\fB\-st\fR
Output number of requests per HTTP status code
.TP
\fB\-cc\fR
Output number of requests per cookie code (2 chars)
.TP
\fB\-tc\fR
Output number of requests per termination code (2 chars)
.TP
\fB\-srv\fR
Output statistics per server (time, requests, errors)
.TP
\fB\-u\fR*
Output statistics per URL (time, requests, errors)
.br
Additional characters indicate the output sorting key:
.RS
.TP
\fB\-u\fR
URL
.TP
\fB\-uc\fR
Request count
.TP
\fB\-ue\fR
Error count
.TP
\fB\-ua\fR
Average response time
.TP
\fB\-ut\fR
Average total time
.TP
\fB\-uao\fR, \fB\-uto\fR
Average times computed on valid ('OK') requests
.TP
\fB\-uba\fR
Average bytes returned
.TP
\fB\-ubt\fR
Total bytes returned
.RE
.SH "SEE ALSO"
.BR haproxy (1)
.SH AUTHOR
.PP
\fBhalog\fR was written by Willy Tarreau <[email protected]> and is part of \fBhaproxy\fR(1).
.PP
This manual page was written by Apollon Oikonomopoulos <[email protected]> for the Debian project (but may
be used by others).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment