X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from mail-pb0-f51.google.com (mail-pb0-f51.google.com [209.85.160.51]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 4AFB0DC00D2 for ; Wed, 8 May 2013 13:30:41 +0000 (UTC) Received: by mail-pb0-f51.google.com with SMTP id wy7so1209810pbc.24 for ; Wed, 08 May 2013 06:30:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=Qj9YmwLIdfiSfHVimE37ndf795kbCQjmRfq7T9sbgZg=; b=Zq8RtWmSxQTCvCDPj5jT1Wfys+pfQfMnU4tqw3exXmOtkG+fXlIN8ciKe2NsLaQNiv oKtOd/TgDtm8G2dh9pw/pdaz40K6GaVQzQnnW0mrN8FusIzThvzoqCrwUY63uEr28TFG wJHSAbATUaaCvmQXNo9MKjDKbyRUcLH6sp/V7i4GefayRi3QEMgvwQfiJucvJj+2xTmh 4gp5v5BwVh/QON4aNihv0ydhQ8AsK4NjPRW7osy/UgnoAZxlmsBCQFdbWUF7SGxnVTUk HuMiEXiDjfMXNsEhNi8DZGDMDdufCOcUmUL1L50kVBneenLM1cq3molm42AOWA48LXne FHoQ== X-Received: by 10.68.139.33 with SMTP id qv1mr1726912pbb.93.1368019840199; Wed, 08 May 2013 06:30:40 -0700 (PDT) Received: from localhost.localdomain ([117.226.143.93]) by mx.google.com with ESMTPSA id dr6sm34975531pac.11.2013.05.08.06.30.34 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 May 2013 06:30:39 -0700 (PDT) From: "V.Krishn" To: alpine-devel@lists.alpinelinux.org Cc: "V.Krishn" Subject: [alpine-devel] [PATCH] Improved confd and add checkpath, build fixes Date: Wed, 8 May 2013 13:21:21 +0000 Message-Id: <1368019281-23699-1-git-send-email-vkrishn4@gmail.com> X-Mailer: git-send-email 1.8.0 X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: From: "V.Krishn" --- main/varnish/APKBUILD | 16 +++++++++++----- main/varnish/varnish.pre-install | 5 +++++ main/varnish/varnishd.confd | 28 ++++++++++++++++++++++++++-- main/varnish/varnishd.initd | 21 +++++++++++++++------ 4 files changed, 57 insertions(+), 13 deletions(-) create mode 100644 main/varnish/varnish.pre-install diff --git a/main/varnish/APKBUILD b/main/varnish/APKBUILD index 6fafe20..adb1162 100644 --- a/main/varnish/APKBUILD +++ b/main/varnish/APKBUILD @@ -1,8 +1,9 @@ # Contributor: Leonardo Arena +# Contributor: V.Krishn # Maintainer: Natanael Copa 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 0000000..0ce9831 --- /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 1b46706..1471f82 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 b8c5653..54fb4a0 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 $? -- 1.8.0 --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---