HAProxy is a high-performance and highly-robust TCP/HTTP load balancer

which provides cookie-based persistence, automatic failover, header 
insertion, deletion, modification on the fly, advanced logging contents 
to help troubleshoot buggy applications and/or networks, and a few other 
features.  It uses its own state machine to achieve up to ten thousands 
hits per second on modern hardware, even with thousands of simultaneous
connections.

feedback from merdely@, okan@, wcmaier@
ok merdely@ and pval@
This commit is contained in:
jdixon 2008-07-17 04:31:45 +00:00
parent ff9d8cf194
commit ab7aa0f428
8 changed files with 232 additions and 0 deletions

58
net/haproxy/Makefile Normal file
View File

@ -0,0 +1,58 @@
# $OpenBSD: Makefile,v 1.1.1.1 2008/07/17 04:31:45 jdixon Exp $
COMMENT = reliable, high performance TCP/HTTP load balancer
DISTNAME = haproxy-1.3.15.2
CATEGORIES = net www
HOMEPAGE = http://haproxy.1wt.eu/
MAINTAINER = Jason Dixon <jdixon@openbsd.org>
# GPLv2
PERMIT_PACKAGE_CDROM = Yes
PERMIT_PACKAGE_FTP = Yes
PERMIT_DISTFILES_CDROM = Yes
PERMIT_DISTFILES_FTP = Yes
WANTLIB = c
MASTER_SITES = ${HOMEPAGE}/download/1.3/src/
HAPROXYCONF = ${SYSCONFDIR}/haproxy
HAPROXYSTATE = /var/haproxy
HAPROXYUID = 604
HAPROXYGID = 604
SUBST_VARS = TRUEPREFIX HAPROXYCONF HAPROXYSTATE \
HAPROXYUID HAPROXYGID
MAKE_FILE = Makefile.bsd
MAKE_FLAGS += CC="${CC}" LD="${CC}"
NO_REGRESS = Yes
LIB_DEPENDS = pcre,pcreposix::devel/pcre
DOCS = architecture configuration gpl haproxy-en haproxy-fr lgpl
EXAMPLES = acl-content-sw content-sw-sample haproxy \
option-http_proxy tarpit url-switching
DOCSDIR = ${PREFIX}/share/doc/haproxy
EXAMPLESDIR = ${PREFIX}/share/examples/haproxy
pre-install:
${SUBST_CMD} ${WRKSRC}/doc/haproxy.1 ${WRKSRC}/examples/haproxy.cfg
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/haproxy ${PREFIX}/sbin
${INSTALL_MAN} ${WRKSRC}/doc/haproxy.1 ${PREFIX}/man/man1/haproxy.1
${INSTALL_DATA_DIR} ${DOCSDIR}
.for file in ${DOCS}
${INSTALL_DATA} ${WRKSRC}/doc/${file}.txt ${DOCSDIR}
.endfor
${INSTALL_DATA_DIR} ${EXAMPLESDIR}
.for file in ${EXAMPLES}
${INSTALL_DATA} ${WRKSRC}/examples/${file}.cfg ${EXAMPLESDIR}
.endfor
.include <bsd.port.mk>

5
net/haproxy/distinfo Normal file
View File

@ -0,0 +1,5 @@
MD5 (haproxy-1.3.15.2.tar.gz) = pk1/WnRk52n4Z2gCvo6PNg==
RMD160 (haproxy-1.3.15.2.tar.gz) = YHMIoB0/Y/d6x65m00Krml6Ikn8=
SHA1 (haproxy-1.3.15.2.tar.gz) = LRPN8fhog+eFcffPI4qb+MAupC8=
SHA256 (haproxy-1.3.15.2.tar.gz) = YgK8PuWbtVe+WsgMfKQrOUnaBL0plx4395HSdxwOQmQ=
SIZE (haproxy-1.3.15.2.tar.gz) = 501219

View File

@ -0,0 +1,55 @@
$OpenBSD: patch-Makefile_bsd,v 1.1.1.1 2008/07/17 04:31:45 jdixon Exp $
--- Makefile.bsd.orig Sat Jun 21 15:59:05 2008
+++ Makefile.bsd Tue Jul 15 12:51:26 2008
@@ -19,13 +19,13 @@ CPU = generic
# By default, we use libc's regex. WARNING! On Solaris 8/Sparc, group
# references seem broken using libc ! Use pcre instead.
-REGEX=libc
+#REGEX=libc
#REGEX=pcre
-#REGEX=static-pcre
+REGEX=static-pcre
# tools options
-CC = gcc
-LD = gcc
+CC ?= gcc
+LD ?= gcc
# This is the directory hosting include/pcre.h and lib/libpcre.* when REGEX=pcre
PCREDIR!= pcre-config --prefix 2>/dev/null || :
@@ -36,7 +36,7 @@ COPTS.openbsd = -DENABLE_POLL -DENABLE_KQUEUE
LIBS.openbsd =
# CPU dependant optimizations
-COPTS.generic = -O2
+#COPTS.generic = -O2
COPTS.i586 = -O2 -march=i586
COPTS.i686 = -O2 -march=i686
COPTS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
@@ -51,11 +51,11 @@ LIBS.pcre=-L$(PCREDIR)/lib -lpcreposix -lpcre
# options for static libpcre
COPTS.static-pcre=-DUSE_PCRE -I$(PCREDIR)/include
-LIBS.static-pcre=-L$(PCREDIR)/lib -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic
+LIBS.static-pcre=-L$(PCREDIR)/lib -Bstatic -lpcreposix -lpcre -Bdynamic
# you can enable debug arguments with "DEBUG=-g" or disable them with "DEBUG="
#DEBUG = -g -DDEBUG_MEMORY -DDEBUG_FULL
-DEBUG = -g
+#DEBUG = -g
# if small memory footprint is required, you can reduce the buffer size. There
# are 2 buffers per concurrent session, so 16 kB buffers will eat 32 MB memory
@@ -95,8 +95,8 @@ VER_OPTS := -DCONFIG_HAPROXY_VERSION=\"$(VERSION)$(SUB
COPTS = -Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) \
$(SMALL_OPTS) $(VER_OPTS) $(DEFINE)
LIBS = $(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
-CFLAGS = -Wall $(COPTS) $(DEBUG)
-LDFLAGS = -g
+CFLAGS += -Wall $(COPTS) $(DEBUG)
+#LDFLAGS = -g
OBJS = src/haproxy.o src/sessionhash.o src/base64.o src/protocols.o \
src/uri_auth.o src/standard.o src/buffers.o src/log.o src/task.o \

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-doc_haproxy_1,v 1.1.1.1 2008/07/17 04:31:45 jdixon Exp $
--- doc/haproxy.1.orig Sat Jun 21 15:59:05 2008
+++ doc/haproxy.1 Sun Jul 13 01:17:14 2008
@@ -164,9 +164,7 @@ This signal is intercepted and ignored on systems with
.SH SEE ALSO
-A much better documentation can be found in haproxy-en.txt. On debian
-systems, you can find this file in
-/usr/share/doc/haproxy/haproxy-en.txt.gz.
+More complete documentation can be found in ${PREFIX}/share/doc/haproxy/haproxy-en.txt.
.SH AUTHOR

View File

@ -0,0 +1,63 @@
$OpenBSD: patch-examples_haproxy_cfg,v 1.1.1.1 2008/07/17 04:31:45 jdixon Exp $
--- examples/haproxy.cfg.orig Sat Jun 21 15:59:05 2008
+++ examples/haproxy.cfg Sun Jul 13 20:13:01 2008
@@ -1,28 +1,30 @@
-# 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 /usr/share/haproxy
- uid 99
- gid 99
+ maxconn 1024
+ chroot ${HAPROXYSTATE}
+ uid ${HAPROXYUID}
+ gid ${HAPROXYGID}
daemon
#debug
#quiet
+ pidfile /var/run/haproxy.pid
defaults
log global
mode http
option httplog
option dontlognull
+ option redispatch
retries 3
- redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
+ stats enable
+ stats auth admin:mekmitasdigoat
listen appli1-rewrite 0.0.0.0:10001
cookie SERVERID rewrite
@@ -59,22 +61,4 @@ listen ssl-relay 0.0.0.0:8443
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
- errorfile 503 /etc/haproxy/errors/503.http

6
net/haproxy/pkg/DESCR Normal file
View File

@ -0,0 +1,6 @@
HAProxy is a high-performance and highly-robust TCP/HTTP load balancer which
provides cookie-based persistence, automatic failover, header insertion,
deletion, modification on the fly, advanced logging contents to help trouble-
shoot buggy applications and/or networks, and a few other features. It uses
its own state machine to achieve up to ten thousands hits per second on modern
hardware, even with thousands of simultaneous connections.

9
net/haproxy/pkg/MESSAGE Normal file
View File

@ -0,0 +1,9 @@
A sample config file for HAProxy has been installed in
${HAPROXYCONF}, edit it to your site's needs.
To start, add the following to /etc/rc.local:
if [ -x ${PREFIX}/sbin/haproxy ]; then
${PREFIX}/sbin/haproxy -f ${HAPROXYCONF}/haproxy.cfg
echo -n ' haproxy'
fi

22
net/haproxy/pkg/PLIST Normal file
View File

@ -0,0 +1,22 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2008/07/17 04:31:45 jdixon Exp $
@newgroup _haproxy:${HAPROXYUID}
@newuser _haproxy:${HAPROXYGID}:_haproxy:daemon:HAProxy Daemon:/var/haproxy:/sbin/nologin
@man man/man1/haproxy.1
@bin sbin/haproxy
@sample ${HAPROXYCONF}/
@sample ${HAPROXYSTATE}/
share/doc/haproxy/
share/doc/haproxy/architecture.txt
share/doc/haproxy/configuration.txt
share/doc/haproxy/gpl.txt
share/doc/haproxy/haproxy-en.txt
share/doc/haproxy/haproxy-fr.txt
share/doc/haproxy/lgpl.txt
share/examples/haproxy/
share/examples/haproxy/acl-content-sw.cfg
share/examples/haproxy/content-sw-sample.cfg
share/examples/haproxy/haproxy.cfg
@sample ${HAPROXYCONF}/haproxy.cfg
share/examples/haproxy/option-http_proxy.cfg
share/examples/haproxy/tarpit.cfg
share/examples/haproxy/url-switching.cfg