summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Jacquin <bertrand@jacquin.bzh>2016-09-17 20:35:37 +0100
committerBertrand Jacquin <bertrand@jacquin.bzh>2016-09-18 22:17:27 +0100
commit4b342ae0c0aa9298814eea8dea8b2c94e02434a9 (patch)
tree68991a139931d48e117711d1294f3fc6d7a94835
parentsys-libs/libslz: stateless, zlib-compatible, and very fast compression library (diff)
downloadportage-4b342ae0c0aa9298814eea8dea8b2c94e02434a9.tar.xz
net-proxy/haproxy: Add dev4 ebuild, Introduce USE=libslz
Package-Manager: portage-2.2.28
-rw-r--r--net-proxy/haproxy/Manifest5
-rw-r--r--net-proxy/haproxy/files/haproxy.confd14
-rw-r--r--net-proxy/haproxy/files/haproxy.initd-r375
-rw-r--r--net-proxy/haproxy/haproxy-1.7_beta4.ebuild150
-rw-r--r--net-proxy/haproxy/metadata.xml26
-rw-r--r--profiles/use.local.desc3
6 files changed, 273 insertions, 0 deletions
diff --git a/net-proxy/haproxy/Manifest b/net-proxy/haproxy/Manifest
new file mode 100644
index 00000000..1b63b66d
--- /dev/null
+++ b/net-proxy/haproxy/Manifest
@@ -0,0 +1,5 @@
+AUX haproxy.confd 622 SHA256 ce3063b75e15246c30e5fca82d510fe0770f2e476739a18d47c91c467584ce30 WHIRLPOOL c4accbf3ec8329e67284342ac276e7d45745a34821113b69f48bd700ffb92f20d77726156f2fde16a33ba00ffd3f91bb68c42b2bdd94d2a916e4c0514ca7c3d5
+AUX haproxy.initd-r3 1542 SHA256 2af2f481ea9da31d0c18da08d6b76a84b7b11ecf1df046245263afe19a5d42e9 WHIRLPOOL 1a3746ce7ff3d4b209202a8780885d68b056fd890de2b43f9706a361a54acd756b32b122f4886fd2b50249b3acadb80a02761c59dc215508b03575206ed4edac
+DIST haproxy-1.7-dev4.tar.gz 1653326 SHA256 23a27d414a27cc56398b3ffc937eed7fd1ac4a36d4648c2c3ec259bcd19751ac WHIRLPOOL 66679fa7ee8c21dc6ad433eafd360fe29998eea5f8b3173a24d92ddfd176a4026fdc714b3c4e04fb6e2656cb3cff9990305444b23fec59ba961dee6fc2cfb443
+EBUILD haproxy-1.7_beta4.ebuild 3752 SHA256 1209871d692770907a32ccab3db907858bc9411f2a88579864b57e452d3e06bc WHIRLPOOL c332983c59d989aafd6235b2a5ff438bd6b323e37b8f95637fae00cb8e43ad1394cb50268ae62c85a8fe4fe004032f81d530fcd520570ea46d5a0b27e1e1e9b5
+MISC metadata.xml 1659 SHA256 a4691aac2f6ddf5a902622c1be998c4660f8cc7316618122dd51e776a279fcf8 WHIRLPOOL b77497249c8e3b5c14068829c0f4b965223a4eb4ad3998fd429aa57586b0a6eb4ed20c75dd9bd7996b1d7761134b97d1bbf18fa70f51874f0ada0e9535ed56e9
diff --git a/net-proxy/haproxy/files/haproxy.confd b/net-proxy/haproxy/files/haproxy.confd
new file mode 100644
index 00000000..5a989a77
--- /dev/null
+++ b/net-proxy/haproxy/files/haproxy.confd
@@ -0,0 +1,14 @@
+# HAProxy config file(s), space separated
+#CONFIGS="/etc/haproxy/haproxy.cfg"
+
+# Additional HAProxy command line options
+HAPROXY_OPTS=""
+
+# If you want to make use ot the new seamless reload you can just write your own
+# reload_seamless function here. It will be called by the init script.
+# For more information on how to use that feature please have a look at the
+# "seamless_reload.txt" documentation file (requires net-proxy/haproxy[examples])
+#reload_seamless() {
+# checkpath -d -m 0700 haproxy:haproxy "/var/run/haproxy/"
+# socat /var/run/haproxy/socket - <<< "show servers state" > /var/run/haproxy/global.state
+#}
diff --git a/net-proxy/haproxy/files/haproxy.initd-r3 b/net-proxy/haproxy/files/haproxy.initd-r3
new file mode 100644
index 00000000..92665cd2
--- /dev/null
+++ b/net-proxy/haproxy/files/haproxy.initd-r3
@@ -0,0 +1,75 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+
+command="/usr/bin/haproxy"
+
+pidfile="${HAPROXY_PIDFILE:-/var/run/${SVCNAME}.pid}"
+
+configs=
+
+if [ -z "${CONFIGS}" ]; then
+ if [ -f "/etc/haproxy/${SVCNAME}.cfg" ]; then
+ CONFIGS=/etc/haproxy/${SVCNAME}.cfg
+ elif [ -f "/etc/${SVCNAME}.cfg" ]; then
+ CONFIGS=/etc/${SVCNAME}.cfg # Deprecated
+ fi
+fi
+
+for conf in $CONFIGS; do
+ configs="${configs} -f ${conf}"
+done
+
+command_args="-D -p ${pidfile} ${configs} ${HAPROXY_OPTS}"
+
+depend() {
+ need net
+ use dns logger
+}
+
+checkconfig() {
+ if [ -z "${CONFIGS}" ]; then
+ eerror "No config(s) has been specified"
+ return 1
+ fi
+
+ for conf in $CONFIGS; do
+ if [ ! -f "${conf}" ]; then
+ eerror "${conf} does not exist!"
+ return 1
+ fi
+ done
+
+ ebegin "Checking ${CONFIGS}"
+ $command -q -c $configs $HAPROXY_OPTS
+ eend $?
+}
+
+start_pre() {
+ if [ "${RC_CMD}" != "restart" ]; then
+ checkconfig || return 1
+ fi
+}
+
+stop_pre() {
+ if [ "${RC_CMD}" = "restart" ]; then
+ checkconfig || return 1
+ fi
+}
+
+reload() {
+ checkconfig || { eerror "Reloading failed, please fix your config(s) first"; return 1; }
+
+ if [ "$(command -v reload_seamless)" = "reload_seamless" ]; then
+ einfo "Calling user-defined reload_seamless()"
+ reload_seamless || { eerror "reload_seamless() failed!"; return 1; }
+ fi
+
+ ebegin "Reloading ${SVCNAME}"
+ $command -D -p "${pidfile}" $configs $HAPROXY_OPTS -sf $(cat "${pidfile}")
+ eend $?
+}
diff --git a/net-proxy/haproxy/haproxy-1.7_beta4.ebuild b/net-proxy/haproxy/haproxy-1.7_beta4.ebuild
new file mode 100644
index 00000000..c50ac957
--- /dev/null
+++ b/net-proxy/haproxy/haproxy-1.7_beta4.ebuild
@@ -0,0 +1,150 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="6"
+
+inherit user versionator toolchain-funcs flag-o-matic systemd linux-info
+
+MY_P="${PN}-${PV/_beta/-dev}"
+
+DESCRIPTION="A TCP/HTTP reverse proxy for high availability environments"
+HOMEPAGE="http://haproxy.1wt.eu"
+SRC_URI="http://haproxy.1wt.eu/download/$(get_version_component_range 1-2)/src/devel/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~x86"
+IUSE="+crypt doc examples libressl libslz net_ns +pcre pcre-jit ssl tools vim-syntax +zlib" # lua
+REQUIRED_USE="pcre-jit? ( pcre )
+ ?? ( libslz zlib )"
+
+DEPEND="
+ pcre? (
+ dev-libs/libpcre
+ pcre-jit? ( dev-libs/libpcre[jit] )
+ )
+ ssl? (
+ !libressl? ( dev-libs/openssl:0=[zlib?] )
+ libressl? ( dev-libs/libressl:0= )
+ )
+ libslz? ( sys-libs/libslz )
+ zlib? ( sys-libs/zlib )"
+# lua? ( dev-lang/lua:5.3 )
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS=( CHANGELOG CONTRIBUTING MAINTAINERS )
+
+haproxy_use() {
+ (( $# != 2 )) && die "${FUNCNAME} <USE flag> <make option>"
+
+ usex "${1}" "USE_${2}=1" "USE_${2}="
+}
+
+pkg_setup() {
+ enewgroup haproxy
+ enewuser haproxy -1 -1 -1 haproxy
+
+ if use net_ns; then
+ CONFIG_CHECK="~NET_NS"
+ linux-info_pkg_setup
+ fi
+}
+
+src_prepare() {
+ default
+
+ sed -e 's:@SBINDIR@:'/usr/bin':' contrib/systemd/haproxy.service.in \
+ > contrib/systemd/haproxy.service || die
+
+ sed -ie 's:/usr/sbin/haproxy:/usr/bin/haproxy:' src/haproxy-systemd-wrapper.c || die
+}
+
+src_compile() {
+ local -a args=(
+ TARGET=linux2628
+ USE_GETADDRINFO=1
+ )
+
+ args+=( $(haproxy_use crypt LIBCRYPT) )
+
+# bug 541042
+# args+=( $(haproxy_use lua LUA) )
+
+ args+=( $(haproxy_use net_ns NS) )
+ args+=( $(haproxy_use pcre PCRE) )
+ args+=( $(haproxy_use pcre-jit PCRE_JIT) )
+
+# args+=( $(haproxy_use kernel_linux LINUX_SPLICE) )
+# args+=( $(haproxy_use kernel_linux LINUX_TPROXY) )
+
+ args+=( $(haproxy_use ssl OPENSSL) )
+ args+=( $(haproxy_use libslz SLZ) )
+ args+=( $(haproxy_use zlib ZLIB) )
+
+ # For now, until the strict-aliasing breakage will be fixed
+ append-cflags -fno-strict-aliasing
+
+ emake CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args[@]}
+
+ if use tools ; then
+ for contrib in halog iprange ; do
+ emake -C contrib/${contrib} \
+ CFLAGS="${CFLAGS}" OPTIMIZE="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args[@]}
+ done
+ fi
+}
+
+src_install() {
+ dobin haproxy
+
+ newconfd "${FILESDIR}/${PN}.confd" $PN
+ newinitd "${FILESDIR}/${PN}.initd-r3" $PN
+
+ doman doc/haproxy.1
+
+ dobin haproxy-systemd-wrapper
+ systemd_dounit contrib/systemd/haproxy.service
+
+ einstalldocs
+
+ if use doc; then
+ dodoc ROADMAP doc/{close-options,configuration,cookie-options,intro,linux-syn-cookies,management,proxy-protocol}.txt
+ fi
+
+ if use tools ; then
+ dobin contrib/halog/halog
+ newbin contrib/iprange/iprange haproxy_iprange
+ fi
+
+ if use net_ns && use doc; then
+ dodoc doc/network-namespaces.txt
+ fi
+
+ if use examples ; then
+ docinto examples
+ dodoc examples/*.cfg
+ dodoc examples/seamless_reload.txt
+ fi
+
+ if use vim-syntax ; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins examples/haproxy.vim
+ fi
+}
+
+pkg_postinst() {
+ if [[ ! -f "${EROOT}/etc/haproxy/haproxy.cfg" ]] ; then
+ ewarn "You need to create /etc/haproxy/haproxy.cfg before you start the haproxy service."
+ ewarn "It's best practice to not run haproxy as root, user and group haproxy was therefore created."
+ ewarn "Make use of them with the \"user\" and \"group\" directives."
+
+ if [[ -d "${EROOT}/usr/share/doc/${PF}" ]]; then
+ einfo "Please consult the installed documentation for learning the configuration file's syntax."
+ einfo "The documentation and sample configuration files are installed here:"
+ einfo " ${EROOT}usr/share/doc/${PF}"
+ fi
+ fi
+}
diff --git a/net-proxy/haproxy/metadata.xml b/net-proxy/haproxy/metadata.xml
new file mode 100644
index 00000000..56529589
--- /dev/null
+++ b/net-proxy/haproxy/metadata.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>idl0r@gentoo.org</email>
+ <name>Christian Ruppert</name>
+ </maintainer>
+ <longdescription>
+HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for web sites crawling under very high loads while needing persistence or Layer7 processing. Supporting tens of thousands of connections is clearly realistic with todays hardware. Its mode of operation makes its integration into existing architectures very easy and riskless, while still offering the possibility not to expose fragile web servers to the Net.
+
+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
+Its event-driven architecture allows it to easily handle thousands of simultaneous connections on hundreds of instances without risking the system's stability.
+ </longdescription>
+ <use>
+ <flag name="net_ns">Enable network namespace support (CONFIG_NET_NS)</flag>
+ <flag name="pcre-jit">Use JIT support for PCRE</flag>
+ <flag name="tools">Install additional tools (halog, iprange)</flag>
+ </use>
+</pkgmetadata>
diff --git a/profiles/use.local.desc b/profiles/use.local.desc
index b9b4890e..755ee1bd 100644
--- a/profiles/use.local.desc
+++ b/profiles/use.local.desc
@@ -64,6 +64,9 @@ media-video/rtmpdump:gnutls - Use GnuTLS library instead of the default OpenSSL
media-video/rtmpdump:polarssl - Use PolarSSL library instead of the default OpenSSL
net-misc/icmptx:client - Enable client support
net-misc/icmptx:server - Enable server support
+net-proxy/haproxy:net_ns - Enable network namespace support (CONFIG_NET_NS)
+net-proxy/haproxy:pcre-jit - Use JIT support for PCRE
+net-proxy/haproxy:tools - Install additional tools (halog, iprange)
sys-firmware/gnuk:tools - Install aditional tools
virtual/linux-sources:firmware - Install linux kernel firmware
www-apps/phabricator:extension-sprint - Enable extension sprint via www-apps/phabricator-extensions-Sprint