aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorV.Krishn <vkrishn4@gmail.com>2013-05-08 13:21:21 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-05-09 06:45:33 +0000
commit7fb51995c49d292b40a4cf2429cafec98ec72f55 (patch)
tree7957e695f6c0b4f0dbf7e51144518702ac21e5ba
parent40f70f0e3529770eea2387974808398394548161 (diff)
downloadaports-7fb51995c49d292b40a4cf2429cafec98ec72f55.tar.bz2
aports-7fb51995c49d292b40a4cf2429cafec98ec72f55.tar.xz
Improved confd and add checkpath, build fixes
-rw-r--r--main/varnish/APKBUILD16
-rw-r--r--main/varnish/varnish.pre-install5
-rw-r--r--main/varnish/varnishd.confd28
-rwxr-xr-xmain/varnish/varnishd.initd21
4 files changed, 57 insertions, 13 deletions
diff --git a/main/varnish/APKBUILD b/main/varnish/APKBUILD
index 6fafe2088b..adb1162bef 100644
--- a/main/varnish/APKBUILD
+++ b/main/varnish/APKBUILD
@@ -1,8 +1,9 @@
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
+# Contributor: V.Krishn <vkrishn4@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=varnish
pkgver=3.0.3
-pkgrel=1
+pkgrel=2
pkgdesc="High-performance HTTP accelerator"
url="http://www.varnish-cache.org/"
arch="all"
@@ -10,8 +11,10 @@ license="BSD"
depends="gcc libc-dev"
depends_dev=
makedepends="$depends_dev pcre-dev ncurses-dev"
-install=""
+install="varnish.pre-install"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
+pkgusers="varnish"
+pkggroups="varnish"
source="http://repo.varnish-cache.org/source/varnish-$pkgver.tar.gz
varnishd.initd
varnishd.confd
@@ -50,7 +53,10 @@ package() {
|| return 1
install -Dm644 "$srcdir"/varnishd.logrotate \
"$pkgdir"/etc/logrotate.d/varnishd || return 1
- mkdir -p "$pkgdir"/var/log/varnish
+ install -d -o varnish -g varnish \
+ "$pkgdir"/var/cache/varnish \
+ "$pkgdir"/var/log/varnish \
+ || return 1
find "$pkgdir" -name *.la -print | xargs rm
}
@@ -61,7 +67,7 @@ libs() {
}
md5sums="714310c83fdbd2061d897dacd3f63d8b varnish-3.0.3.tar.gz
-4f78964bf3eb6f1fd0fd2d533575982e varnishd.initd
-6dd289ba81464eacc238109143126d6a varnishd.confd
+c2659431b145229c1fb7f885a55d6fc2 varnishd.initd
+459d87260de5ee9ba7ca590d85418620 varnishd.confd
a6cb8a43c9465699cf956dc992998225 varnishd.logrotate
8c5532869bea7f668e2ce5d4585359f8 varnish-3.0.3-pthread-uclibc.patch"
diff --git a/main/varnish/varnish.pre-install b/main/varnish/varnish.pre-install
new file mode 100644
index 0000000000..0ce9831c29
--- /dev/null
+++ b/main/varnish/varnish.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup varnish 2>/dev/null
+adduser -S -H -h /var/lib/varnish -s /sbin/nologin -D -G varnish varnish 2>/dev/null
+exit 0
diff --git a/main/varnish/varnishd.confd b/main/varnish/varnishd.confd
index 1b46706c23..1471f82078 100644
--- a/main/varnish/varnishd.confd
+++ b/main/varnish/varnishd.confd
@@ -1,12 +1,36 @@
# /etc/conf.d/varnishd
+
+# Varnish configuration file
+VARNISH_CONF="/etc/varnish/default.vcl"
+
+VARNISH_SECRET_FILE="/etc/varnish/secret"
+
+# Varnish address
+VARNISH_LISTEN_ADDRESS=
+VARNISH_PORT=8080
+
+# Varnish work files
+VARNISH_WORKING_DIR="/var/cache/varnish"
+VARNISH_STORAGE_FILE="/var/cache/varnish/varnish_storage.bin"
+VARNISH_STORAGE_SIZE=50M
+VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}"
+
+# PID files
+VARNISHD_PID_FILE=/var/run/varnish/varnishd.pid
+VARNISHNCSA_PID_FILE=/var/run/varnish/varnishncsa.pid
+
+# Varnish admin
ADMINHOSTPORT="127.0.0.1:65080"
-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 -T $ADMINHOSTPORT -f $CFG_FILE"
+VARNISHD_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_PORT} -f ${VARNISH_CONF} -s ${VARNISH_STORAGE} -n $VARNISH_WORKING_DIR -T $ADMINHOSTPORT"
+
+# add user
+VARNISHD_OPTS="-u varnish $VARNISHD_OPTS"
# arguments passed to varnishncsa
# please see the varnishncsa man page for more options
VARNISHNCSA_ARGS="-c -a -w /var/log/varnish/access.log"
+
diff --git a/main/varnish/varnishd.initd b/main/varnish/varnishd.initd
index b8c565317c..54fb4a0a75 100755
--- a/main/varnish/varnishd.initd
+++ b/main/varnish/varnishd.initd
@@ -3,6 +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 $
+VARNISH_CONF=${VARNISH_CONF:-${CFG_FILE}}
extra_commands="reload flush"
depend() {
@@ -11,26 +12,34 @@ depend() {
start() {
ebegin "Starting varnish"
+ checkpath --directory --owner varnish:varnish \
+ --mode 755 ${VARNISHD_PID_FILE%/*}
#allow varnishd to lock logfile to memory
ulimit -l 82000
- start-stop-daemon --quiet --start --pidfile /var/run/varnishd.pid --exec /usr/sbin/varnishd -- -P /var/run/varnishd.pid ${VARNISHD_OPTS} &> /dev/null
+ start-stop-daemon --quiet --start \
+ --pidfile ${VARNISHD_PID_FILE} \
+ --exec /usr/sbin/varnishd \
+ -- -P ${VARNISHD_PID_FILE} ${VARNISHD_OPTS} &> /dev/null
eend $?
if [ "${VARNISHNCSA_ARGS}" != "" ]; then
ebegin "Starting varnish logging"
- start-stop-daemon --quiet --start --pidfile /var/run/varnishncsa.pid --exec /usr/bin/varnishncsa -- -D -P /var/run/varnishncsa.pid ${VARNISHNCSA_ARGS}
+ start-stop-daemon --quiet --start \
+ --pidfile ${VARNISHNCSA_PID_FILE} \
+ --exec /usr/bin/varnishncsa \
+ -- -D -P ${VARNISHNCSA_PID_FILE} ${VARNISHNCSA_ARGS}
eend $?
fi
}
stop() {
ebegin "Stopping varnish"
- start-stop-daemon --quiet --stop --pidfile /var/run/varnishd.pid
+ start-stop-daemon --quiet --stop --pidfile ${VARNISHD_PID_FILE}
eend $?
- if [ -e /var/run/varnishncsa.pid ]; then
+ if [ -e ${VARNISHNCSA_PID_FILE} ]; then
ebegin "Stopping varnish logging"
- start-stop-daemon --quiet --stop --pidfile /var/run/varnishncsa.pid
+ start-stop-daemon --quiet --stop --pidfile ${VARNISHNCSA_PID_FILE}
eend $?
fi
}
@@ -47,7 +56,7 @@ reload() {
# 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.load reload-$NOW ${VARNISH_CONF} > /dev/null
/usr/bin/varnishadm -T $ADMINHOSTPORT vcl.use reload-$NOW > /dev/null
eend $?