diff --git a/varnish.add_varnish_vcl_reload.patch b/varnish.add_varnish_vcl_reload.patch new file mode 100644 index 0000000..18f6c94 --- /dev/null +++ b/varnish.add_varnish_vcl_reload.patch @@ -0,0 +1,277 @@ +diff -Naur ../varnish-2.1.4/redhat/varnish.initrc ./redhat/varnish.initrc +--- ../varnish-2.1.4/redhat/varnish.initrc 2010-11-04 13:57:41.208455907 +0100 ++++ ./redhat/varnish.initrc 2010-11-04 14:00:14.516330982 +0100 +@@ -1,6 +1,6 @@ + #! /bin/sh + # +-# varnish Control the varnish HTTP accelerator ++# varnish Control the Varnish Cache + # + # chkconfig: - 90 10 + # description: Varnish is a high-perfomance HTTP accelerator +@@ -26,6 +26,7 @@ + pidfile=/var/run/varnish.pid + + exec="/usr/sbin/varnishd" ++reload_exec="/usr/bin/varnish_reload_vcl" + prog="varnishd" + config="/etc/sysconfig/varnish" + lockfile="/var/lock/subsys/varnish" +@@ -47,7 +48,7 @@ + echo $config not found + exit 6 + fi +- echo -n "Starting varnish HTTP accelerator: " ++ echo -n "Starting Varnish Cache: " + + # Open files (usually 1024, which is way too small for varnish) + ulimit -n ${NFILES:-131072} +@@ -79,7 +80,7 @@ + } + + stop() { +- echo -n "Stopping varnish HTTP accelerator: " ++ echo -n "Stopping Varnish Cache: " + killproc -p $pidfile $prog + retval=$? + echo +@@ -93,7 +94,12 @@ + } + + reload() { +- restart ++ if [ "$RELOAD_VCL" = "1" ] ++ then ++ $reload_exec ++ else ++ force_reload ++ fi + } + + force_reload() { +diff -Naur ../varnish-2.1.4/redhat/varnish_reload_vcl ./redhat/varnish_reload_vcl +--- ../varnish-2.1.4/redhat/varnish_reload_vcl 1970-01-01 01:00:00.000000000 +0100 ++++ ./redhat/varnish_reload_vcl 2010-11-04 13:58:14.708330664 +0100 +@@ -0,0 +1,114 @@ ++#!/bin/bash ++# ++# reload vcl revisited ++# A script that loads new vcl based on data from /etc/sysconfig/varnish ++# Ingvar Hagelund ++# ++# This is free software, distributed under the standard 2 clause BSD license, ++# see the LICENSE file in the Varnish documentation directory ++# ++# The following environment variables have to be set: ++# RELOAD_VCL, VARNISH_VCL_CONF, VARNISH_ADMIN_LISTEN_PORT ++# The following are optional: ++# VARNISH_SECRET_FILE, VARNISH_ADMIN_LISTEN_ADDRESS ++# ++# Requires GNU bash and GNU date ++# ++ ++debug=false ++ ++missing() { ++ echo "Missing configuration variable: $1" ++ exit 2 ++} ++ ++print_debug() { ++ echo " ++Parsed configuration: ++RELOAD_VCL=\"$RELOAD_VCL\" ++VARNISH_VCL_CONF=\"$VARNISH_VCL_CONF\" ++VARNISH_ADMIN_LISTEN_ADDRESS=\"$VARNISH_ADMIN_LISTEN_ADDRESS\" ++VARNISH_ADMIN_LISTEN_PORT=\"$VARNISH_ADMIN_LISTEN_PORT\" ++VARNISH_SECRET_FILE=\"$VARNISH_SECRET_FILE\" ++" ++} ++ ++# Read configuration ++. /etc/sysconfig/varnish ++ ++$debug && print_debug ++ ++# Check configuration ++if [ ! "$RELOAD_VCL" = "1" ]; then ++ echo "Error: RELOAD_VCL is not set to 1" ++ exit 2 ++ ++elif [ -z "$VARNISH_VCL_CONF" ]; then ++ echo "Error: VARNISH_VCL_CONF is not set" ++ exit 2 ++ ++elif [ ! -s "$VARNISH_VCL_CONF" ]; then ++ echo "Eror: VCL config $VARNISH_VCL_CONF is unreadable or empty" ++ exit 2 ++ ++elif [ -z "$VARNISH_ADMIN_LISTEN_ADDRESS" ]; then ++ echo "Warning: VARNISH_ADMIN_LISTEN_ADDRESS is not set, using 127.0.0.1" ++ VARNISH_ADMIN_LISTEN_ADDRESS="127.0.0.1" ++ ++elif [ -z "$VARNISH_ADMIN_LISTEN_PORT" ]; then ++ echo "Error: VARNISH_ADMIN_LISTEN_PORT is not set" ++ exit 2 ++ ++elif [ -z "$VARNISH_SECRET_FILE" ]; then ++ echo "Warning: VARNISH_SECRET_FILE is not set" ++ secret="" ++ ++elif [ ! -s "$VARNISH_SECRET_FILE" ]; then ++ echo "Error: varnish secret file $VARNISH_SECRET_FILE is unreadable or empty" ++ exit 2 ++else ++ secret="-S $VARNISH_SECRET_FILE" ++fi ++ ++# Done parsing, set up command ++VARNISHADM="varnishadm $secret -T $VARNISH_ADMIN_LISTEN_ADDRESS:$VARNISH_ADMIN_LISTEN_PORT" ++ ++# Now do the real work ++new_config="reload_$(date +%FT%H:%M:%S)" ++ ++# Check if we are able to connect at all ++if $VARNISHADM vcl.list > /dev/null; then ++ $debug && echo vcl.list succeeded ++else ++ echo "Unable to run $VARNISHADM vcl.list" ++ exit 1 ++fi ++ ++if $VARNISHADM vcl.list | awk ' { print $3 } ' | grep -q $new_config; then ++ echo Trying to use new config $new_config, but that is already in use ++ exit 2 ++fi ++ ++current_config=$( $VARNISHADM vcl.list | awk ' /^active/ { print $3 } ' ) ++ ++echo "Loading vcl from $VARNISH_VCL_CONF" ++echo "Current running config name is $current_config" ++echo "Using new config name $new_config" ++ ++if $VARNISHADM vcl.load $new_config $VARNISH_VCL_CONF; then ++ $debug && echo "$VARNISHADM vcl.load succeded" ++else ++ echo "$VARNISHADM vcl.load failed" ++ exit 1 ++fi ++ ++if $VARNISHADM vcl.use $new_config; then ++ $debug && echo "$VARNISHADM vcl.use succeded" ++else ++ echo "$VARNISHADM vcl.use failed" ++ exit 1 ++fi ++$VARNISHADM vcl.list ++echo Done ++exit 0 ++ +diff -Naur ../varnish-2.1.4/redhat/varnish.sysconfig ./redhat/varnish.sysconfig +--- ../varnish-2.1.4/redhat/varnish.sysconfig 2010-10-21 10:57:22.000000000 +0200 ++++ ./redhat/varnish.sysconfig 2010-11-04 13:59:34.293455974 +0100 +@@ -14,6 +14,13 @@ + # Maximum size of corefile (for ulimit -c). Default in Fedora is 0 + # DAEMON_COREFILE_LIMIT="unlimited" + ++# Set this to 1 to make init script reload try to switch vcl without restart. ++# To make this work, you need to set the following variables ++# explicit: VARNISH_VCL_CONF, VARNISH_ADMIN_LISTEN_ADDRESS, ++# VARNISH_ADMIN_LISTEN_PORT, VARNISH_SECRET_FILE, or in short, ++# use Alternative 3, Advanced configuration, below ++RELOAD_VCL=1 ++ + # This file contains 4 alternatives, please use only one. + + ## Alternative 1, Minimal configuration, no VCL +@@ -34,12 +41,12 @@ + # 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 \ +- -u varnish -g varnish \ +- -S /etc/varnish/secret \ +- -s file,/var/lib/varnish/varnish_storage.bin,1G" ++#DAEMON_OPTS="-a :6081 \ ++# -T localhost:6082 \ ++# -f /etc/varnish/default.vcl \ ++# -u varnish -g varnish \ ++# -S /etc/varnish/secret \ ++# -s file,/var/lib/varnish/varnish_storage.bin,1G" + + + ## Alternative 3, Advanced configuration +@@ -47,49 +54,53 @@ + # See varnishd(1) for more information. + # + # # Main configuration file. You probably want to change it :) +-# VARNISH_VCL_CONF=/etc/varnish/default.vcl ++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 ++VARNISH_LISTEN_PORT=6081 + # + # # Telnet admin interface listen address and port +-# VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 +-# VARNISH_ADMIN_LISTEN_PORT=6082 ++VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 ++VARNISH_ADMIN_LISTEN_PORT=6082 ++# ++# # Shared secret file for admin interface ++VARNISH_SECRET_FILE=/etc/varnish/secret + # + # # The minimum number of worker threads to start +-# VARNISH_MIN_THREADS=1 ++VARNISH_MIN_THREADS=1 + # + # # The Maximum number of worker threads to start +-# VARNISH_MAX_THREADS=1000 ++VARNISH_MAX_THREADS=1000 + # + # # Idle timeout for worker threads +-# VARNISH_THREAD_TIMEOUT=120 ++VARNISH_THREAD_TIMEOUT=120 + # + # # Cache file location +-# VARNISH_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin ++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 ++VARNISH_STORAGE_SIZE=1G + # + # # Backend storage specification +-# VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}" ++VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}" + # + # # Default TTL used when the backend does not specify one +-# VARNISH_TTL=120 ++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} \ +-# -u varnish -g varnish \ +-# -s ${VARNISH_STORAGE}" ++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} \ ++ -u varnish -g varnish \ ++ -S ${VARNISH_SECRET_FILE} \ ++ -s ${VARNISH_STORAGE}" + # + + diff --git a/varnish.fix_Content-Length_header.r5461.patch b/varnish.fix_Content-Length_header.r5461.patch new file mode 100644 index 0000000..1f99ac7 --- /dev/null +++ b/varnish.fix_Content-Length_header.r5461.patch @@ -0,0 +1,46 @@ +Index: bin/varnishtest/tests/r00801.vtc +=================================================================== +--- bin/varnishtest/tests/r00801.vtc (revisjon 0) ++++ bin/varnishtest/tests/r00801.vtc (revisjon 5461) +@@ -0,0 +1,24 @@ ++# $Id$ ++ ++test "Regression test for duplicate content-length in pass" ++ ++server s1 { ++ rxreq ++ txresp \ ++ -hdr "Date: Mon, 25 Oct 2010 06:34:06 GMT" \ ++ -hdr "Content-length: 10xx" \ ++ -nolen -bodylen 10 ++} -start ++ ++ ++varnish v1 -vcl+backend { ++ sub vcl_recv { return (pass); } ++} -start ++ ++client c1 { ++ txreq ++ rxresp ++ expect resp.http.content-length == "10" ++} -run ++ ++ +Index: bin/varnishd/cache_fetch.c +=================================================================== +--- bin/varnishd/cache_fetch.c (revisjon 5460) ++++ bin/varnishd/cache_fetch.c (revisjon 5461) +@@ -552,9 +552,11 @@ + assert(uu == sp->obj->len); + } + +- if (mklen > 0) ++ if (mklen > 0) { ++ http_Unset(sp->obj->http, H_Content_Length); + http_PrintfHeader(sp->wrk, sp->fd, sp->obj->http, + "Content-Length: %u", sp->obj->len); ++ } + + if (http_HdrIs(hp, H_Connection, "close")) + cls = 1; diff --git a/varnish.fix_initscript_missing_echo.r5498.patch b/varnish.fix_initscript_missing_echo.r5498.patch new file mode 100644 index 0000000..50702e9 --- /dev/null +++ b/varnish.fix_initscript_missing_echo.r5498.patch @@ -0,0 +1,12 @@ +Index: redhat/varnish.initrc +=================================================================== +--- redhat/varnish.initrc (revisjon 5498) ++++ redhat/varnish.initrc (arbeidskopi) +@@ -70,6 +70,7 @@ + echo + else + echo_failure ++ echo + fi + return $retval + fi diff --git a/varnish.fix_missing_lsb_defaults_in_initscript.r5501.patch b/varnish.fix_missing_lsb_defaults_in_initscript.r5501.patch new file mode 100644 index 0000000..0dcaeb0 --- /dev/null +++ b/varnish.fix_missing_lsb_defaults_in_initscript.r5501.patch @@ -0,0 +1,36 @@ +diff -Naur ../varnish-2.1.4/redhat/varnish.initrc ./redhat/varnish.initrc +--- ../varnish-2.1.4/redhat/varnish.initrc 2010-10-21 10:57:22.000000000 +0200 ++++ ./redhat/varnish.initrc 2010-11-03 15:20:07.663331341 +0100 +@@ -12,6 +12,8 @@ + # Provides: varnish + # Required-Start: $network $local_fs $remote_fs + # Required-Stop: $network $local_fs $remote_fs ++# Default-Start: ++# Default-Stop: + # Should-Start: $syslog + # Short-Description: start and stop varnishd + # Description: Varnish is a high-perfomance HTTP accelerator +diff -Naur ../varnish-2.1.4/redhat/varnishlog.initrc ./redhat/varnishlog.initrc +--- ../varnish-2.1.4/redhat/varnishlog.initrc 2010-10-21 10:57:22.000000000 +0200 ++++ ./redhat/varnishlog.initrc 2010-11-03 15:20:07.664330786 +0100 +@@ -12,6 +12,8 @@ + # Provides: varnishlog + # Required-Start: $network $local_fs $remote_fs + # Required-Stop: $network $local_fs $remote_fs ++# Default-Start: ++# Default-Stop: + # Short-Description: start and stop varnishlog + # Description: Varnish HTTP accelerator logging daemon + ### END INIT INFO +diff -Naur ../varnish-2.1.4/redhat/varnishncsa.initrc ./redhat/varnishncsa.initrc +--- ../varnish-2.1.4/redhat/varnishncsa.initrc 2010-10-21 10:57:22.000000000 +0200 ++++ ./redhat/varnishncsa.initrc 2010-11-03 15:20:07.664330786 +0100 +@@ -12,6 +12,8 @@ + # Provides: varnishncsa + # Required-Start: $network $local_fs $remote_fs + # Required-Stop: $network $local_fs $remote_fs ++# Default-Start: ++# Default-Stop: + # Short-Description: start and stop varnishncsa + # Description: Varnish HTTP accelerator logging daemon + ### END INIT INFO diff --git a/varnish.spec b/varnish.spec index d150b69..372212c 100644 --- a/varnish.spec +++ b/varnish.spec @@ -1,12 +1,18 @@ Summary: High-performance HTTP accelerator Name: varnish Version: 2.1.4 -Release: 3%{?dist} +Release: 4%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ Source0: http://www.varnish-software.com/sites/default/files/%{name}-%{version}.tar.gz + Patch1: varnish.s390_pagesize.patch +Patch2: varnish.fix_initscript_missing_echo.r5498.patch +Patch3: varnish.fix_Content-Length_header.r5461.patch +Patch4: varnish.fix_missing_lsb_defaults_in_initscript.r5501.patch +Patch5: varnish.add_varnish_vcl_reload.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # The svn sources needs autoconf, automake and libtool to generate a suitable # configure script. Release tarballs would not need this @@ -27,9 +33,9 @@ Requires(preun): initscripts Requires: gcc %description -This is the Varnish high-performance HTTP accelerator. Documentation -wiki and additional information about Varnish is available on the following -web site: http://www.varnish-cache.org/ +This is Varnish Cache, a high-performance HTTP accelerator. +Documentation wiki and additional information about Varnish is +available on the following web site: http://www.varnish-cache.org/ %package libs Summary: Libraries for %{name} @@ -39,7 +45,7 @@ BuildRequires: ncurses-devel %description libs Libraries for %{name}. -Varnish is a high-performance HTTP accelerator. +Varnish Cache is a high-performance HTTP accelerator %package libs-devel Summary: Development files for %{name}-libs @@ -49,7 +55,7 @@ Requires: varnish-libs = %{version}-%{release} %description libs-devel Development files for %{name}-libs -Varnish is a high-performance HTTP accelerator +Varnish Cache is a high-performance HTTP accelerator %package docs Summary: Documentation files for %name @@ -66,13 +72,17 @@ Documentation files for %name # #%description libs-static #Files for static linking of varnish library functions -#Varnish is a high-performance HTTP accelerator +#Varnish Cache is a high-performance HTTP accelerator %prep %setup -q #%setup -q -n varnish-cache %patch1 +%patch2 +%patch3 +%patch4 +%patch5 # The svn sources needs to generate a suitable configure script # Release tarballs would not need this @@ -109,9 +119,7 @@ cp bin/varnishd/default.vcl etc/zope-plone.vcl examples %endif # Remove "--disable static" if you want to build static libraries -# jemalloc is not compatible with Red Hat's ppc RHEL kernel koji server :-( -# Fedora users running varnish on ppc with a fedora kernel might want to try -# to build with jemalloc. +# jemalloc is not compatible with Red Hat's ppc64 RHEL kernel :-( %ifarch ppc64 ppc %configure --disable-static --localstatedir=/var/lib --disable-jemalloc %else @@ -186,6 +194,7 @@ mkdir -p %{buildroot}/var/run/varnish %{__install} -D -m 0755 redhat/varnish.initrc %{buildroot}%{_initrddir}/varnish %{__install} -D -m 0755 redhat/varnishlog.initrc %{buildroot}%{_initrddir}/varnishlog %{__install} -D -m 0755 redhat/varnishncsa.initrc %{buildroot}%{_initrddir}/varnishncsa +%{__install} -D -m 0755 redhat/varnish_reload_vcl %{buildroot}%{_bindir}/varnish_reload_vcl %clean rm -rf %{buildroot} @@ -215,10 +224,7 @@ rm -rf %{buildroot} %files libs-devel %defattr(-,root,root,-) -%{_libdir}/libvarnish.so -%{_libdir}/libvarnishapi.so -%{_libdir}/libvarnishcompat.so -%{_libdir}/libvcl.so +%{_libdir}/lib*.so %dir %{_includedir}/varnish %{_includedir}/varnish/* %{_libdir}/pkgconfig/varnishapi.pc @@ -242,7 +248,7 @@ rm -rf %{buildroot} getent group varnish >/dev/null || groupadd -r varnish getent passwd varnish >/dev/null || \ useradd -r -g varnish -d /var/lib/varnish -s /sbin/nologin \ - -c "Varnish http accelerator user" varnish + -c "Varnish Cache" varnish exit 0 %post @@ -266,6 +272,16 @@ fi %postun libs -p /sbin/ldconfig %changelog +* Wed Nov 04 2010 Ingvar Hagelund - 2.1.4-4 +- Added a patch fixing a missing echo in the init script that + masked failure output from the script +- Added a patch from upstream, fixing a problem with Content-Length + headers (upstream r5461, upstream bug #801) +- Added a patch from upstream, adding empty Default-Start and Default-Stop + to initscripts for better lsb compliance +- Added varnish_reload_vcl from trunk +- Synced descriptions from release spec + * Thu Oct 28 2010 Ingvar Hagelund - 2.1.4-3 - Fixed missing manpages because of no rst2man in rhel4 and 5