import from src.rpm

This commit is contained in:
Алексей Шабалин 2015-08-21 19:38:51 +03:00
parent 34d7ed33fa
commit b238ade122
3 changed files with 339 additions and 0 deletions

79
haproxy.cfg Normal file
View File

@ -0,0 +1,79 @@
# this config needs haproxy-1.1.23
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
chroot /usr/share/haproxy
uid 99
gid 99
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
View File

@ -0,0 +1,109 @@
#!/bin/sh
#
# haproxy TCP/HTTP reverse proxy for high availability environments
#
# chkconfig: - 85 15
# description: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited \
# for high availability environments.
# processname: haproxy
# config: /etc/haproxy/haproxy.conf
# pidfile: /var/run/haproxy.pid
### BEGIN INIT INFO
# Provides: haproxy
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start:
# Default-Stop:
# Short-Description: fast and reliable load balancing reverse proxy
# Description: This file should be used to start and stop haproxy.
### END INIT INFO
# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1
# Source function library.
. /etc/init.d/functions
NAME=haproxy
PIDFILE=/var/run/${NAME}.pid
CONFIG=/etc/${NAME}/${NAME}.cfg
LOCKFILE=/var/lock/subsys/${NAME}
BINARY=/usr/sbin/${NAME}
RETVAL=0
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -f $CONFIG ] || exit 1
start()
{
start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user nobody -- $BINARY \
-D -f ${CONFIG} -p ${PIDFILE}
RETVAL=$?
return $RETVAL
}
stop()
{
stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user nobody -- $BINARY
RETVAL=$?
return $RETVAL
}
restart()
{
stop
start
}
reload()
{
msg_reloading $NAME
$BINARY -p "$PIDFILE" -f $CONFIG -sf `cat $PIDFILE`
RETVAL=$?
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
condstop)
if [ -e "$LOCKFILE" ]; then
stop
fi
;;
condrestart)
if [ -e "$LOCKFILE" ]; then
restart
fi
;;
condreload)
if [ -e "$LOCKFILE" ]; then
reload
fi
;;
status)
status --pidfile "$PIDFILE" --expect-user nobody -- haproxy
RETVAL=$?
;;
*)
msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
RETVAL=1
esac
exit $RETVAL

151
haproxy.spec Normal file
View File

@ -0,0 +1,151 @@
Name: haproxy
Version: 1.4.20
Release: alt1
Summary: HA-Proxy is a TCP/HTTP reverse proxy for high availability environments
License: GPLv2+
Group: System/Servers
URL: http://haproxy.1wt.eu/
Source0: http://haproxy.1wt.eu/download/1.4/src/%name-%version.tar.gz
Source1: haproxy.cfg
Source2: haproxy.init
# Automatically added by buildreq on Wed Mar 23 2011
BuildRequires: libpcre-devel
%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
%build
# Recommended optimization option for x86 builds
regparm_opts=
%ifarch %ix86 x86_64
regparm_opts="USE_REGPARM=1"
%endif
%make TARGET=linux26 USE_PCRE=1 USE_LINUX_TPROXY=1 USE_LINUX_SPLICE=1 \
${regparm_opts} "ADDINC=$(pcre-config --cflags)" "CFLAGS=%optflags"
# Build the contrib halog program. Build correct version (halog or halog64)
# and make sure it always installed as halog.
halog="halog"
%if "%_lib" == "lib64"
halog="halog64"
%endif
pushd contrib/halog
%make $halog
%if "%_lib" == "lib64"
mv $halog halog
%endif
popd
%install
%make_install install DESTDIR=%buildroot PREFIX=/usr
install -d -m0755 %buildroot%_datadir/haproxy/
cp -p examples/errorfiles/* %buildroot%_datadir/haproxy/
install -D -m0644 %SOURCE1 %buildroot%_sysconfdir/haproxy/haproxy.cfg
install -D -m0755 %SOURCE2 %buildroot%_initrddir/haproxy
install -D -m0755 contrib/halog/halog %buildroot%_bindir/halog
%post
%post_service haproxy
%preun
%preun_service haproxy
%files
%doc CHANGELOG LICENSE doc/architecture.txt doc/configuration.txt
%config(noreplace) %_sysconfdir/haproxy/
%config %_initrddir/haproxy
%_sbindir/haproxy
%_datadir/haproxy
%_bindir/halog
%_man1dir/*
%exclude /usr/doc
%changelog
* Fri Mar 16 2012 Victor Forsiuk <force@altlinux.org> 1.4.20-alt1
- 1.4.20
* Sun Jan 08 2012 Victor Forsiuk <force@altlinux.org> 1.4.19-alt1
- 1.4.19
* Sat Nov 26 2011 Victor Forsiuk <force@altlinux.org> 1.4.18-alt1
- 1.4.18
* Sat Aug 13 2011 Victor Forsiuk <force@altlinux.org> 1.4.16-alt1
- 1.4.16
* Sat Apr 09 2011 Victor Forsiuk <force@altlinux.org> 1.4.15-alt1
- 1.4.15
* Tue Mar 29 2011 Victor Forsiuk <force@altlinux.org> 1.4.14-alt1
- 1.4.14
* Wed Mar 23 2011 Victor Forsiuk <force@altlinux.org> 1.4.13-alt1
- 1.4.13
- Build halog (log statistics reporter).
- Enable transparent proxy and splice(2).
* Fri Feb 11 2011 Victor Forsiuk <force@altlinux.org> 1.4.11-alt1
- 1.4.11
* Tue Dec 07 2010 Victor Forsiuk <force@altlinux.org> 1.4.10-alt2
- Fix expected user in init-script (Closes: #24570).
* Mon Dec 06 2010 Victor Forsiuk <force@altlinux.org> 1.4.10-alt1
- 1.4.10
* Sat Nov 06 2010 Victor Forsiuk <force@altlinux.org> 1.4.9-alt1
- 1.4.9
* Thu Jun 17 2010 Victor Forsiuk <force@altlinux.org> 1.4.8-alt1
- 1.4.8
* Wed Jun 09 2010 Victor Forsiuk <force@altlinux.org> 1.4.6-alt1
- 1.4.6
* Thu Apr 08 2010 Victor Forsiuk <force@altlinux.org> 1.4.4-alt1
- 1.4.4
* Tue Apr 06 2010 Victor Forsiuk <force@altlinux.org> 1.4.3-alt1
- 1.4.3
* Thu Mar 18 2010 Victor Forsiuk <force@altlinux.org> 1.4.2-alt1
- 1.4.2
* Tue Mar 09 2010 Victor Forsiuk <force@altlinux.org> 1.4.1-alt1
- 1.4.1
* Mon Mar 01 2010 Victor Forsiuk <force@altlinux.org> 1.4.0-alt1
- 1.4.0
* Tue Feb 16 2010 Victor Forsiuk <force@altlinux.org> 1.3.23-alt1
- 1.3.23
* Fri Oct 03 2008 Sergey Ivanov <seriv@altlinux.ru> 1.3.15.4-alt1
- Release 1.3.15.4
* Tue Jul 03 2007 Sergey Ivanov <seriv@altlinux.ru> 1.3.12-alt1
- Initial build using release 1.3.12 for Sisyphus