diff options
author | root <root@rshg054.dnsready.net> | 2012-08-16 00:02:36 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2012-08-16 00:02:36 +0000 |
commit | 0fc1870f2eadde8cb06004be1cbe8d1a4333aa69 (patch) | |
tree | 09ae142c72b3ef3bba14bcd0fbd982446585d894 /extra/varnish | |
parent | 8f1eb849d6de0031d4d91fb6d8780828b1ba924b (diff) |
Thu Aug 16 00:02:36 UTC 2012
Diffstat (limited to 'extra/varnish')
-rw-r--r-- | extra/varnish/PKGBUILD | 31 | ||||
-rw-r--r-- | extra/varnish/rc.varnish | 26 | ||||
-rw-r--r-- | extra/varnish/varnish-vcl-reload | 21 | ||||
-rw-r--r-- | extra/varnish/varnish.service | 10 |
4 files changed, 54 insertions, 34 deletions
diff --git a/extra/varnish/PKGBUILD b/extra/varnish/PKGBUILD index 4f7f1b42d..89e9a668e 100644 --- a/extra/varnish/PKGBUILD +++ b/extra/varnish/PKGBUILD @@ -1,4 +1,4 @@ -# $Id: PKGBUILD 149976 2012-02-11 23:31:36Z allan $ +# $Id: PKGBUILD 165295 2012-08-15 00:30:47Z dreisner $ # Maintainer: Dave Reisner <dreisner@archlinux.org> # Contributor: Jaroslav Lichtblau <dragonlord@aur.archlinux.org> # Contributor: Douglas Soares de Andrade @@ -6,7 +6,7 @@ pkgname=varnish pkgver=3.0.2 -pkgrel=5 +pkgrel=6 pkgdesc="High-performance HTTP accelerator" arch=('i686' 'x86_64') url="http://www.varnish-cache.org/" @@ -18,13 +18,17 @@ install=$pkgname.install options=('!libtool') source=("http://repo.varnish-cache.org/source/$pkgname-$pkgver.tar.gz" "$pkgname.conf.d" - "rc.$pkgname") + "rc.$pkgname" + varnish-vcl-reload + varnish.service) md5sums=('c8eae0aabbe66b6daabdf3a1f58cd47a' 'edd1237d097d72173d9772754335890c' - '8366f51568c0bbb3d3891aa0cc724369') + '40b4c83b3ad225ed2f4bd7e677fe41a2' + '56be884f43b8b4c900a073d9282f124a' + '45cc1fd57aa2ffc22d6af62f9eedc842') build() { - cd "$srcdir/$pkgname-$pkgver" + cd "$pkgname-$pkgver" ./configure \ --prefix=/usr \ @@ -35,11 +39,18 @@ build() { } package() { - cd "$srcdir/$pkgname-$pkgver" + make -C "$pkgname-$pkgver" DESTDIR="$pkgdir" install - make DESTDIR="$pkgdir" install + # reload helper + install -m755 "$srcdir/varnish-vcl-reload" "$pkgdir/usr/bin" - install -D -m755 "$srcdir/rc.$pkgname" "$pkgdir/etc/rc.d/$pkgname" - install -D -m644 "$srcdir/$pkgname.conf.d" "$pkgdir/etc/conf.d/$pkgname" - install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + # sysvinit + install -Dm755 "$srcdir/rc.$pkgname" "$pkgdir/etc/rc.d/$pkgname" + install -Dm644 "$srcdir/$pkgname.conf.d" "$pkgdir/etc/conf.d/$pkgname" + + # systemd + install -Dm644 "$srcdir/$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service" + + # license + install -Dm644 "$pkgname-$pkgver/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } diff --git a/extra/varnish/rc.varnish b/extra/varnish/rc.varnish index 2841665e5..352f07dbd 100644 --- a/extra/varnish/rc.varnish +++ b/extra/varnish/rc.varnish @@ -4,27 +4,6 @@ . /etc/rc.d/functions . /etc/conf.d/varnish -reload_vcl() { - local activecfg newcfg - - if [[ -z $VARNISH_CFG ]]; then - printf '==> ERROR: VARNISH_CFG is undefined in /etc/conf.d/varnish!\n' - return 1 - fi - - activecfg=$(varnishadm 'vcl.list' | awk '/active/ { print $3 }') - if [[ -z $activecfg ]]; then - printf '==> ERROR: No active VCL found!\n' - return 1 - fi - - printf -v newcfg 'vcl-%(%s)T' -1 - - varnishadm "vcl.load $newcfg $VARNISH_CFG" && - varnishadm "vcl.use $newcfg" && - varnishadm "vcl.discard $activecfg" || return 1 -} - pidfile=/run/varnish.pid if [[ -r $pidfile ]]; then read -r PID < "$pidfile" @@ -62,10 +41,9 @@ case $1 in $0 start ;; reload) - stat_busy "Recompiling and Reloading VCL" - reload_vcl && stat_done || stat_fail + status "Recompiling and Reloading VCL" varnish-vcl-reload $VARNISH_CFG ;; *) - echo "usage: $0 {start|stop|restart}" + echo "usage: $0 {start|stop|restart|reload}" ;; esac diff --git a/extra/varnish/varnish-vcl-reload b/extra/varnish/varnish-vcl-reload new file mode 100644 index 000000000..aaac385c4 --- /dev/null +++ b/extra/varnish/varnish-vcl-reload @@ -0,0 +1,21 @@ +#!/bin/sh + +cfg=${1:-/etc/varnish/default.vcl} + +if [ ! -e "$cfg" ]; then + printf 'ERROR: VCL file %s does not exist\n' "$cfg" >&2 + exit 1 +fi + +activecfg=$(varnishadm 'vcl.list' | awk '/active/ { print $3 }') +if [ -z "$activecfg" ]; then + printf 'ERROR: No active VCL found!\n' >&2 + exit 1 +fi + +newcfg=$(date +'vcl-%s') +printf 'INFO: using new config %s\n' "$cfg" + +varnishadm "vcl.load $newcfg $cfg" && +varnishadm "vcl.use $newcfg" && +varnishadm "vcl.discard $activecfg" diff --git a/extra/varnish/varnish.service b/extra/varnish/varnish.service new file mode 100644 index 000000000..c8bb6c6e1 --- /dev/null +++ b/extra/varnish/varnish.service @@ -0,0 +1,10 @@ +[Unit] +Description=Web Application Accelerator +After=network.target + +[Service] +ExecStart=/usr/sbin/varnishd -a 0.0.0.0:80 -b localhost:8080 -T localhost:6082 -s malloc,64M -u nobody -g nobody -F +ExecReload=/usr/bin/varnish-vcl-reload + +[Install] +WantedBy=multi-user.target |