Skip to content

Instantly share code, notes, and snippets.

@uorat
Created May 29, 2016 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uorat/07ce41773e944bc4f3d3e1916fcba487 to your computer and use it in GitHub Desktop.
Save uorat/07ce41773e944bc4f3d3e1916fcba487 to your computer and use it in GitHub Desktop.
HAProxy SPEC file for v1.6.4
Summary: HA-Proxy is a TCP/HTTP reverse proxy for high availability environments
Name: haproxy
Version: 1.6.4
Release: 1
License: GPL
Group: System Environment/Daemons
URL: http://haproxy.1wt.eu/
Source0: http://haproxy.1wt.eu/download/1.5/src/devel/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: pcre-devel openssl-devel
Requires: /sbin/chkconfig, /sbin/service
%description
HA-Proxy 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 the 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/delete HTTP headers both ways
- block requests matching a particular pattern
It needs very little resource. Its event-driven architecture allows it to easily
handle thousands of simultaneous connections on hundreds of instances without
risking the system's stability.
%prep
%setup -q
# We don't want any perl dependecies in this RPM:
%define __perl_requires /bin/true
%build
%{__make} USE_PCRE=1 DEBUG="" ARCH=%{_target_cpu} TARGET=linux26 USE_OPENSSL=1
%install
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%{__install} -d %{buildroot}%{_sbindir}
%{__install} -d %{buildroot}%{_sysconfdir}/rc.d/init.d
%{__install} -d %{buildroot}%{_sysconfdir}/%{name}
%{__install} -d %{buildroot}%{_mandir}/man1/
mkdir -p %{buildroot}/usr/share/haproxy
mkdir -p %{buildroot}/var/lib/haproxy
cp examples/errorfiles/400.http %{buildroot}/usr/share/haproxy/400.http
cp examples/errorfiles/403.http %{buildroot}/usr/share/haproxy/403.http
cp examples/errorfiles/408.http %{buildroot}/usr/share/haproxy/408.http
cp examples/errorfiles/500.http %{buildroot}/usr/share/haproxy/500.http
cp examples/errorfiles/502.http %{buildroot}/usr/share/haproxy/502.http
cp examples/errorfiles/503.http %{buildroot}/usr/share/haproxy/503.http
cp examples/errorfiles/504.http %{buildroot}/usr/share/haproxy/504.http
cp examples/errorfiles/README %{buildroot}/usr/share/haproxy/README
mkdir -p %{buildroot}/etc/logrotate.d/
mkdir -p %{buildroot}/etc/sysconfig/
%{__install} -s %{name} %{buildroot}%{_sbindir}/
%{__install} -c -m 644 examples/acl-content-sw.cfg %{buildroot}%{_sysconfdir}/%{name}/%{name}-acl-content-sw.cfg.example
%{__install} -c -m 644 examples/auth.cfg %{buildroot}%{_sysconfdir}/%{name}/%{name}-auth.cfg.example
%{__install} -c -m 644 examples/content-sw-sample.cfg %{buildroot}%{_sysconfdir}/%{name}/%{name}-content-sw-sample.cfg.example
%{__install} -c -m 644 examples/option-http_proxy.cfg %{buildroot}%{_sysconfdir}/%{name}/%{name}-option-http_proxy.cfg.example
%{__install} -c -m 644 examples/ssl.cfg %{buildroot}%{_sysconfdir}/%{name}/%{name}-ssl.cfg.example
%{__install} -c -m 644 examples/transparent_proxy.cfg %{buildroot}%{_sysconfdir}/%{name}/%{name}-transparent_proxy.cfg.example
%{__install} -c -m 644 examples/%{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}
%{__install} -c -m 755 examples/%{name}.init %{buildroot}%{_sysconfdir}/rc.d/init.d/%{name}
%{__install} -c -m 755 examples/%{name}.logrotated %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%{__install} -c -m 755 doc/%{name}.1 %{buildroot}%{_mandir}/man1/
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%pre
/usr/sbin/groupadd -g 188 -r haproxy 2>/dev/null || :
/usr/sbin/useradd -u 188 -g haproxy -d /var/lib/haproxy -s /sbin/nologin -r haproxy 2>/dev/null || :
%post
/sbin/chkconfig --add %{name}
%preun
if [ $1 = 0 ]; then
/sbin/service %{name} stop >/dev/null 2>&1 || :
/sbin/chkconfig --del %{name}
fi
%postun
if [ "$1" -ge "1" ]; then
/sbin/service %{name} condrestart >/dev/null 2>&1 || :
fi
%files
/usr/share/haproxy
%defattr(-,root,root)
%doc CHANGELOG examples/*.cfg README doc/architecture.txt doc/configuration.txt doc/intro.txt doc/management.txt doc/proxy-protocol.txt
%doc %{_mandir}/man1/%{name}.1*
%attr(0755,root,root) %{_sbindir}/%{name}
%dir %{_sysconfdir}/%{name}
%attr(0644,root,root) %{_sysconfdir}/%{name}/*.cfg.example
%attr(0755,root,root) %config %{_sysconfdir}/rc.d/init.d/%{name}
%attr(0644,root,root) %config %{_sysconfdir}/sysconfig/%{name}
%attr(0644,root,root) %{_sysconfdir}/logrotate.d/%{name}
%attr(0755,haproxy,haproxy) %{_sharedstatedir}/haproxy
%changelog
* Tue Apr 26 2016 Taro Hirose <uorat1616@gmail.com>
- initial build @1.6.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment