From 61d912f9e6de95044e7602f44591c409d0efd377 Mon Sep 17 00:00:00 2001 From: Badchay Date: Sat, 16 Apr 2022 04:49:08 +0100 Subject: network/haproxy: Updated for version 2.5.5. Signed-off-by: Dave Woodfall Signed-off-by: Willy Sudiarto Raharjo --- network/haproxy/README | 16 ++++++++----- network/haproxy/README.SLACKWARE | 49 ++++++++++++++++++++++++++++++++++++++ network/haproxy/haproxy.SlackBuild | 27 ++++++++++++++++++--- network/haproxy/haproxy.info | 10 ++++---- network/haproxy/logrotate.example | 9 +++++++ network/haproxy/rc.haproxy | 19 +++++++++++++-- network/haproxy/slack-desc | 12 +++++----- network/haproxy/syslog.example | 20 ++++++++++++++++ 8 files changed, 140 insertions(+), 22 deletions(-) create mode 100644 network/haproxy/README.SLACKWARE create mode 100644 network/haproxy/logrotate.example create mode 100644 network/haproxy/syslog.example (limited to 'network') diff --git a/network/haproxy/README b/network/haproxy/README index 07e6de7b37c2..cef76252a937 100644 --- a/network/haproxy/README +++ b/network/haproxy/README @@ -1,11 +1,15 @@ 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 very high traffic web -sites. +applications. It is particularly suited for very high traffic web sites. Note that a default configuration file is no longer provided at -/etc/haproxy/haproxy.cfg. See /usr/doc/haproxy-*/examples for some -sample configuration files. +/etc/haproxy/haproxy.cfg. See /usr/doc/haproxy-*/examples +for some sample configuration files. The directory also contains +example files for logging. -lua53 is an optional dependency for HAProxy. Pass LUA=yes to this -script to enable lua support. +lua53 is an optional dependency for HAProxy. +Pass LUA=yes to this script to enable lua support. + +This HAProxy package is compiled with Perl Compatible +Regular Expressions (PCRE) version 2 by default. +If you want to use PCRE version 1, pass OLDPCRE=yes to this script. diff --git a/network/haproxy/README.SLACKWARE b/network/haproxy/README.SLACKWARE new file mode 100644 index 000000000000..b83472439e73 --- /dev/null +++ b/network/haproxy/README.SLACKWARE @@ -0,0 +1,49 @@ +-------- +Logging +-------- + +If you want to enable logging, please first refer to HAProxy manual +on how to enable logging and how to select which events to log. + +HAProxy log forwarding works fine with Slackware's sysklogd. + +There are example files located in /usr/doc/haproxy-*/examples +The files are called syslog.example and logrotate.example. + +You might want to add something like this to your haproxy.cfg file: + +global + log /dev/log local0 + +-------- +Automatic starting/stopping upon system start/shutdown +-------- + +To start HAProxy automatically when system is booted, +add the following lines to /etc/rc.d/rc.local: + + if [ -x /etc/rc.d/rc.haproxy ]; then + /etc/rc.d/rc.haproxy start + fi + +To stop HAProxy on system shutdown, add following lines +to /etc/rc.d/rc.local_shutdown + + if [ -x /etc/rc.d/rc.haproxy ]; then + /etc/rc.d/rc.haproxy stop + fi + +-------- +Privileges +-------- + +Like with the most rc scripts /etc/rc.d/rc.haproxy should be +run as root. You can easily drop process privileges by specifying +another user (and group) in the main configuration file. + +Add something like this to haproxy.cfg: + +global + user nobody + group nogroup + diff --git a/network/haproxy/haproxy.SlackBuild b/network/haproxy/haproxy.SlackBuild index 100d9cd2a607..5346ce94f0c7 100644 --- a/network/haproxy/haproxy.SlackBuild +++ b/network/haproxy/haproxy.SlackBuild @@ -5,6 +5,9 @@ # Copyright 2018 T3slider # All rights reserved. # +# Copyright 2022 Badchay +# All rights reserved. +# # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # @@ -25,7 +28,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=haproxy -VERSION=${VERSION:-2.5.3} +VERSION=${VERSION:-2.5.5} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -70,6 +73,10 @@ TARGET=${TARGET:-linux-glibc} # Include lua support? (Requires lua53) LUA=${LUA:-no} +# Perl Compatible Regular Expressions version 2 +# is enabled by default. You can't compile both +# PCRE and PCRE2 support. +OLDPCRE=${OLDPCRE:-no} set -e @@ -87,16 +94,27 @@ find -L . \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; LUAOPT="" -if [ "$LUA" != "no" ]; then +if [ "$LUA" == "yes" ]; then LUAOPT="USE_LUA=1" +else + LUAOPT="USE_LUA=" fi +PCREOPT="" +if [ "$OLDPCRE" == "yes" ]; then + PCREOPT="USE_PCRE=1" +else + PCREOPT="USE_PCRE2=1" +fi + + make \ TARGET=$TARGET \ - USE_PCRE=1 \ + $PCREOPT \ USE_OPENSSL=1 \ USE_ZLIB=1 \ USE_NS=1 \ + USE_SYSTEMD= \ $LUAOPT \ EXTRA="" make install \ @@ -116,6 +134,9 @@ install -D -m 0644 $CWD/rc.$PRGNAM $PKG/etc/rc.d/rc.$PRGNAM.new cp -a CHANGELOG CONTRIBUTING LICENSE MAINTAINERS README ROADMAP SUBVERS VERDATE VERSION examples \ $PKG/usr/doc/$PRGNAM-$VERSION + +cp $CWD/{syslog.example,logrotate.example} $PKG/usr/doc/$PRGNAM-$VERSION/examples/ + mkdir -p $PKG/etc/haproxy mv $PKG/usr/doc/$PRGNAM-$VERSION/examples/errorfiles $PKG/etc/haproxy/errors cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild diff --git a/network/haproxy/haproxy.info b/network/haproxy/haproxy.info index ba6c2eda4995..b1b86ac49c77 100644 --- a/network/haproxy/haproxy.info +++ b/network/haproxy/haproxy.info @@ -1,10 +1,10 @@ PRGNAM="haproxy" -VERSION="2.5.3" +VERSION="2.5.5" HOMEPAGE="https://www.haproxy.org/" -DOWNLOAD="http://www.haproxy.org/download/2.5/src/haproxy-2.5.3.tar.gz" -MD5SUM="947a65fefe192239d92cb45dc93a34d7" +DOWNLOAD="https://www.haproxy.org/download/2.5/src/haproxy-2.5.5.tar.gz" +MD5SUM="8d27d8a58159d7f3389d80f6a6d98795" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -MAINTAINER="T3slider" -EMAIL="t3slider@gmail.com" +MAINTAINER="Badchay" +EMAIL="badchay@protonmail.com" diff --git a/network/haproxy/logrotate.example b/network/haproxy/logrotate.example new file mode 100644 index 000000000000..2fd2924d9a72 --- /dev/null +++ b/network/haproxy/logrotate.example @@ -0,0 +1,9 @@ +/var/log/haproxy { + notifempty + weekly + missingok + rotate 4 + postrotate + /etc/rc.d/rc.haproxy restart + endscript +} diff --git a/network/haproxy/rc.haproxy b/network/haproxy/rc.haproxy index a95a40713393..e19ddf8ca529 100644 --- a/network/haproxy/rc.haproxy +++ b/network/haproxy/rc.haproxy @@ -1,15 +1,30 @@ -#!/bin/sh +#!/bin/bash +# +# Slackware initialization script for HAProxy. +# +# This script was made by T3slider. +# Slight modifications by Badchay. +# + HAPROXY=/usr/sbin/haproxy CONFIG=/etc/haproxy/haproxy.cfg PIDFILE=/var/run/haproxy.pid +if [[ ! -f $CONFIG && "$1" == "start" ]]; then + echo "No configuration file found. Cannot continue." + echo "The script looks for the configuration file placed in $CONFIG" + exit 1 +fi + start() { if [ -r $PIDFILE ]; then echo 'HAProxy is already running!' return + else + echo "Starting HAProxy..." + $HAPROXY -f $CONFIG -D -p $PIDFILE fi - $HAPROXY -f $CONFIG -D -p $PIDFILE } stop() { diff --git a/network/haproxy/slack-desc b/network/haproxy/slack-desc index 773ba0f4728a..1131d5b88179 100644 --- a/network/haproxy/slack-desc +++ b/network/haproxy/slack-desc @@ -6,14 +6,14 @@ # customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| -haproxy: haproxy (a high performance TCP/HTTP load balancer) +haproxy: haproxy (The Reliable, High Performance TCP/HTTP Load Balancer) haproxy: -haproxy: HAProxy is a free, very fast and reliable solution offering high +haproxy: HAProxy is a free, very fast and reliable reverse-proxy offering high haproxy: availability, load balancing, and proxying for TCP and HTTP-based -haproxy: applications. It is particularly suited for very high traffic web -haproxy: sites. -haproxy: -haproxy: http://www.haproxy.org/ +haproxy: applications. It is particularly suited for very high traffic +haproxy: web sites and powers a significant portion of the world's most +haproxy: visited ones. haproxy: haproxy: +haproxy: Check out more information on https://www.haproxy.org/ haproxy: diff --git a/network/haproxy/syslog.example b/network/haproxy/syslog.example new file mode 100644 index 000000000000..8d062fac17f9 --- /dev/null +++ b/network/haproxy/syslog.example @@ -0,0 +1,20 @@ +# Note: If you enable local0 logging. You'll probably want to add +# something like local0.none to your /etc/syslogd.conf +# +# Otherwise the logs will be sent to your /var/log/messages file +# as well as the logfile specified below. +# +# An example would be to change the default line +# +# authpriv.none;cron.none;mail.none;news.none -/var/log/messages +# to +# authpriv.none;cron.none;mail.none;news.none;local0.none -/var/log/messages +# +# Move this file to /etc/syslog.d/ with .conf extension +# so syslog will load it automatically. +# +# Also remember to restart sysklogd +# sh /etc/rc.d/rc.syslog restart +# + +local0.* -/var/log/haproxy -- cgit v1.2.3