Mailing List Archive

r1440 - trunk/varnish-cache/redhat
Author: ingvar
Date: 2007-05-16 23:08:43 +0200 (Wed, 16 May 2007)
New Revision: 1440

Modified:
trunk/varnish-cache/redhat/varnish.initrc
trunk/varnish-cache/redhat/varnish.spec
trunk/varnish-cache/redhat/varnish.sysconfig
trunk/varnish-cache/redhat/varnishlog.initrc
Log:
* Wed May 16 2007 Ingvar Hagelund <ingvar at linpro.no> - 1.0.svn-20070516
- Wrapping up for 1.0.4
- Changes in sysconfig and init scripts. Syncing with files in
trunk/debian



Modified: trunk/varnish-cache/redhat/varnish.initrc
===================================================================
--- trunk/varnish-cache/redhat/varnish.initrc 2007-05-16 20:03:32 UTC (rev 1439)
+++ trunk/varnish-cache/redhat/varnish.initrc 2007-05-16 21:08:43 UTC (rev 1440)
@@ -13,17 +13,22 @@

RETVAL=0
PROCNAME=varnishd
+PIDFILE=/var/run/varnish.pid
+LOCKFILE=/var/lock/subsys/varnish

+# Include varnish defaults
. /etc/sysconfig/varnish
-if [ "$DAEMON" = "" ]; then DAEMON="/usr/sbin/varnishd"; fi
-DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
- -h ${VARNISH_HASHOPTION} \
- -f ${VARNISH_VCL_CONF} \
- -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
- -t ${VARNISH_TTL} \
- -w ${VARNISH_MIN_WORKER_THREADS},${VARNISH_MAX_WORKER_THREADS},${VARNISH_WORKER_THREAD_TIMEOUT} \
- -s ${VARNISH_BACKEND_STORAGE}"

+DAEMON="/usr/sbin/varnishd"
+
+# $DAEMON_OPTS is set in /etc/sysconfig/varnish. At least, one
+# have to set up a backend.
+if [ "$DAEMON_OPTS" = "" ]; then
+ echo "No values specified in DAEMON_OPTS. Please read the varnishd(1)"
+ echo "manpage and put configuration options in /etc/sysconfig/varnish"
+ exit 1
+fi
+
mkdir -p /var/run/varnish 2>/dev/null

# Open files (usually 1024, which is way too small for varnish)
@@ -34,14 +39,14 @@
case "$1" in
start)
echo -n "Starting varnish HTTP accelerator: "
- daemon $DAEMON "$DAEMON_OPTS"
+ daemon --pidfile ${PIDFILE} ${DAEMON} "$DAEMON_OPTS" -P ${PIDFILE}
sleep 1
pkill -0 $PROCNAME
RETVAL=$?
if [ $RETVAL -eq 0 ]
then
echo_success
- touch /var/lock/subsys/varnish
+ touch $LOCKFILE
else
echo_failure
fi
@@ -49,19 +54,19 @@
;;
stop)
echo -n "Stopping varnish HTTP accelerator: "
- killproc $DAEMON
+ killproc -p $PIDFILE $DAEMON
RETVAL=$?
if [ $RETVAL -eq 0 ]
then
echo_success
- rm -f /var/lock/subsys/varnish
+ rm -f $LOCKFILE $PIDFILE
else
echo_failure
fi
echo
;;
status)
- status $PROCNAME
+ status -p $PIDFILE $PROCNAME
RETVAL=$?
;;
restart|reload)
@@ -70,7 +75,7 @@
RETVAL=$?
;;
condrestart)
- if [ -f /var/lock/subsys/varnish ]; then
+ if [ -f $PIDFILE ]; then
$0 stop
$0 start
RETVAL=$?

Modified: trunk/varnish-cache/redhat/varnish.spec
===================================================================
--- trunk/varnish-cache/redhat/varnish.spec 2007-05-16 20:03:32 UTC (rev 1439)
+++ trunk/varnish-cache/redhat/varnish.spec 2007-05-16 21:08:43 UTC (rev 1440)
@@ -1,7 +1,7 @@
Summary: Varnish is a high-performance HTTP accelerator
Name: varnish
Version: 1.0.svn
-Release: 20070511%{?dist}
+Release: 20070516%{?dist}
License: BSD-like
Group: System Environment/Daemons
URL: http://www.varnish-cache.org/
@@ -62,7 +62,7 @@

%{__make} %{?_smp_mflags}

-sed -e ' s/8080/80/g ' etc/vcl.conf > redhat/vcl.conf
+sed -e ' s/8080/80/g ' etc/default.vcl > redhat/default.vcl

%install
rm -rf %{buildroot}
@@ -77,7 +77,7 @@
mkdir -p %{buildroot}/var/lib/varnish
mkdir -p %{buildroot}/var/log/varnish

-%{__install} -D -m 0644 redhat/vcl.conf %{buildroot}%{_sysconfdir}/varnish/vcl.conf
+%{__install} -D -m 0644 redhat/default.vcl %{buildroot}%{_sysconfdir}/varnish/default.vcl
%{__install} -D -m 0644 redhat/varnish.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/varnish
%{__install} -D -m 0644 redhat/varnish.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/varnish
%{__install} -D -m 0755 redhat/varnish.initrc %{buildroot}%{_sysconfdir}/init.d/varnish
@@ -94,9 +94,9 @@
%{_var}/log/varnish
%{_mandir}/man1/*.1*
%{_mandir}/man7/*.7*
-%doc INSTALL LICENSE README redhat/README.redhat redhat/vcl.conf ChangeLog
+%doc INSTALL LICENSE README redhat/README.redhat redhat/default.vcl ChangeLog
%dir %{_sysconfdir}/varnish/
-%config(noreplace) %{_sysconfdir}/varnish/vcl.conf
+%config(noreplace) %{_sysconfdir}/varnish/default.vcl
%config(noreplace) %{_sysconfdir}/sysconfig/varnish
%config(noreplace) %{_sysconfdir}/logrotate.d/varnish
%{_sysconfdir}/init.d/varnish
@@ -137,6 +137,11 @@
%postun libs -p /sbin/ldconfig

%changelog
+* Wed May 16 2007 Ingvar Hagelund <ingvar at linpro.no> - 1.0.svn-20070516
+- Wrapping up for 1.0.4
+- Changes in sysconfig and init scripts. Syncing with files in
+ trunk/debian
+
* Fri May 11 2007 Ingvar Hagelund <ingvar at linpro.no> - 1.0.svn-20070511
- Threw latest changes into svn trunk
- Removed the conversion of manpages into utf8. They are all utf8 in trunk

Modified: trunk/varnish-cache/redhat/varnish.sysconfig
===================================================================
--- trunk/varnish-cache/redhat/varnish.sysconfig 2007-05-16 20:03:32 UTC (rev 1439)
+++ trunk/varnish-cache/redhat/varnish.sysconfig 2007-05-16 21:08:43 UTC (rev 1440)
@@ -1,54 +1,87 @@
+# Configuration file for varnish
#
-# Default variables for varnish
+# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this
+# shell script fragment.
#

-# The main daemon binary
-VARNISHD=/usr/sbin/varnish
+# Maximum number of open files (for ulimit -n)
+NFILES=131072

-# VCL Configuration file. This is the "main configuration file"
-VARNISH_VCL_CONF=/etc/varnish/vcl.conf
+# This file contains 4 alternatives, please use only one.

+## Alternative 1, Minimal configuration, no VCL
+#
+# Listen on port 6081, administration on localhost:6082, and forward to
+# content server on localhost:8080. Use a fixed-size cache file.
+#
+DAEMON_OPTS="-a :6081 \
+ -T localhost:6082 \
+ -b localhost:8080 \
+ -s file,/var/lib/varnish/varnish_storage.bin,1G"

-# Default address and port to bind to.
-# To make varnish accept normal http traffic,
-# change the listen port to 80
-VARNISH_LISTEN_ADDRESS=0.0.0.0
-VARNISH_LISTEN_PORT=6081

+## Alternative 2, Configuration with VCL
+#
+# Listen on port 6081, administration on localhost:6082, and forward to
+# one content server selected by the vcl file, based on the request. Use a
+# fixed-size cache file.
+#
+# DAEMON_OPTS="-a :6081 \
+# -T localhost:6082 \
+# -f /etc/varnish/default.vcl \
+# -s file,/var/lib/varnish/varnish_storage.bin,1G"

-# Telnet admin interface listen address and port
-VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
-VARNISH_ADMIN_LISTEN_PORT=6082

+## Alternative 3, Advanced configuration
+#
+# See varnishd(1) for more information.
+#
+# # Main configuration file. You probably want to change it :)
+# VARNISH_VCL_CONF=/etc/varnish/default.vcl
+#
+# # Default address and port to bind to
+# # Blank address means all IPv4 and IPv6 interfaces, otherwise specify
+# # a host name, an IPv4 dotted quad, or an IPv6 address in brackets.
+# VARNISH_LISTEN_ADDRESS=
+# VARNISH_LISTEN_PORT=6081
+#
+# # Telnet admin interface listen address and port
+# VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
+# VARNISH_ADMIN_LISTEN_PORT=6082
+#
+# # The minimum number of worker threads to start
+# VARNISH_MIN_THREADS=1
+#
+# # The Maximum number of worker threads to start
+# VARNISH_MAX_THREADS=1000
+#
+# # Idle timeout for worker threads
+# VARNISH_THREAD_TIMEOUT=120
+#
+# # Cache file location
+# VARNISH_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin
+#
+# # Cache file size: in bytes, optionally using k / M / G / T suffix,
+# # or in percentage of available disk space using the % suffix.
+# VARNISH_STORAGE_SIZE=1G
+#
+# # Backend storage specification
+# VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}"
+#
+# # Default TTL used when the backend does not specify one
+# VARNISH_TTL=120
+#
+# # DAEMON_OPTS is used by the init script. If you add or remove options, make
+# # sure you update this section, too.
+# DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
+# -f ${VARNISH_VCL_CONF} \
+# -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
+# -t ${VARNISH_TTL} \
+# -w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \
+# -s ${VARNISH_STORAGE}"
+#

-# The minimum number of threads to start
-VARNISH_MIN_WORKER_THREADS=1

-
-# Maximum number of worker threads
-VARNISH_MAX_WORKER_THREADS=1000
-
-
-# Timeout value in seconds for threads to return
-VARNISH_WORKER_THREAD_TIMEOUT=10
-
-
-# Hash algorithm to be used
-VARNISH_HASHOPTION=classic
-
-
-# Maximum size of the backend storagefile in bytes
-VARNISH_BACKEND_STORAGE_SIZE=10240000
-VARNISH_BACKEND_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin
-
-
-# Backend storage specification
-VARNISH_BACKEND_STORAGE="file,${VARNISH_BACKEND_STORAGE_FILE},${VARNISH_BACKEND_STORAGE_SIZE}"
-
-
-# Set default ttl in secounds
-VARNISH_TTL=120
-
-# The Maximum number of open files (ulimit)
-# Default : 131072 (system default is usually 1024)
-NFILES=131072
+## Alternative 4, Do It Yourself. See varnishd(1) for more information.
+#
+# DAEMON_OPTS=""

Modified: trunk/varnish-cache/redhat/varnishlog.initrc
===================================================================
--- trunk/varnish-cache/redhat/varnishlog.initrc 2007-05-16 20:03:32 UTC (rev 1439)
+++ trunk/varnish-cache/redhat/varnishlog.initrc 2007-05-16 21:08:43 UTC (rev 1440)
@@ -14,24 +14,11 @@
RETVAL=0
PROCNAME=varnishlog

-. /etc/sysconfig/varnish
+DAEMON="/usr/bin/varnishlog"
+PIDFILE="/var/run/varnish/varnishlog.pid"
+LOCKFILE="/var/lock/subsys/varnishlog"
+LOGFILE="/var/log/varnish/varnish.log"

-if [ "$LOGDAEMON" = "" ]
-then
- DAEMON="/usr/bin/varnishlog"
-else
- DAEMON="$LOGDAEMON"
-fi
-
-if [ "$LOGPIDFILE" = "" ]
-then
- PIDFILE="/var/run/varnish/varnishlog.pid"
-else
- PIDFILE="$LOGPIDFILE"
-fi
-
-if [ "$LOGFILE" = "" ]; then LOGFILE="/var/log/varnish/varnish.log"; fi
-
DAEMON_OPTS="-a -w ${LOGFILE} -D -P $PIDFILE"

mkdir -p /var/run/varnish 2>/dev/null
@@ -40,14 +27,14 @@
case "$1" in
start)
echo -n "Starting varnish logging daeon: "
- daemon $DAEMON "$DAEMON_OPTS"
+ daemon --pidfile $PIDFILE $DAEMON "$DAEMON_OPTS"
sleep 1
pkill -0 $PROCNAME
RETVAL=$?
if [ $RETVAL -eq 0 ]
then
echo_success
- touch /var/lock/subsys/varnishlog
+ touch $LOCKFILE
else
echo_failure
fi
@@ -55,19 +42,19 @@
;;
stop)
echo -n "Stopping varnish logging daemon: "
- killproc $DAEMON
+ killproc -p $PIDFILE $DAEMON
RETVAL=$?
if [ $RETVAL -eq 0 ]
then
echo_success
- rm -f /var/lock/subsys/varnishlog
+ rm -f $LOCKFILE $PIDFILE
else
echo_failure
fi
echo
;;
status)
- status $PROCNAME
+ status -p $PIDFILE $PROCNAME
RETVAL=$?
;;
restart|reload)
@@ -76,7 +63,7 @@
RETVAL=$?
;;
condrestart)
- if [ -f /var/lock/subsys/varnishlog ]; then
+ if [ -f $PIDFILE ]; then
$0 stop
$0 start
RETVAL=$?