initial import
This commit is contained in:
parent
30d1cf1036
commit
d55870e7f7
@ -0,0 +1 @@
|
|||||||
|
haproxy-1.3.12.2.tar.gz
|
79
haproxy.cfg
Normal file
79
haproxy.cfg
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# this config needs haproxy-1.1.28 or haproxy-1.2.1
|
||||||
|
|
||||||
|
global
|
||||||
|
log 127.0.0.1 local0
|
||||||
|
log 127.0.0.1 local1 notice
|
||||||
|
#log loghost local0 info
|
||||||
|
maxconn 4096
|
||||||
|
chroot /var/lib/haproxy
|
||||||
|
user haproxy
|
||||||
|
group haproxy
|
||||||
|
daemon
|
||||||
|
#debug
|
||||||
|
#quiet
|
||||||
|
|
||||||
|
defaults
|
||||||
|
log global
|
||||||
|
mode http
|
||||||
|
option httplog
|
||||||
|
option dontlognull
|
||||||
|
retries 3
|
||||||
|
redispatch
|
||||||
|
maxconn 2000
|
||||||
|
contimeout 5000
|
||||||
|
clitimeout 50000
|
||||||
|
srvtimeout 50000
|
||||||
|
|
||||||
|
listen appli1-rewrite 0.0.0.0:10001
|
||||||
|
cookie SERVERID rewrite
|
||||||
|
balance roundrobin
|
||||||
|
server app1_1 192.168.34.23:8080 cookie app1inst1 check inter 2000 rise 2 fall 5
|
||||||
|
server app1_2 192.168.34.32:8080 cookie app1inst2 check inter 2000 rise 2 fall 5
|
||||||
|
server app1_3 192.168.34.27:8080 cookie app1inst3 check inter 2000 rise 2 fall 5
|
||||||
|
server app1_4 192.168.34.42:8080 cookie app1inst4 check inter 2000 rise 2 fall 5
|
||||||
|
|
||||||
|
listen appli2-insert 0.0.0.0:10002
|
||||||
|
option httpchk
|
||||||
|
balance roundrobin
|
||||||
|
cookie SERVERID insert indirect nocache
|
||||||
|
server inst1 192.168.114.56:80 cookie server01 check inter 2000 fall 3
|
||||||
|
server inst2 192.168.114.56:81 cookie server02 check inter 2000 fall 3
|
||||||
|
capture cookie vgnvisitor= len 32
|
||||||
|
|
||||||
|
option httpclose # disable keep-alive
|
||||||
|
rspidel ^Set-cookie:\ IP= # do not let this cookie tell our internal IP address
|
||||||
|
|
||||||
|
listen appli3-relais 0.0.0.0:10003
|
||||||
|
dispatch 192.168.135.17:80
|
||||||
|
|
||||||
|
listen appli4-backup 0.0.0.0:10004
|
||||||
|
option httpchk /index.html
|
||||||
|
option persist
|
||||||
|
balance roundrobin
|
||||||
|
server inst1 192.168.114.56:80 check inter 2000 fall 3
|
||||||
|
server inst2 192.168.114.56:81 check inter 2000 fall 3 backup
|
||||||
|
|
||||||
|
listen ssl-relay 0.0.0.0:8443
|
||||||
|
option ssl-hello-chk
|
||||||
|
balance source
|
||||||
|
server inst1 192.168.110.56:443 check inter 2000 fall 3
|
||||||
|
server inst2 192.168.110.57:443 check inter 2000 fall 3
|
||||||
|
server back1 192.168.120.58:443 backup
|
||||||
|
|
||||||
|
listen appli5-backup 0.0.0.0:10005
|
||||||
|
option httpchk *
|
||||||
|
balance roundrobin
|
||||||
|
cookie SERVERID insert indirect nocache
|
||||||
|
server inst1 192.168.114.56:80 cookie server01 check inter 2000 fall 3
|
||||||
|
server inst2 192.168.114.56:81 cookie server02 check inter 2000 fall 3
|
||||||
|
server inst3 192.168.114.57:80 backup check inter 2000 fall 3
|
||||||
|
capture cookie ASPSESSION len 32
|
||||||
|
srvtimeout 20000
|
||||||
|
|
||||||
|
option httpclose # disable keep-alive
|
||||||
|
option checkcache # block response if set-cookie & cacheable
|
||||||
|
|
||||||
|
rspidel ^Set-cookie:\ IP= # do not let this cookie tell our internal IP address
|
||||||
|
|
||||||
|
errorloc 502 http://192.168.114.58/error502.html
|
||||||
|
|
109
haproxy.init
Normal file
109
haproxy.init
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# haproxy
|
||||||
|
#
|
||||||
|
# chkconfig: - 85 15
|
||||||
|
# description: HAProxy is a free, very fast and reliable solution \
|
||||||
|
# offering high availability, load balancing, and \
|
||||||
|
# proxying for TCP and HTTP-based applications
|
||||||
|
# processname: haproxy
|
||||||
|
# config: /etc/haproxy/haproxy.cfg
|
||||||
|
# pidfile: /var/run/haproxy.pid
|
||||||
|
|
||||||
|
# Source function library.
|
||||||
|
. /etc/rc.d/init.d/functions
|
||||||
|
|
||||||
|
# Source networking configuration.
|
||||||
|
. /etc/sysconfig/network
|
||||||
|
|
||||||
|
# Check that networking is up.
|
||||||
|
[ "$NETWORKING" = "no" ] && exit 0
|
||||||
|
|
||||||
|
exec="/usr/sbin/haproxy"
|
||||||
|
prog=$(basename $exec)
|
||||||
|
|
||||||
|
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||||
|
|
||||||
|
lockfile=/var/lock/subsys/haproxy
|
||||||
|
|
||||||
|
check() {
|
||||||
|
$exec -c -V -f /etc/$prog/$prog.cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
$exec -c -q -f /etc/$prog/$prog.cfg
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Errors in configuration file, check with $prog check."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n $"Starting $prog: "
|
||||||
|
# start it up here, usually something like "daemon $exec"
|
||||||
|
daemon $exec -D -f /etc/$prog/$prog.cfg -p /var/run/$prog.pid
|
||||||
|
retval=$?
|
||||||
|
echo
|
||||||
|
[ $retval -eq 0 ] && touch $lockfile
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
echo -n $"Stopping $prog: "
|
||||||
|
# stop it here, often "killproc $prog"
|
||||||
|
killproc $prog
|
||||||
|
retval=$?
|
||||||
|
echo
|
||||||
|
[ $retval -eq 0 ] && rm -f $lockfile
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
|
||||||
|
restart() {
|
||||||
|
$exec -c -q -f /etc/$prog/$prog.cfg
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Errors in configuration file, check with $prog check."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
$exec -c -q -f /etc/$prog/$prog.cfg
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Errors in configuration file, check with $prog check."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo -n $"Reloading $prog: "
|
||||||
|
$exec -p /var/run/$prog.pid -sf $(cat /var/run/$prog.pid)
|
||||||
|
retval=$?
|
||||||
|
echo
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
|
||||||
|
force_reload() {
|
||||||
|
restart
|
||||||
|
}
|
||||||
|
|
||||||
|
fdr_status() {
|
||||||
|
status $prog
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start|stop|restart|reload)
|
||||||
|
$1
|
||||||
|
;;
|
||||||
|
force-reload)
|
||||||
|
force_reload
|
||||||
|
;;
|
||||||
|
check)
|
||||||
|
check
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
fdr_status
|
||||||
|
;;
|
||||||
|
condrestart|try-restart)
|
||||||
|
[ ! -f $lockfile ] || restart
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
|
||||||
|
exit 2
|
||||||
|
esac
|
136
haproxy.spec
Normal file
136
haproxy.spec
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
%define haproxy_user haproxy
|
||||||
|
%define haproxy_group %{haproxy_user}
|
||||||
|
%define haproxy_home %{_localstatedir}/lib/haproxy
|
||||||
|
%define haproxy_confdir %{_sysconfdir}/haproxy
|
||||||
|
%define haproxy_datadir %{_datadir}/haproxy
|
||||||
|
|
||||||
|
Name: haproxy
|
||||||
|
Version: 1.3.12.2
|
||||||
|
Release: 2%{?dist}
|
||||||
|
Summary: HA-Proxy is a TCP/HTTP reverse proxy for high availability environments
|
||||||
|
|
||||||
|
Group: System Environment/Daemons
|
||||||
|
License: GPLv2+ and MIT
|
||||||
|
|
||||||
|
URL: http://haproxy.1wt.eu/
|
||||||
|
Source0: http://haproxy.1wt.eu/download/1.3/src/haproxy-%{version}.tar.gz
|
||||||
|
Source1: %{name}.init
|
||||||
|
Source2: %{name}.cfg
|
||||||
|
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
BuildRequires: pcre-devel
|
||||||
|
|
||||||
|
|
||||||
|
Requires(pre): %{_sbindir}/useradd
|
||||||
|
Requires(post): /sbin/chkconfig
|
||||||
|
Requires(preun): /sbin/chkconfig, /sbin/service
|
||||||
|
Requires(postun): /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
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q
|
||||||
|
|
||||||
|
%build
|
||||||
|
# No configure script is present, it is all done via make flags
|
||||||
|
# FC 7 is linux 2.6 so using linux26 as target.
|
||||||
|
make %{?_smp_mflags} CPU="generic" TARGET="linux26" REGEX="pcre" ADDINC="%{optflags}"
|
||||||
|
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf %{buildroot}
|
||||||
|
# there is no install make target, only one file is created during build
|
||||||
|
%{__install} -p -D -m 0755 %{name} %{buildroot}%{_sbindir}/%{name}
|
||||||
|
%{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name}
|
||||||
|
%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{haproxy_confdir}/%{name}.cfg
|
||||||
|
%{__install} -d -m 0755 %{buildroot}%{haproxy_home}
|
||||||
|
%{__install} -d -m 0755 %{buildroot}%{haproxy_datadir}
|
||||||
|
for httpfile in $(find ./examples/errorfiles/ -type f)
|
||||||
|
do
|
||||||
|
%{__install} -p -m 0644 $httpfile %{buildroot}%{haproxy_datadir}
|
||||||
|
done
|
||||||
|
|
||||||
|
# convert all text files to utf8
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
%clean
|
||||||
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
|
|
||||||
|
%pre
|
||||||
|
%{_sbindir}/useradd -c "HAProxy user" -s /bin/false -r -d %{haproxy_home} %{haproxy_user} 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
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%doc doc/*
|
||||||
|
%doc examples/url-switching.cfg
|
||||||
|
%doc examples/acl-content-sw.cfg
|
||||||
|
%doc examples/content-sw-sample.cfg
|
||||||
|
%doc examples/cttproxy-src.cfg
|
||||||
|
%doc examples/haproxy.cfg
|
||||||
|
%doc examples/tarpit.cfg
|
||||||
|
%doc examples/tcp-splicing-sample.cfg
|
||||||
|
%doc CHANGELOG CONTRIB LICENSE README
|
||||||
|
%dir %{haproxy_datadir}
|
||||||
|
%dir %{haproxy_datadir}/*
|
||||||
|
%dir %{haproxy_confdir}
|
||||||
|
%config(noreplace) %{haproxy_confdir}/%{name}.cfg
|
||||||
|
%{_initrddir}/%{name}
|
||||||
|
%{_sbindir}/%{name}
|
||||||
|
%attr(-,%{haproxy_user},%{haproxy_group}) %dir %{haproxy_home}
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Thu Sep 20 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.3.12.2-2
|
||||||
|
- update License field
|
||||||
|
|
||||||
|
* Thu Sep 20 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.3.12.2-1
|
||||||
|
- update to 1.3.12.2
|
||||||
|
- remove the upstream patch
|
||||||
|
|
||||||
|
* Tue Sep 18 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.3.12.1-1
|
||||||
|
- switch to 1.3.12.1 branch
|
||||||
|
- add patch from upstream with O'Reilly licensing updates.
|
||||||
|
- convert ISO-8859-1 doc files to UTF-8
|
||||||
|
|
||||||
|
* Sat Mar 24 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.2.17-2
|
||||||
|
- addition of haproxy user
|
||||||
|
- add license information
|
||||||
|
|
||||||
|
* Fri Mar 23 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.2.17-1
|
||||||
|
- initial packaging
|
Loading…
Reference in New Issue
Block a user