r1433 - in branches/1.0: . bin/varnishd bin/varnishstat bin/varnishtop debian etc

des at projects.linpro.no des at projects.linpro.no
Wed May 16 16:25:56 CEST 2007


Author: des
Date: 2007-05-16 16:25:56 +0200 (Wed, 16 May 2007)
New Revision: 1433

Added:
   branches/1.0/debian/varnish.examples
   branches/1.0/debian/varnish.postrm
   branches/1.0/etc/zope-plone.vcl
Removed:
   branches/1.0/debian/postrm
   branches/1.0/debian/vcl.conf
   branches/1.0/etc/vcl.conf
Modified:
   branches/1.0/
   branches/1.0/Makefile.am
   branches/1.0/bin/varnishd/varnishd.1
   branches/1.0/bin/varnishstat/Makefile.am
   branches/1.0/bin/varnishtop/Makefile.am
   branches/1.0/configure.ac
   branches/1.0/debian/rules
   branches/1.0/debian/varnish.default
   branches/1.0/debian/varnish.init
Log:
Merged revisions 1424-1432 via svnmerge from 
svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache

........
  r1424 | des | 2007-05-15 21:38:56 +0200 (Tue, 15 May 2007) | 2 lines
  
  Rename vcl.conf to default.vcl, update and comment the sample code.
........
  r1425 | des | 2007-05-16 11:34:26 +0200 (Wed, 16 May 2007) | 2 lines
  
  Expand tags
........
  r1426 | des | 2007-05-16 11:35:18 +0200 (Wed, 16 May 2007) | 2 lines
  
  Distribute default.vcl.
........
  r1427 | ssm | 2007-05-16 12:52:15 +0200 (Wed, 16 May 2007) | 1 line
  
  Added example vcl to use in front of zope+plone (this could perhaps go in a contrib/ directory instead)
........
  r1428 | ssm | 2007-05-16 12:53:30 +0200 (Wed, 16 May 2007) | 1 line
  
  fix upgrade issue in postrm script, and rename it to <package>.postrm to match other debian control files
........
  r1429 | ssm | 2007-05-16 12:54:38 +0200 (Wed, 16 May 2007) | 1 line
  
  Ship with etc/default.vcl instead, no need for a separate configuration file
........
  r1430 | ssm | 2007-05-16 12:59:13 +0200 (Wed, 16 May 2007) | 7 lines
  
  Use etc/default.vcl instead of debian/vcl.conf
  
  Register etc/zope-plone.vcl as an example configuration file
  
  Typo patrol
........
  r1431 | ssm | 2007-05-16 13:38:08 +0200 (Wed, 16 May 2007) | 13 lines
  
  Init-script: 
  
    * Move user-adjustable parts from init script to defaults file, expect
      $DAEMON_OPTS instead of a whole forest of variables.
  
    * We have a pid file argument, wheee. :D
  
  Defaults file:
  
   * Created alternative default templates, selected a one-backend default
     without VCL file.
........
  r1432 | des | 2007-05-16 14:45:53 +0200 (Wed, 16 May 2007) | 2 lines
  
  Explain in more detail how the storage file size is specified.
........



Property changes on: branches/1.0
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk/varnish-cache:1-1315,1359-1387,1394,1399-1421
   + /trunk/varnish-cache:1-1315,1359-1387,1394,1399-1421,1424-1432

Modified: branches/1.0/Makefile.am
===================================================================
--- branches/1.0/Makefile.am	2007-05-16 12:45:53 UTC (rev 1432)
+++ branches/1.0/Makefile.am	2007-05-16 14:25:56 UTC (rev 1433)
@@ -1,5 +1,5 @@
 # $Id$
 
-SUBDIRS = include lib bin man
+SUBDIRS = include lib bin man etc
 
 EXTRA_DIST = LICENSE autogen.sh debian redhat

Modified: branches/1.0/bin/varnishd/varnishd.1
===================================================================
--- branches/1.0/bin/varnishd/varnishd.1	2007-05-16 12:45:53 UTC (rev 1432)
+++ branches/1.0/bin/varnishd/varnishd.1	2007-05-16 14:25:56 UTC (rev 1433)
@@ -28,7 +28,7 @@
 .\"
 .\" $Id$
 .\"
-.Dd May 14, 2007
+.Dd May 16, 2007
 .Dt VARNISHD 1
 .Os
 .Sh NAME
@@ -180,6 +180,8 @@
 Not recommended for production use.
 .It Cm classic Ns Op Ns , Ns Ar buckets
 A standard hash table.
+This is the default.
+.Pp
 The hash key is the CRC32 of the object's URL modulo the size of the
 hash table.
 Each table entry points to a list of elements which share the same
@@ -199,6 +201,7 @@
 Not recommended for production use.
 .It Cm file Ns Op Ns , Ns Ar path Ns Op Ns , Ns Ar size
 Storage for each object is allocated from an arena backed by a file.
+This is the default.
 .Pp
 The
 .Ar path
@@ -212,6 +215,24 @@
 The
 .Ar size
 parameter specifies the size of the backing file.
+The size is assumed to be in bytes, unless followed by one of the
+following suffixes:
+.Bl -tag -width indent
+.It K, k
+The size is expressed in kibibytes.
+.It M, m
+The size is expressed in mebibytes.
+.It G, g
+The size is expressed in gibibytes.
+.It T, t
+The size is expressed in tebibytes.
+.It %
+The size is expressed as a percentage of the free space on the file
+system where it resides.
+.El
+.Pp
+The default size is 50%.
+.Pp
 If the backing file already exists, it will be truncated or expanded
 to the specified size.
 .Pp

Modified: branches/1.0/bin/varnishstat/Makefile.am
===================================================================
--- branches/1.0/bin/varnishstat/Makefile.am	2007-05-16 12:45:53 UTC (rev 1432)
+++ branches/1.0/bin/varnishstat/Makefile.am	2007-05-16 14:25:56 UTC (rev 1433)
@@ -1,4 +1,4 @@
-# $Id: Makefile.am 133 2006-04-06 09:38:00Z phk $
+# $Id$
 
 INCLUDES = -I$(top_srcdir)/include
 


Property changes on: branches/1.0/bin/varnishstat/Makefile.am
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: branches/1.0/bin/varnishtop/Makefile.am
===================================================================
--- branches/1.0/bin/varnishtop/Makefile.am	2007-05-16 12:45:53 UTC (rev 1432)
+++ branches/1.0/bin/varnishtop/Makefile.am	2007-05-16 14:25:56 UTC (rev 1433)
@@ -1,4 +1,4 @@
-# $Id: Makefile.am 347 2006-07-06 09:31:45Z des $
+# $Id$
 
 INCLUDES = -I$(top_srcdir)/include
 


Property changes on: branches/1.0/bin/varnishtop/Makefile.am
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: branches/1.0/configure.ac
===================================================================
--- branches/1.0/configure.ac	2007-05-16 12:45:53 UTC (rev 1432)
+++ branches/1.0/configure.ac	2007-05-16 14:25:56 UTC (rev 1433)
@@ -130,6 +130,7 @@
     bin/varnishncsa/Makefile
     bin/varnishstat/Makefile
     bin/varnishtop/Makefile
+    etc/Makefile
     include/Makefile
     lib/Makefile
     lib/libcompat/Makefile

Deleted: branches/1.0/debian/postrm
===================================================================
--- branches/1.0/debian/postrm	2007-05-16 12:45:53 UTC (rev 1432)
+++ branches/1.0/debian/postrm	2007-05-16 14:25:56 UTC (rev 1433)
@@ -1,44 +0,0 @@
-#! /bin/sh -e
-
-set -e
-
-case "$1" in
-        remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-
-        if test -e /var/log/varnish && ! [ "$1" = upgrade ]; then
-
-            rm -rf /var/log/varnish 2>&1 > /dev/null || exit 78
-
-        fi
-
-        if test -e /var/lib/varnish; then
-        
-                rm -rf /var/lib/varnish 2>&1 > /dev/null || exit 78
-        fi
-
-        ;;
-
-        purge)
-
-        if test -e /var/log/varnish; then 
-
-                rm -rf /var/log/varnish 2>&1 > /dev/null || exit 78
-                
-        fi
-
-        if test -e /var/lib/varnish; then
-        
-                rm -rf /var/lib/varnish 2>&1 > /dev/null || exit 78
-        fi
-
-        ;;
-
-    *)
-        echo "postrm called with unknown argument \`$1'" >&2
-        exit 64
-
-esac
-
-#DEBHELPER#
-
-exit 0

Modified: branches/1.0/debian/rules
===================================================================
--- branches/1.0/debian/rules	2007-05-16 12:45:53 UTC (rev 1432)
+++ branches/1.0/debian/rules	2007-05-16 14:25:56 UTC (rev 1433)
@@ -67,7 +67,7 @@
 	dh_installdirs
 
 	$(MAKE) install DESTDIR=$(CURDIR)/debian/varnish
-	install -m 644 $(CURDIR)/debian/vcl.conf $(CURDIR)/debian/varnish/etc/varnish/
+	install -m 644 $(CURDIR)/etc/default.vcl $(CURDIR)/debian/varnish/etc/varnish/
 	install -m 644 $(CURDIR)/debian/lintian-override $(CURDIR)/debian/varnish/usr/share/lintian/overrides/varnish
 
 
@@ -81,9 +81,10 @@
 	dh_testroot
 	dh_installchangelogs ChangeLog
 	dh_installdocs
-	# Since varnish looses its cache on restart - we don't.
+	# Since varnish loses its cache on restart - we don't.
 	dh_installinit -r
 	dh_installman
+	dh_installexamples
 	dh_link
 	dh_strip
 	dh_compress

Modified: branches/1.0/debian/varnish.default
===================================================================
--- branches/1.0/debian/varnish.default	2007-05-16 12:45:53 UTC (rev 1432)
+++ branches/1.0/debian/varnish.default	2007-05-16 14:25:56 UTC (rev 1433)
@@ -1,44 +1,91 @@
 # Configuration file for varnish
+# 
+# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this
+# shell script fragment.
+#
 
+# This file contains 4 alternatives, please use only one.
 
-# Main configuration file. You probably want to change it :)
-VARNISH_VCL_CONF=/etc/varnish/vcl.conf
+## Alternative 1, Minimal configuration, no VCL
+#
+# Listen on localhost:6081, administration on localhost:6082, and forward to
+# content server on localhost:8080.  Use a fixed size file storage.
+#
+DAEMON_OPTS="-a localhost:6081 \
+             -T localhost:6082 \
+	     -b localhost:8080 \
+	     -s file,/var/lib/varnish/varnish_storage.bin,10485760"
 
-# Default address and port to bind to
-VARNISH_LISTEN_ADDRESS=0.0.0.0
-VARNISH_LISTEN_PORT=6081
 
+## Alternative 2, Configuration with VCL
+#
+# Listen on localhost:6081, administration on localhost:6082, and forward to
+# one content server selected by the vcl file, based on the request.  Use a
+# fixed size file storage.
+#
+# DAEMON_OPTS="-a localhost:6081 \
+#              -T localhost:6082 \
+#              -f /etc/varnish/default.vcl \
+#              -s file,/var/lib/varnish/varnish_storage.bin,10485760"
 
-# 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
+# VARNISH_LISTEN_ADDRESS=0.0.0.0
+# 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 threads to start
+# VARNISH_MIN_WORKER_THREADS=1
+# 
+# 
+# # Maximum number of worker threads or INF for unlimited
+# VARNISH_MAX_WORKER_THREADS=2048
+# 
+# 
+# # 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
+# 
+# # 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} \
+#              -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}"
+#
 
-# The minimum number of threads to start
-VARNISH_MIN_WORKER_THREADS=1
 
-
-# Maximum number of worker threads or INF for unlimited
-VARNISH_MAX_WORKER_THREADS=2048
-
-
-# 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
-
+## Alternative 4, Do It Yourself
+#
+# DAEMON_OPTS=""

Copied: branches/1.0/debian/varnish.examples (from rev 1432, trunk/varnish-cache/debian/varnish.examples)

Modified: branches/1.0/debian/varnish.init
===================================================================
--- branches/1.0/debian/varnish.init	2007-05-16 12:45:53 UTC (rev 1432)
+++ branches/1.0/debian/varnish.init	2007-05-16 14:25:56 UTC (rev 1433)
@@ -1,34 +1,28 @@
 #! /bin/sh
 #
-# skeleton      example file to build /etc/init.d/ scripts.
-#               This file should be used to construct scripts for /etc/init.d.
-#
-#               Written by Miquel van Smoorenburg <miquels at cistron.nl>.
-#               Modified for Debian 
-#               by Ian Murdock <imurdock at gnu.ai.mit.edu>.
-#
-# Version:      @(#)skeleton  1.9  26-Feb-2001  miquels at cistron.nl
-#
+# varnish       Control the varnish HTTP accelerator
 
 ### BEGIN INIT INFO
 # Provides:          varnish
 # Required-Start:    $local_fs $network
 # Required-Stop:     $local_fs $network
-# Should-Start:      $remote_fs
-# Should-Stop:       $remote_fs
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
-# Short-Description: Start HTTPd accelerator
+# Short-Description: Start HTTP accelerator
 # Description:       This script provides a server-side cache
 #                    to be run in front of a httpd and should
-#		     listen on port 80 on a properly configured
+#                    listen on port 80 on a properly configured
 #                    system
 ### END INIT INFO
 
-NAME=varnish
-DESC="HTTPd accelerator"
+# Source function library
+. /lib/lsb/init-functions
+
+NAME=varnishd
+DESC="HTTP accelerator"
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/sbin/varnishd
+PIDFILE=/var/run/$NAME.pid
 
 test -x $DAEMON || exit 0
 
@@ -37,46 +31,45 @@
         . /etc/default/varnish
 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}"	
+# If $DAEMON_OPTS is not set at all in /etc/default/varnish, use minimal useful
+# defaults (Backend at localhost:8080, a common place to put a locally
+# installed application server.)
+DAEMON_OPTS=${DAEMON_OPTS:--b localhost}
 
-set -e
-
 case "$1" in
-  start)
-        echo -n "Starting $DESC: "
-        start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
-                --exec $DAEMON -- $DAEMON_OPTS 2>&1 > /dev/null
-        echo "$NAME."
+	start)
+		output=$(/bin/tempfile -s.varnish)
+		log_daemon_msg "Starting $DESC" 
+		log_progress_msg $NAME
+                if start-stop-daemon \
+		   --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- \
+                   -P ${PIDFILE} ${DAEMON_OPTS} > ${output} 2>&1; then
+			log_end_msg 0
+		else
+			log_end_msg 1
+			cat $output
+		fi
+		rm $output
+		;;
+	stop)
+		log_daemon_msg "Stopping $DESC"
+		log_progress_msg $NAME
+		if start-stop-daemon \
+		   --stop --quiet --pidfile $PIDFILE --oknodo --retry 10 \
+		   --exec $DAEMON; then
+			log_end_msg 0
+		else
+			log_end_msg 1
+		fi
+        	;;
+	restart|force-reload)
+		$0 stop
+		$0 start
+        	;;
+	*)
+        	log_success_msg "Usage: $0 {start|stop|restart|force-reload}"
+        	exit 1
         ;;
-  stop)
-        echo -n "Stopping $DESC: "
-		pkill varnishd
-        echo "$NAME."
-        ;;
-  restart|force-reload)
-        #
-        #       If the "reload" option is implemented, move the "force-reload"
-        #       option to the "reload" entry above. If not, "force-reload" is
-        #       just the same as "restart".
-        #
-        echo -n "Restarting $DESC: "
-                pkill varnishd
-        sleep 1
-		start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
-		--exec $DAEMON -- $DAEMON_OPTS 2>&1 > /dev/null
-        echo "$NAME."
-        ;;
-  *)
-        N=/etc/init.d/$NAME
-        echo "Usage: $N {start|stop|restart|force-reload}" >&2
-        exit 1
-        ;;
 esac
 
 exit 0

Copied: branches/1.0/debian/varnish.postrm (from rev 1432, trunk/varnish-cache/debian/varnish.postrm)

Deleted: branches/1.0/debian/vcl.conf
===================================================================
--- branches/1.0/debian/vcl.conf	2007-05-16 12:45:53 UTC (rev 1432)
+++ branches/1.0/debian/vcl.conf	2007-05-16 14:25:56 UTC (rev 1433)
@@ -1,27 +0,0 @@
-# This is a basic vcl.conf file for varnish.
-# Modifying this file should be where you store your modifications to
-# varnish. Settnigs here will override defaults.
-
-backend default {
-        set backend.host = "127.0.0.1";
-        set backend.port = "80";       
-}
-
-sub vcl_recv {
-        if (req.request == "POST") {
-                pipe;
-        }
-
-        # force lookup even when cookies are present
-        if (req.request == "GET" && req.http.cookie) {
-                lookup;
-        }
-}
-
-sub vcl_fetch {
-        # force minimum ttl of 180 seconds
-        if (obj.ttl < 180s) {
-                set obj.ttl = 180s;
-        }
-}
-

Deleted: branches/1.0/etc/vcl.conf
===================================================================
--- branches/1.0/etc/vcl.conf	2007-05-16 12:45:53 UTC (rev 1432)
+++ branches/1.0/etc/vcl.conf	2007-05-16 14:25:56 UTC (rev 1433)
@@ -1,31 +0,0 @@
-#
-# This is a basic VCL configuration file for varnish.  See the vcl(7)
-# man page for details on VCL syntax and semantics.
-#
-# $Id$
-#
-
-backend default {
-        set backend.host = "127.0.0.1";
-        set backend.port = "8080";
-}
-
-sub vcl_recv {
-	# pass mode can't handle POST (yet)
-        if (req.request == "POST") {
-                pipe;
-        }
-
-        # force lookup even when cookies are present
-        if (req.request == "GET" && req.http.cookie) {
-                lookup;
-        }
-}
-
-sub vcl_fetch {
-        # force minimum ttl of 180 seconds
-        if (obj.ttl < 180s) {
-                set obj.ttl = 180s;
-        }
-}
-

Copied: branches/1.0/etc/zope-plone.vcl (from rev 1432, trunk/varnish-cache/etc/zope-plone.vcl)




More information about the varnish-commit mailing list