summaryrefslogtreecommitdiff
path: root/extra/varnish
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2012-08-19 17:54:19 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2012-08-19 17:54:19 -0300
commit251b132bc8d5157b996afff54617d2483637aa4b (patch)
tree7c1b56c3d3ffaadc49e329930b7eb0be75b328cb /extra/varnish
parent3ed19e74567434fe0bc82d835513b5b62f151838 (diff)
parent07455ea1de16867b168628e8a9f7f5bffc169a5f (diff)
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts: community-staging/r8168-lts/PKGBUILD community-testing/evas_generic_loaders-svn/PKGBUILD community-testing/gambas2/PKGBUILD community-testing/gambas3/PKGBUILD community-testing/libextractor/PKGBUILD community-testing/pdf2djvu/PKGBUILD community-testing/r8168-lts/PKGBUILD community-testing/sage-mathematics/PKGBUILD community/ruby-gtk2/PKGBUILD core/dhcpcd/PKGBUILD core/glibc/PKGBUILD core/net-tools/PKGBUILD cross/mips64el-unknown-linux-gnu-linux-libre-api-headers/PKGBUILD extra/cups/PKGBUILD extra/maxima/PKGBUILD extra/scim-hangul/PKGBUILD extra/speech-dispatcher/PKGBUILD extra/subversion/PKGBUILD extra/telepathy-idle/PKGBUILD extra/x11vnc/PKGBUILD multilib-testing/binutils-multilib/PKGBUILD multilib-testing/gcc-multilib/PKGBUILD multilib-testing/lib32-glibc/PKGBUILD multilib/binutils-multilib/PKGBUILD multilib/gcc-multilib/PKGBUILD multilib/lib32-glibc/PKGBUILD multilib/lib32-krb5/PKGBUILD multilib/lib32-libdrm/PKGBUILD multilib/lib32-libxml2/PKGBUILD multilib/lib32-libxrandr/PKGBUILD multilib/lib32-p11-kit/PKGBUILD testing/binutils/PKGBUILD testing/calligra/PKGBUILD testing/dhcp/PKGBUILD testing/gcc/PKGBUILD testing/glibc/PKGBUILD testing/inkscape/PKGBUILD testing/iproute2/PKGBUILD testing/libreoffice/PKGBUILD testing/libreoffice/PKGBUILD.36 testing/poppler/PKGBUILD
Diffstat (limited to 'extra/varnish')
-rw-r--r--extra/varnish/PKGBUILD31
-rw-r--r--extra/varnish/rc.varnish26
-rw-r--r--extra/varnish/varnish-vcl-reload21
-rw-r--r--extra/varnish/varnish.service10
4 files changed, 54 insertions, 34 deletions
diff --git a/extra/varnish/PKGBUILD b/extra/varnish/PKGBUILD
index 525f48584..f5e38afc7 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' 'mips64el')
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