Commit 3edc47d3 authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

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.
........


git-svn-id: http://www.varnish-cache.org/svn/branches/1.0@1433 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent af3ec6d7
# $Id$
SUBDIRS = include lib bin man
SUBDIRS = include lib bin man etc
EXTRA_DIST = LICENSE autogen.sh debian redhat
......@@ -28,7 +28,7 @@
.\"
.\" $Id$
.\"
.Dd May 14, 2007
.Dd May 16, 2007
.Dt VARNISHD 1
.Os
.Sh NAME
......@@ -180,6 +180,8 @@ A simple doubly-linked list.
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 @@ Storage for each object is allocated with
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 default is
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
......
# $Id: Makefile.am 133 2006-04-06 09:38:00Z phk $
# $Id$
INCLUDES = -I$(top_srcdir)/include
......
# $Id: Makefile.am 347 2006-07-06 09:31:45Z des $
# $Id$
INCLUDES = -I$(top_srcdir)/include
......
......@@ -130,6 +130,7 @@ AC_CONFIG_FILES([
bin/varnishncsa/Makefile
bin/varnishstat/Makefile
bin/varnishtop/Makefile
etc/Makefile
include/Makefile
lib/Makefile
lib/libcompat/Makefile
......
......@@ -67,7 +67,7 @@ install: build
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 @@ binary-arch: build install
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
......
# Configuration file for varnish
# Main configuration file. You probably want to change it :)
VARNISH_VCL_CONF=/etc/varnish/vcl.conf
# 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
#
# /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.
## 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"
## 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"
## 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}"
#
## Alternative 4, Do It Yourself
#
# DAEMON_OPTS=""
etc/zope-plone.vcl
#! /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@cistron.nl>.
# Modified for Debian
# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@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,45 +31,44 @@ if [ -f /etc/default/varnish ] ; then
. /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}"
set -e
# 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}
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."
;;
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
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
;;
esac
......
......@@ -3,9 +3,12 @@
set -e
case "$1" in
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
upgrade)
;;
if test -e /var/log/varnish && ! [ "$1" = upgrade ]; then
remove|failed-upgrade|abort-install|abort-upgrade|disappear)
if test -e /var/log/varnish ; then
rm -rf /var/log/varnish 2>&1 > /dev/null || exit 78
......
# 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;
}
}
#
# 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;
}
}
#
# This is a basic VCL configuration file for varnish. See the vcl(7)
# man page for details on VCL syntax and semantics.
#
# $Id: default.vcl 1424 2007-05-15 19:38:56Z des $
#
# Default backend definition. Set this to point to your content
# server.
backend default {
set backend.host = "127.0.0.1";
set backend.port = "9673";
}
acl purge {
"localhost";
"192.0.2.0"/24;
}
sub vcl_recv {
if (req.request != "GET" && req.request != "HEAD") {
pipe;
}
if (req.http.Expect) {
pipe;
}
if (req.http.Authenticate) {
pass;
}
# We only care about the "__ac.*" cookies, used for authentication
if (req.http.Cookie && req.http.Cookie ~ "__ac(|_(name|password|persistent))=") {
pass;
}
# PURGE request if zope asks nicely
if (req.request == "PURGE") {
if (!client.ip ~ purge) {
error 405 "Not allowed.";
}
lookup;
}
lookup;
}
# Do the PURGE thing
sub vcl_hit {
if (req.request == "PURGE") {
set obj.ttl = 0s;
error 200 "Purged";
}
}
sub vcl_miss {
if (req.request == "PURGE") {
error 404 "Not in cache";
}
}
# Enforce a minimum TTL, since we PURGE changed objects actively from Zope.
sub vcl_fetch {
if (obj.ttl < 3600s) {
set obj.ttl = 3600s;
}
}
# Below is a commented-out copy of the default VCL logic. If you
# redefine any of these subroutines, the built-in logic will be
# appended to your code.
## Called when a client request is received
#
#sub vcl_recv {
# if (req.request != "GET" && req.request != "HEAD") {
# pipe;
# }
# if (req.http.Expect) {
# pipe;
# }
# if (req.http.Authenticate || req.http.Cookie) {
# pass;
# }
# lookup;
#}
#
## Called when entering pipe mode
#
#sub vcl_pipe {
# pipe;
#}
#
## Called when entering pass mode
#
#sub vcl_pass {
# pass;
#}
#
## Called when entering an object into the cache
#
#sub vcl_hash {
# hash;
#}
#
## Called when the requested object was found in the cache
#
#sub vcl_hit {
# if (!obj.cacheable) {
# pass;
# }
# deliver;
#}
#
## Called when the requested object was not found in the cache
#
#sub vcl_miss {
# fetch;
#}
#
## Called when the requested object has been retrieved from the
## backend, or the request to the backend has failed
#
#sub vcl_fetch {
# if (!obj.valid) {
# error;
# }
# if (!obj.cacheable) {
# pass;
# }
# if (resp.http.Set-Cookie) {
# pass;
# }
# insert;
#}
#
## Called when an object nears its expiry time
#
#sub vcl_timeout {
# discard;
#}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment