summaryrefslogtreecommitdiffstats
path: root/main/varnish
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-08-21 14:35:28 +0300
committerTimo Teräs <timo.teras@iki.fi>2012-08-21 14:36:58 +0300
commiteb55626bb2ba19f3ae9911a82709dc9c994c8389 (patch)
treefa59321d1c6e1b4ae90ad73c848b5b9fe55a2171 /main/varnish
parentfd5b60a8060f5116f5778db9c199ec54a423fc51 (diff)
downloadaports-eb55626bb2ba19f3ae9911a82709dc9c994c8389.tar.bz2
aports-eb55626bb2ba19f3ae9911a82709dc9c994c8389.tar.xz
main/varnish: fix varnishd.initd reload, add flush
* vcl.use does not take config file name * discard old, no longer used configs * add flush command to purge cache using appropriate ban
Diffstat (limited to 'main/varnish')
-rw-r--r--main/varnish/APKBUILD6
-rw-r--r--main/varnish/varnishd.confd2
-rwxr-xr-xmain/varnish/varnishd.initd28
3 files changed, 26 insertions, 10 deletions
diff --git a/main/varnish/APKBUILD b/main/varnish/APKBUILD
index 2e526d8ce..e2236b1bd 100644
--- a/main/varnish/APKBUILD
+++ b/main/varnish/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=varnish
pkgver=3.0.2
-pkgrel=6
+pkgrel=7
pkgdesc="High-performance HTTP accelerator"
url="http://www.varnish-cache.org/"
arch="all"
@@ -60,6 +60,6 @@ libs() {
}
md5sums="c8eae0aabbe66b6daabdf3a1f58cd47a varnish-3.0.2.tar.gz
-7f80c6e44d9c8665478f3e500c5768ab varnishd.initd
-69869d23bacd4e3aaf060d1fedb79ac6 varnishd.confd
+4f78964bf3eb6f1fd0fd2d533575982e varnishd.initd
+6dd289ba81464eacc238109143126d6a varnishd.confd
a6cb8a43c9465699cf956dc992998225 varnishd.logrotate"
diff --git a/main/varnish/varnishd.confd b/main/varnish/varnishd.confd
index ebce5948c..1b46706c2 100644
--- a/main/varnish/varnishd.confd
+++ b/main/varnish/varnishd.confd
@@ -5,7 +5,7 @@ CFG_FILE="/etc/varnish/default.vcl"
# options passed to varnish on startup
# please see the varnishd man page for more options
-VARNISHD_OPTS="-a 127.0.0.1:8080 -b 127.0.0.1:80 -T $ADMINHOSTPORT"
+VARNISHD_OPTS="-a 127.0.0.1:8080 -T $ADMINHOSTPORT -f $CFG_FILE"
# arguments passed to varnishncsa
# please see the varnishncsa man page for more options
diff --git a/main/varnish/varnishd.initd b/main/varnish/varnishd.initd
index a10e219a8..b8c565317 100755
--- a/main/varnish/varnishd.initd
+++ b/main/varnish/varnishd.initd
@@ -3,7 +3,7 @@
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/files/varnishd.initd,v 1.7 2009/08/30 06:28:07 hollow Exp $
-extra_commands=reload
+extra_commands="reload flush"
depend() {
need net
@@ -36,9 +36,25 @@ stop() {
}
reload() {
- ebegin "Reloading varnish"
- NOW=`date +%s`
- /usr/bin/varnishadm -T $ADMINHOSTPORT vcl.load reload$NOW $CFG_FILE
- /usr/bin/varnishadm -T $ADMINHOSTPORT vcl.use reload$NOW $CFG_FILE
- eend $?
+ ebegin "Reloading varnish"
+
+ # purge unused old configurations
+ DISCARDS=$(/usr/bin/varnishadm -T $ADMINHOSTPORT vcl.list |
+ sed -ne "s/^available *0 *\(reload.*\)/ \\1/p")
+ for VCL in $DISCARDS ; do
+ /usr/bin/varnishadm -T $ADMINHOSTPORT vcl.discard $VCL > /dev/null
+ done
+
+ # reload new one
+ NOW=$(date +%Y%m%d-%H%M%S-%s)
+ /usr/bin/varnishadm -T $ADMINHOSTPORT vcl.load reload-$NOW $CFG_FILE > /dev/null
+ /usr/bin/varnishadm -T $ADMINHOSTPORT vcl.use reload-$NOW > /dev/null
+
+ eend $?
+}
+
+flush() {
+ ebegin "Flushing varnish cache"
+ /usr/bin/varnishadm -T $ADMINHOSTPORT ban obj.http.host "~" "." > /dev/null
+ eend $?
}