testing/haproxy: fork from main/haproxy and upgrade to 1.5-dev12

Development version with full, native support for SSL!
This commit is contained in:
Timo Teräs 2012-09-11 11:01:31 +03:00
parent 22f952fbfc
commit d8055a1c37
5 changed files with 199 additions and 0 deletions

35
testing/haproxy/APKBUILD Normal file
View File

@ -0,0 +1,35 @@
# Contributor: Jeff Bilyk <jbilyk@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=haproxy
pkgver=1.5_alpha12
_pkgver=${pkgver/_alpha/-dev}
pkgrel=0
pkgdesc="A TCP/HTTP reverse proxy for high availability environments"
url="http://haproxy.1wt.eu"
arch="all"
license="GPL"
depends=""
makedepends="pcre-dev openssl-dev"
install="haproxy.pre-install haproxy.pre-upgrade"
subpackages="$pkgname-doc"
source="http://haproxy.1wt.eu/download/${pkgver#*.*}/src/devel/$pkgname-$_pkgver.tar.gz
haproxy.initd
haproxy.cfg"
build() {
cd "$srcdir/$pkgname-$_pkgver"
make TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 CFLAGS="$CFLAGS" || return 1
}
package() {
cd "$srcdir/$pkgname-$_pkgver"
make DESTDIR="$pkgdir" PREFIX=/usr DOCDIR=/usr/share/doc/haproxy \
install
install -d "$pkgdir"/var/lib/haproxy
install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
install -m644 -D "$srcdir"/haproxy.cfg "$pkgdir"/etc/haproxy/haproxy.cfg
}
md5sums="8aafd9e787033f3073b1293484078398 haproxy-1.5-dev12.tar.gz
81319456a35408bf47443e9c314d2e94 haproxy.initd
463f00b30bfb002750d5c5549382365f haproxy.cfg"

View File

@ -0,0 +1,86 @@
#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# http://haproxy.1wt.eu/download/1.5/doc/configuration.txt
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
# to have these messages end up in /var/log/haproxy.log you will
# need to:
#
# 1) configure syslog to accept network log events. This is done
# by adding the '-r' option to the SYSLOGD_OPTIONS in
# /etc/sysconfig/syslog
#
# 2) configure local2 events to go to the /var/log/haproxy.log
# file. A line like the following can be added to
# /etc/sysconfig/syslog
#
# local2.* /var/log/haproxy.log
#
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
# turn on stats unix socket
stats socket /var/lib/haproxy/stats
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend main *:5000
acl url_static path_beg -i /static /images /javascript /stylesheets
acl url_static path_end -i .jpg .gif .png .css .js
use_backend static if url_static
default_backend app
#---------------------------------------------------------------------
# static backend for serving up images, stylesheets and such
#---------------------------------------------------------------------
backend static
balance roundrobin
server static 127.0.0.1:4331 check
#---------------------------------------------------------------------
# round robin balancing between the various backends
#---------------------------------------------------------------------
backend app
balance roundrobin
server app1 127.0.0.1:5001 check
server app2 127.0.0.1:5002 check
server app3 127.0.0.1:5003 check
server app4 127.0.0.1:5004 check

View File

@ -0,0 +1,54 @@
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-proxy/haproxy/files/haproxy.initd-r1,v 1.2 2011/12/04 10:32:32 swegener Exp $
extra_commands="checkconfig"
extra_started_commands="reload"
command=/usr/sbin/haproxy
CONFFILE=${HAPROXY_CONF:-/etc/haproxy/${SVCNAME}.cfg}
PIDFILE=/var/run/${SVCNAME}.pid
depend() {
need net
after firewall
use dns logger
}
checkconfig() {
if [ ! -f "${CONFFILE}" ]; then
eerror "${CONFFILE} does not exist!"
return 1
fi
ebegin "Checking ${CONFFILE}"
$command -q -c -f "${CONFFILE}"
eend $?
}
start() {
ebegin "Starting ${SVCNAME}"
start-stop-daemon --pidfile "${PIDFILE}" --exec $command \
--start -- -D -p "${PIDFILE}" -f "${CONFFILE}"
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
if [ "${RC_CMD}" = "restart" ]; then
checkconfig || return 1
fi
start-stop-daemon --stop --pidfile "${PIDFILE}"
eend $?
}
reload() {
ebegin "Reloading ${SVCNAME}"
checkconfig || { eerror "Reloading failed, please fix your ${CONFFILE} first"; return 1; }
$command -D -p "${PIDFILE}" -f "${CONFFILE}" -sf $(cat "${PIDFILE}")
eend $?
}

View File

@ -0,0 +1,12 @@
#!/bin/sh
addgroup haproxy 2>/dev/null
adduser -S -H -h /var/lib/haproxy -s /bin/false -D \
-G haproxy haproxy 2>/dev/null
# move config to new location
if [ -e /etc/haproxy.cfg ] && ! [ -e /etc/haproxy/haproxy.cfg ]; then
mkdir -p /etc/haproxy
mv /etc/haproxy.cfg /etc/haproxy/haproxy.cfg
fi

View File

@ -0,0 +1,12 @@
#!/bin/sh
addgroup haproxy 2>/dev/null
adduser -S -H -h /var/lib/haproxy -s /bin/false -D \
-G haproxy haproxy 2>/dev/null
# move config to new location
if [ -e /etc/haproxy.cfg ] && ! [ -e /etc/haproxy/haproxy.cfg ]; then
mkdir -p /etc/haproxy
mv /etc/haproxy.cfg /etc/haproxy/haproxy.cfg
fi