From: bahner Date: Thu, 12 Oct 2006 16:56:54 +0000 (+0000) Subject: Added init-scripts and configuration files for Debian. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c3480800ab132a8920bb7669c344b548880ffc9;p=varnish Added init-scripts and configuration files for Debian. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1150 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/debian/README.Debian b/varnish-cache/debian/README.Debian new file mode 100644 index 00000000..b2e8ab70 --- /dev/null +++ b/varnish-cache/debian/README.Debian @@ -0,0 +1,25 @@ +GCC +=== +Varnish requires a GCC-compiler compatible with the compiler used to +build varnish with. This means GCC 4.1 on a standard Debian 4.0 system. + +Io. to be able to backport varnish however, I will remove the +dependency on version 4.1 of the compiler and just require gcc, as +varnish should work fine with GCC 3.3 and above. + + +Standard ports +============== + +I have configured varnish to simply put up an accelerator on port 6081 +pointing request at the local webserver. Varnish can then be +administered via port 6082. You probably want to change these ;) + +Of course to gain actual value from installing varnish, you want to move +varnishes listening port to port 80, and your webserver to 8080 or +something. + +By setting varnish on port 6081 by default you will be able to take it +for a spin right-out-of-the-box(tm). + +2006-10-12 Lars Bahner diff --git a/varnish-cache/debian/TODO b/varnish-cache/debian/TODO index ff0094c7..f3fd3265 100644 --- a/varnish-cache/debian/TODO +++ b/varnish-cache/debian/TODO @@ -1 +1 @@ -Init-scripts and config files are missing. +dd the backing file, if wanted. diff --git a/varnish-cache/debian/changelog b/varnish-cache/debian/changelog index 9cf7fe19..b74f0f65 100644 --- a/varnish-cache/debian/changelog +++ b/varnish-cache/debian/changelog @@ -1,3 +1,11 @@ +varnish (1.0.2-1~svn20061012) unstable; urgency=low + + * Added README for Debian + * svn-based source + * Added target to create configure to build from pristine source + + -- Lars Bahner Thu, 12 Oct 2006 15:42:04 +0200 + varnish (1.0.1-3) unstable; urgency=low * Bumped automake dependency to automake1.9 diff --git a/varnish-cache/debian/control b/varnish-cache/debian/control index 26235b1c..2f9c20a9 100644 --- a/varnish-cache/debian/control +++ b/varnish-cache/debian/control @@ -3,7 +3,7 @@ Section: web Priority: optional Maintainer: Stig Sandbeck Mathiesen Uploaders: Lars Bahner -Build-Depends: debhelper (>= 5), autotools-dev, automake1.9, libtool, autoconf, gcc (>= 4.1) +Build-Depends: debhelper (>= 5), autotools-dev, automake1.9, libtool, autoconf, gcc Standards-Version: 3.7.2 Package: varnish diff --git a/varnish-cache/debian/dirs b/varnish-cache/debian/dirs index ca882bbb..117bc70b 100644 --- a/varnish-cache/debian/dirs +++ b/varnish-cache/debian/dirs @@ -1,2 +1,6 @@ +etc/varnish usr/bin +usr/lib usr/sbin +var/log +var/spool/varnish diff --git a/varnish-cache/debian/rules b/varnish-cache/debian/rules index 15092a7f..ba19fe4c 100755 --- a/varnish-cache/debian/rules +++ b/varnish-cache/debian/rules @@ -24,9 +24,14 @@ else CFLAGS += -O2 endif +configure: + ./autogen.sh + config.status: configure dh_testdir # The boilerplate linker flags won't allow varnish to compile :( + # There are circular dependencies in the varnish libraries, but + # the core developers have OK'ed that we don't check. ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" @@ -36,7 +41,6 @@ build-stamp: config.status dh_testdir $(MAKE) - #docbook-to-man debian/varnish.sgml > varnish.1 touch $@ @@ -45,7 +49,6 @@ clean: dh_testroot rm -f build-stamp - # Add here commands to clean up after the build process. -$(MAKE) distclean ifneq "$(wildcard /usr/share/misc/config.sub)" "" cp -f /usr/share/misc/config.sub config.sub @@ -63,8 +66,8 @@ install: build dh_clean -k dh_installdirs - # Add here commands to install the package into debian/varnish. $(MAKE) install DESTDIR=$(CURDIR)/debian/varnish + install -m 644 $(CURDIR)/debian/vcl.conf $(CURDIR)/debian/varnish/etc/varnish/ # Build architecture-independent files here. @@ -77,7 +80,8 @@ binary-arch: build install dh_testroot dh_installchangelogs ChangeLog dh_installdocs -#FIXME dh_installinit + # Since varnish looses its cache on restart - we don't. + dh_installinit -r dh_installman dh_link dh_strip diff --git a/varnish-cache/debian/varnish.default b/varnish-cache/debian/varnish.default new file mode 100644 index 00000000..fddb49ec --- /dev/null +++ b/varnish-cache/debian/varnish.default @@ -0,0 +1,44 @@ +# 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=INF + + +# 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/spool/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 + diff --git a/varnish-cache/debian/varnish.init b/varnish-cache/debian/varnish.init new file mode 100644 index 00000000..ee7b8bc2 --- /dev/null +++ b/varnish-cache/debian/varnish.init @@ -0,0 +1,67 @@ +#! /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 . +# Modified for Debian +# by Ian Murdock . +# +# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl +# + +NAME=varnish +DESC="HTTPd accelerator" +PATH=/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/varnishd + +test -x $DAEMON || exit 0 + +# Include varnish defaults if available +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 + +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 + ;; +esac + +exit 0 diff --git a/varnish-cache/debian/vcl.conf b/varnish-cache/debian/vcl.conf new file mode 100644 index 00000000..495f1763 --- /dev/null +++ b/varnish-cache/debian/vcl.conf @@ -0,0 +1,27 @@ +# 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; + } +} +