From 53b5e54cf857e180273383a3b820eed347af564acfde197fbdaf06ee0d6204b9 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Mon, 15 Jan 2007 23:29:34 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/pen?expand=0&rev=1 --- .gitattributes | 23 +++++++++ init.pen | 96 +++++++++++++++++++++++++++++++++++ pen-0.17.1.tar.bz2 | 3 ++ pen.cfg | 23 +++++++++ pen.changes | 37 ++++++++++++++ pen.spec | 124 +++++++++++++++++++++++++++++++++++++++++++++ ready | 0 runpen.sh | 24 +++++++++ 8 files changed, 330 insertions(+) create mode 100644 .gitattributes create mode 100644 init.pen create mode 100644 pen-0.17.1.tar.bz2 create mode 100644 pen.cfg create mode 100644 pen.changes create mode 100644 pen.spec create mode 100644 ready create mode 100644 runpen.sh diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/init.pen b/init.pen new file mode 100644 index 0000000..19d2678 --- /dev/null +++ b/init.pen @@ -0,0 +1,96 @@ +#! /bin/sh +# Copyright (c) 1995-2004 SUSE LINUX AG, Germany. +# +# Author: joe@suse.de, template by ro@suse.de +# using parts from Torsten.Goedicke@wlw.de +# +# /etc/init.d/pen +# and its symbolic link +# /usr/sbin/rcpen +# +### BEGIN INIT INFO +# Provides: pen +# Required-Start: $time $named $syslog +# Required-Stop: +# Default-Start: 3 5 +# Default-Stop: 0 1 2 4 6 +# Description: A simple load balancer for tcp based protocols +### END INIT INFO + +. /etc/rc.status + +JOBNAME="$0" +NAME=pen +DAEMON=/usr/bin/run$NAME.sh +CF=/etc/$NAME.cfg + +PIDDIR="/var/run" +PIDALL="$PIDDIR/run$NAME.pid" + +if [ -f $CF ]; then + . $CF +else + echo "Error: Configuration file $CF not found" && exit 0 +fi + +# Determine the base and follow a runlevel link name. +base=${0##*/} +link=${base#*[SK][0-9][0-9]} + +# Force execution if not called by a runlevel directory. +test -x $DAEMON || exit 0 + +rc_reset +case "$1" in + start) + PID=`$PS | grep $NAME | grep -v grep | grep -v $JOBNAME` + if [ -n "$PID" ]; then + echo "$NAME load balancer is already running as" + echo "$PID" + else + echo -n "Starting pen load balancer instances" + for i in $COUNT + do + eval PIDFILE=\$PID${i} + eval OPTIONS=\$PEN${i} + CFFILE=`echo $PIDFILE | sed 's/pid/conf/'` + echo $OPTIONS > $CFFILE + $DAEMON $CFFILE & + echo $! >> $PIDALL + done + fi + rc_status -v + ;; + stop) + echo -n "Shutting down pen load balancer instances" + test -f $PIDALL && kill -TERM `cat $PIDALL` 2> /dev/null + test -f $PIDALL && kill -KILL `cat $PIDALL` 2> /dev/null + rm -f $PIDALL + for i in $COUNT + do + eval PIDFILE=\$PID${i} + eval OPTIONS=\$PEN${i} + CFFILE=`echo $PIDFILE | sed 's/pid/conf/'` + test -f $PIDFILE && kill -TERM `cat $PIDFILE` 2> /dev/null + rm -f $PIDFILE $CFFILE + done + rc_status -v + ;; + restart) + echo -n "Restarting pen load balancer instances" + for i in $COUNT + do + eval PIDFILE=\$PID${i} + eval OPTIONS=\$PEN${i} + CFFILE=`echo $PIDFILE | sed 's/pid/conf/'` + echo $OPTIONS > $CFFILE + kill -TERM `cat $PIDFILE` + done + rc_status -v + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac +rc_exit diff --git a/pen-0.17.1.tar.bz2 b/pen-0.17.1.tar.bz2 new file mode 100644 index 0000000..3734749 --- /dev/null +++ b/pen-0.17.1.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38d4af7074b6cc2a99a024e0d5db56eec8ccad022e9093decf888a8538748cba +size 99272 diff --git a/pen.cfg b/pen.cfg new file mode 100644 index 0000000..c062b16 --- /dev/null +++ b/pen.cfg @@ -0,0 +1,23 @@ +# Original idea: Torsten.Goedicke@wlw.de +# Modified for SUSE LINUX by joe@suse.de + +# simple configuration file for the pen loadbalancer +# BEZx="Name for instance" +# PIDx=/var/run/pen.pid-[Port] +# CONx=$HOST:800x +# PENx="-p $PIDx -C $CONx [Port] [Server1:Port] [Server2:Port]" +# + +# The entries in COUNT must match the numbers used below +# i.e. if you add another instance using BEZ2, PID2, etc. +# you also have to change COUNT from "1" to "1 2". + +COUNT="1" + +# If want to use port 80 as in the default you can't run an Apache server +# or any otherweb server on the same port at the same time! + +BEZ1="WWW Proxy" +PID1=/var/run/pen.pid-8080 +CON1=localhost:8001 +PEN1="-x 500 -p $PID1 -C $CON1 8080 server1:80 server2:80" diff --git a/pen.changes b/pen.changes new file mode 100644 index 0000000..c34d848 --- /dev/null +++ b/pen.changes @@ -0,0 +1,37 @@ +------------------------------------------------------------------- +Fri Aug 25 13:43:40 CEST 2006 - joe@suse.de + +- update to version 0.17.1 + +- bugfix: server_by_weight would never consider blacklisted + servers, which kept them blacklisted indefinitely + +------------------------------------------------------------------- +Wed Jan 25 21:39:25 CET 2006 - mls@suse.de + +- converted neededforbuild to BuildRequires + +------------------------------------------------------------------- +Fri Dec 16 10:27:02 CET 2005 - joe@suse.de + +- fixed the init script give feedback on restart action + +- upgraded to version 0.16.0 + +- the configure option for ssl is now: + --with-experimental-only-ssl + +- new "abuse server", similar to the emergency server: + use "-B host:port" to enable + +------------------------------------------------------------------- +Mon Jan 24 14:02:26 CET 2004 - joe@suse.de + +- upgraded to version 0.15.0 + +------------------------------------------------------------------- +Wed Jun 9 15:37:16 CEST 2004 - joe@suse.de + +- Initial version of SUSE pen package + + diff --git a/pen.spec b/pen.spec new file mode 100644 index 0000000..0abaad7 --- /dev/null +++ b/pen.spec @@ -0,0 +1,124 @@ +# +# spec file for package pen (Version 0.17.1) +# +# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +# norootforbuild + +Name: pen +License: GPL +Group: Productivity/Clustering/HA +Summary: A simple load balancer for tcp based protocols +URL: http://siag.nu/pen/ +Version: 0.17.1 +Release: 1 +Source0: %{name}-%{version}.tar.bz2 +Source1: %{name}.cfg +Source2: init.%{name} +Source3: runpen.sh +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +Pen is a load balancer for "simple" tcp based protocols such as http or +smtp. It allows several servers to appear as one to the outside and +automatically detects servers that are down and distributes clients +among the available servers. This gives high availability and scalable +performance. + +The load balancing algorithm keeps track of clients and will try to +send them back to the server they visited the last time. This is useful +for applications that maintain state between connections in the server, +including most modern web applications. + +When pen detects that a server is unavailable, it scans for another +starting with the server after the most recently used one. That way we +get load balancing and "fair" failover for free. + +Correctly configured, pen can ensure that a server farm is always +available, even when individual servers are brought down for +maintenance or reconfiguration. + +The final single point of failure, pen itself, can be eliminated by +running pen on several servers, using vrrp to decide which is active. + + + +Authors: +-------- + Ulric Eriksson + +%prep +%setup -q +#%patch + +%build +export CFLAGS="$RPM_OPT_FLAGS" +export CXXFLAGS="$RPM_OPT_FLAGS" +./configure \ + --prefix=/usr \ + --mandir=%_mandir \ + --with-daemon +make + +%install +mkdir -p $RPM_BUILD_ROOT/usr/sbin +make DESTDIR="$RPM_BUILD_ROOT" install +# Install pen init script +mkdir -p $RPM_BUILD_ROOT/etc/init.d +install -m 0744 %SOURCE2 $RPM_BUILD_ROOT/etc/init.d/%{name} +install -m 0744 %SOURCE3 $RPM_BUILD_ROOT/usr/bin/runpen.sh +install -m 0644 %SOURCE1 $RPM_BUILD_ROOT/etc/%{name}.cfg +ln -sf ../../etc/init.d/%{name} $RPM_BUILD_ROOT/usr/sbin/rc%{name} +mkdir -p ${RPM_BUILD_ROOT}%{_docdir} +mv $RPM_BUILD_ROOT/usr/doc/pen ${RPM_BUILD_ROOT}%{_docdir} + +%clean +rm -rf ${RPM_BUILD_ROOT} + +%post +%{fillup_and_insserv -n pen pen} + +%postun +%restart_on_update %{name} +%insserv_cleanup + +%preun +%stop_on_removal %{name} + +%files +%defattr(-,root,root) +%{_docdir}/* +%{_mandir}/man1/*.1.gz +/etc/init.d/%{name} +/usr/bin/%{name} +/usr/bin/runpen.sh +/usr/bin/mergelogs +/usr/bin/penctl +/usr/bin/penlog +/usr/bin/penlogd +/usr/sbin/rc%{name} +%config(noreplace) /etc/%{name}.cfg + +%changelog -n pen +* Fri Aug 25 2006 - joe@suse.de +- update to version 0.17.1 +- bugfix: server_by_weight would never consider blacklisted + servers, which kept them blacklisted indefinitely +* Wed Jan 25 2006 - mls@suse.de +- converted neededforbuild to BuildRequires +* Fri Dec 16 2005 - joe@suse.de +- fixed the init script give feedback on restart action +- upgraded to version 0.16.0 +- the configure option for ssl is now: +--with-experimental-only-ssl +- new "abuse server", similar to the emergency server: + use "-B host:port" to enable +* Wed Jun 09 2004 - joe@suse.de +- Initial version of SUSE pen package +* Sat Jan 24 2004 - joe@suse.de +- upgraded to version 0.15.0 diff --git a/ready b/ready new file mode 100644 index 0000000..473a0f4 diff --git a/runpen.sh b/runpen.sh new file mode 100644 index 0000000..bb8329e --- /dev/null +++ b/runpen.sh @@ -0,0 +1,24 @@ +#!/bin/sh +#set -x +# +# Script that monitors and restarts a pen load balancer instance +# +# Parameters: name of the configuration file +# +# Original author: Torsten.Goedicke@wlw.de +# Modified for SUSE LINUX by joe@suse.de + +DAEMON=/usr/bin/pen +CFFILE="$1" + +test ! -x "$DAEMON" && echo "Error: pen binary missing" && exit 0 +test ! -f "$CFFILE" && echo "Error: pen configuration file missing" && exit 0 + +RUN=yes +while [ $RUN = "yes" ] +do + PARAM=`cat $CFFILE` + $DAEMON -f $PARAM & + PID="$!" + wait $PID +done