Closed dmitriykrapiva closed 1 month ago
Using the following Spec on RHEL 8, may be it's a good start.
%define haproxy_user haproxy
%define haproxy_group %{haproxy_user}
%define haproxy_homedir %{_localstatedir}/lib/haproxy
%define haproxy_confdir %{_sysconfdir}/haproxy
%define haproxy_datadir %{_datadir}/haproxy
%global _hardened_build 1
Name: haproxy24
Version: 2.4.1
Release: 1%{?dist}
Summary: HAProxy reverse proxy for high availability environments
License: GPLv2+
URL: http://www.haproxy.org/
Source0: %{url}/download/2.4/src/haproxy-%{version}.tar.gz
Source1: haproxy.service
Source2: haproxy.cfg
Source3: haproxy.logrotate
Source4: haproxy.sysconfig
Source5: halog.1
BuildRequires: gcc
BuildRequires: lua-devel
BuildRequires: pcre2-devel
BuildRequires: zlib-devel
BuildRequires: openssl-devel
BuildRequires: systemd-devel
BuildRequires: systemd
Requires(pre): shadow-utils
%{?systemd_requires}
Provides: haproxy = %{version}-%{release}
Provides: haproxy%{?_isa} = %{version}-%{release}
Conflicts: haproxy < %{version}-%{release}
%description
HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high
availability environments. Indeed, it can:
- route HTTP requests depending on statically assigned cookies
- spread load among several servers while assuring server persistence
through the use of HTTP cookies
- switch to backup servers in the event a main one fails
- accept connections to special ports dedicated to service monitoring
- stop accepting connections without breaking existing ones
- add, modify, and delete HTTP headers in both directions
- block requests matching particular patterns
- report detailed status to authenticated users from a URI
intercepted from the application
%prep
%setup -q -n haproxy-%{version}
%build
regparm_opts=
%ifarch %ix86 x86_64
regparm_opts="USE_REGPARM=1"
%endif
%{__make} %{?_smp_mflags} \
CPU="generic" \
TARGET="linux-glibc" \
USE_LUA=1 \
USE_SLZ=1 \
USE_PCRE2=1 \
USE_PROMEX=1 \
USE_CRYPT_H=1 \
USE_OPENSSL=1 \
USE_SYSTEMD=1 \
USE_GETADDRINFO=1 \
USE_LINUX_TPROXY=1 \
${regparm_opts} \
ADDINC="%{optflags}" \
ADDLIB="%{__global_ldflags}"
%{__make} admin/halog/halog OPTIMIZE="%{optflags} %{build_ldflags}"
pushd admin/iprange
%{__make} all OPTIMIZE="%{optflags} %{build_ldflags}"
popd
%install
%{__make} install-bin DESTDIR=%{buildroot} PREFIX=%{_prefix} TARGET="linux2628"
%{__make} install-man DESTDIR=%{buildroot} PREFIX=%{_prefix}
%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/haproxy.service
%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{haproxy_confdir}/haproxy.cfg
%{__install} -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/haproxy
%{__install} -p -D -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/haproxy
%{__install} -p -D -m 0644 %{SOURCE5} %{buildroot}%{_mandir}/man1/halog.1
%{__install} -d -m 0755 %{buildroot}%{haproxy_homedir}
%{__install} -d -m 0755 %{buildroot}%{haproxy_datadir}
%{__install} -d -m 0755 %{buildroot}%{_bindir}
%{__install} -p -m 0755 ./admin/halog/halog %{buildroot}%{_bindir}/halog
%{__install} -p -m 0755 ./admin/iprange/iprange %{buildroot}%{_bindir}/iprange
%{__install} -p -m 0755 ./admin/iprange/ip6range %{buildroot}%{_bindir}/ip6range
%{__install} -p -m 0644 ./examples/errorfiles/* %{buildroot}%{haproxy_datadir}
for httpfile in $(find ./examples/errorfiles/ -type f)
do
%{__install} -p -m 0644 $httpfile %{buildroot}%{haproxy_datadir}
done
%{__rm} -rf ./examples/errorfiles/
find ./examples/* -type f ! -name "*.cfg" -exec %{__rm} -f "{}" \;
for textfile in $(find ./ -type f -name '*.txt')
do
%{__mv} $textfile $textfile.old
iconv --from-code ISO8859-1 --to-code UTF-8 --output $textfile $textfile.old
%{__rm} -f $textfile.old
done
%pre
getent group %{haproxy_group} >/dev/null || \
groupadd -r %{haproxy_group}
getent passwd %{haproxy_user} >/dev/null || \
useradd -r -g %{haproxy_user} -d %{haproxy_homedir} \
-s /sbin/nologin -c "haproxy" %{haproxy_user}
exit 0
%post
%systemd_post haproxy.service
%preun
%systemd_preun haproxy.service
%postun
%systemd_postun_with_restart haproxy.service
%files
%doc doc/* examples/*
%doc CHANGELOG README ROADMAP VERSION
%license LICENSE
%dir %{haproxy_homedir}
%dir %{haproxy_confdir}
%dir %{haproxy_datadir}
%{haproxy_datadir}/*
%config(noreplace) %{haproxy_confdir}/haproxy.cfg
%config(noreplace) %{_sysconfdir}/logrotate.d/haproxy
%config(noreplace) %{_sysconfdir}/sysconfig/haproxy
%{_unitdir}/haproxy.service
%{_sbindir}/haproxy
%{_bindir}/halog
%{_bindir}/iprange
%{_bindir}/ip6range
%{_mandir}/man1/*
%changelog
* Wed Jun 23 2021 Christian Boenning <christian@boenning.io> - 2.4.1-1
- HAProxy 2.4.1
STABLE
Btw 2.6 is now also LTS
2.8 will be LTS Q2 this year
The IUS project has reached it's end of life, and will not be addressing any more wishlist requests.
What new package do you want?
haproxy 2.4
Why?
In haproxy 2.4 was be added many function (LTS Version)
Testing
I agree to test the new package to ensure that it works as expected. Once I am satisfied with the results of my testing I will comment on this issue with the word "STABLE" to get it promoted to the stable repos.