This commit is contained in:
commit
53b5e54cf8
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -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
|
96
init.pen
Normal file
96
init.pen
Normal file
@ -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
|
3
pen-0.17.1.tar.bz2
Normal file
3
pen-0.17.1.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:38d4af7074b6cc2a99a024e0d5db56eec8ccad022e9093decf888a8538748cba
|
||||||
|
size 99272
|
23
pen.cfg
Normal file
23
pen.cfg
Normal file
@ -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"
|
37
pen.changes
Normal file
37
pen.changes
Normal file
@ -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
|
||||||
|
|
||||||
|
|
124
pen.spec
Normal file
124
pen.spec
Normal file
@ -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 <ulric@siag.nu>
|
||||||
|
|
||||||
|
%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
|
24
runpen.sh
Normal file
24
runpen.sh
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user