diff options
author | Christian Ruppert <idl0r@gentoo.org> | 2014-05-22 20:23:48 +0000 |
---|---|---|
committer | Christian Ruppert <idl0r@gentoo.org> | 2014-05-22 20:23:48 +0000 |
commit | e448b62c7b8eb0f813452eb2e7f2b7cd34516329 (patch) | |
tree | 0b264e997a6f30bf337fce799f10b465c4b5b2da /www-servers/varnish | |
parent | add dev-qt/designer:4 dependency wrt #503622 (diff) | |
download | gentoo-2-e448b62c7b8eb0f813452eb2e7f2b7cd34516329.tar.gz gentoo-2-e448b62c7b8eb0f813452eb2e7f2b7cd34516329.tar.bz2 gentoo-2-e448b62c7b8eb0f813452eb2e7f2b7cd34516329.zip |
Revbump. Major changes
Logdir no longer world readable - bug 458888
varnishd, varnishncsa and varnishlog have been split into separate init scripts, also fixes bug 480252
Run Varnish as user (varnish/varnish)
Check the VCL for errors before stopping varnishd when doing a restart
(Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key B427ABC8)
Diffstat (limited to 'www-servers/varnish')
-rw-r--r-- | www-servers/varnish/ChangeLog | 13 | ||||
-rw-r--r-- | www-servers/varnish/files/varnishd.confd-r3 | 22 | ||||
-rw-r--r-- | www-servers/varnish/files/varnishd.initd-r3 | 78 | ||||
-rw-r--r-- | www-servers/varnish/files/varnishd.logrotate-r2 | 31 | ||||
-rw-r--r-- | www-servers/varnish/files/varnishlog.confd | 3 | ||||
-rw-r--r-- | www-servers/varnish/files/varnishlog.initd | 32 | ||||
-rw-r--r-- | www-servers/varnish/files/varnishncsa.confd | 3 | ||||
-rw-r--r-- | www-servers/varnish/files/varnishncsa.initd | 32 | ||||
-rw-r--r-- | www-servers/varnish/varnish-4.0.0-r1.ebuild (renamed from www-servers/varnish/varnish-4.0.0.ebuild) | 38 |
9 files changed, 241 insertions, 11 deletions
diff --git a/www-servers/varnish/ChangeLog b/www-servers/varnish/ChangeLog index b10c4ecce7d2..f17288d45aaa 100644 --- a/www-servers/varnish/ChangeLog +++ b/www-servers/varnish/ChangeLog @@ -1,6 +1,17 @@ # ChangeLog for www-servers/varnish # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/ChangeLog,v 1.76 2014/04/12 22:45:47 blueness Exp $ +# $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/ChangeLog,v 1.77 2014/05/22 20:23:48 idl0r Exp $ + +*varnish-4.0.0-r1 (22 May 2014) + + 22 May 2014; Christian Ruppert <idl0r@gentoo.org> +files/varnishd.confd-r3, + +files/varnishd.initd-r3, +files/varnishd.logrotate-r2, + +files/varnishlog.confd, +files/varnishlog.initd, +files/varnishncsa.confd, + +files/varnishncsa.initd, +varnish-4.0.0-r1.ebuild, -varnish-4.0.0.ebuild: + Revbump. Major changes Logdir no longer world readable - bug 458888 varnishd, + varnishncsa and varnishlog have been split into separate init scripts, also + fixes bug 480252 Run Varnish as user (varnish/varnish) Check the VCL for + errors before stopping varnishd when doing a restart *varnish-4.0.0 (12 Apr 2014) diff --git a/www-servers/varnish/files/varnishd.confd-r3 b/www-servers/varnish/files/varnishd.confd-r3 new file mode 100644 index 000000000000..c05b8fb7521c --- /dev/null +++ b/www-servers/varnish/files/varnishd.confd-r3 @@ -0,0 +1,22 @@ +# /etc/conf.d/varnishd + +VARNISHD="/usr/sbin/varnishd" +VARNISHADM="/usr/bin/varnishadm" + +#CONFIGFILES="/etc/varnish/${SVCNAME}.vcl" +CONFIGFILE="/etc/varnish/default.vcl" + +# Listen on 127.0.0.1:8080 and connect to backend 127.0.0.1:80 +#VARNISHD_OPTS="-a 127.0.0.1:8080 -a 127.0.0.1:8080" + +# Alternatively, don't listen to a backend +VARNISHD_OPTS="-a 127.0.0.1:8080" + + +# User/Group +VARNISHD_OPTS="${VARNISHD_OPTS} -u varnish -g varnish" + +# You may need to increase the number of open files (-n) +# and the maximum amount off locked memory (-l) +# See bug #459142 +#rc_ulimit="-n 32786 -l 82000" diff --git a/www-servers/varnish/files/varnishd.initd-r3 b/www-servers/varnish/files/varnishd.initd-r3 new file mode 100644 index 000000000000..d98120fec280 --- /dev/null +++ b/www-servers/varnish/files/varnishd.initd-r3 @@ -0,0 +1,78 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/files/varnishd.initd-r3,v 1.1 2014/05/22 20:23:48 idl0r Exp $ + +VARNISHD_PID=${VARNISHD_PID:-/run/${SVCNAME}.pid} +CONFIGFILES="${CONFIGFILE:-/etc/varnish/default.vcl}" + +command="${VARNISHD:-/usr/sbin/varnishd}" +command_args="-P ${VARNISHD_PID} -f ${CONFIGFILE} ${VARNISHD_OPTS}" +pidfile="${VARNISHD_PID}" + +extra_commands="configtest" +extra_started_commands="reload" + +description_configtest="Run syntax tests for configuration files." +description_reload="Reloads the configuration." + +depend() { + need net +} + +configtest() { + ebegin "Checking ${SVCNAME} configuration" + checkconfig + eend $? +} + +checkconfig() { + ${VARNISHD} -C -f ${CONFIGFILE} >/dev/null 2>&1 + ret=$? + if [ $ret -ne 0 ]; then + eerror "${SVCNAME} has detected an error in your setup:" + ${VARNISHD} -C -f ${CONFIGFILE} + fi + + return $ret +} + +start_pre() { + checkconfig || return 1 +} + +stop_pre() { + if [ "${RC_CMD}" = "restart" ]; then + checkconfig || return 1 + fi +} + +reload() { + checkconfig || return 1 + + ebegin "Reloading varnish" + + $VARNISHADM vcl.list >/dev/null 2>&1 + ret=$? + if [ $ret -ne 0 ]; then + eerror "${SVCNAME} cannot list configuration" + return 1 + fi + + new_config="reload_$(date +%FT%H:%M:%S)" + $VARNISHADM vcl.load $new_config $CONFIGFILE >/dev/null 2>&1 + ret=$? + if [ $ret -ne 0 ]; then + eerror "${SVCNAME} cannot load configuration" + return 1 + fi + + $VARNISHADM vcl.use $new_config >/dev/null 2>&1 + ret=$? + if [ $ret -ne 0 ]; then + eerror "${SVCNAME} cannot switch configuration" + return 1 + fi + + eend 0 +} diff --git a/www-servers/varnish/files/varnishd.logrotate-r2 b/www-servers/varnish/files/varnishd.logrotate-r2 new file mode 100644 index 000000000000..e697e428f3dd --- /dev/null +++ b/www-servers/varnish/files/varnishd.logrotate-r2 @@ -0,0 +1,31 @@ +/var/log/varnish/varnishncsa.log { + daily + rotate 31 + copytruncate + dateext + dateyesterday + delaycompress + compress + notifempty + missingok + + prerotate + /etc/init.d/varnishncsa -q status && /etc/init.d/varnishncsa -q flush + endscript +} + +/var/log/varnish/varnishlog.log { + daily + rotate 31 + copytruncate + dateext + dateyesterday + delaycompress + compress + notifempty + missingok + + prerotate + /etc/init.d/varnishlog -q status && /etc/init.d/varnishlog -q flush + endscript +} diff --git a/www-servers/varnish/files/varnishlog.confd b/www-servers/varnish/files/varnishlog.confd new file mode 100644 index 000000000000..d7358b1dc898 --- /dev/null +++ b/www-servers/varnish/files/varnishlog.confd @@ -0,0 +1,3 @@ +# /etc/conf.d/varnishlog + +VARNISHLOG_OPTS="-a -w /var/log/varnish/varnishlog.log" diff --git a/www-servers/varnish/files/varnishlog.initd b/www-servers/varnish/files/varnishlog.initd new file mode 100644 index 000000000000..a87b6d83081e --- /dev/null +++ b/www-servers/varnish/files/varnishlog.initd @@ -0,0 +1,32 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/files/varnishlog.initd,v 1.1 2014/05/22 20:23:48 idl0r Exp $ + +VARNISHLOG_PID=${VARNISHLOG_PID:-/run/${SVCNAME}.pid} + +command="${VARNISHLOG:-/usr/bin/varnishlog}" +command_args="-D -P ${VARNISHLOG_PID} ${VARNISHLOG_OPTS}" +pidfile="${VARNISHLOG_PID}" + +extra_started_commands="reload rotate flush" + +description_rotate="Rotate the log file" +description_flush="Flush any outstanding transactions" + +rotate() { + ebegin "Rotating log file" + start-stop-daemon -p ${VARNISHLOG_PID} -s SIGHUP + eend $? +} + +flush() { + ebegin "Flushing any outstanding transactions" + start-stop-daemon -p ${VARNISHLOG_PID} -s SIGUSR1 + eend $? +} + +reload() { + flush + rotate +} diff --git a/www-servers/varnish/files/varnishncsa.confd b/www-servers/varnish/files/varnishncsa.confd new file mode 100644 index 000000000000..f3112fdd532a --- /dev/null +++ b/www-servers/varnish/files/varnishncsa.confd @@ -0,0 +1,3 @@ +# /etc/conf.d/varnishncsa + +VARNISHNCSA_OPTS="-a -w /var/log/varnish/${SVCNAME}.log" diff --git a/www-servers/varnish/files/varnishncsa.initd b/www-servers/varnish/files/varnishncsa.initd new file mode 100644 index 000000000000..1b97b0b6785d --- /dev/null +++ b/www-servers/varnish/files/varnishncsa.initd @@ -0,0 +1,32 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/files/varnishncsa.initd,v 1.1 2014/05/22 20:23:48 idl0r Exp $ + +VARNISHNCSA_PID=${VARNISHNCSA_PID:-/run/${SVCNAME}.pid} + +command="${VARNISHNCSA:-/usr/bin/varnishncsa}" +command_args="-D -P ${VARNISHNCSA_PID} ${VARNISHNCSA_OPTS}" +pidfile="${VARNISHNCSA_PID}" + +extra_started_commands="reload rotate flush" + +description_rotate="Rotate the log file" +description_flush="Flush any outstanding transactions" + +rotate() { + ebegin "Rotating log file" + start-stop-daemon -p ${VARNISHNCSA_PID} -s SIGHUP + eend $? +} + +flush() { + ebegin "Flushing any outstanding transactions" + start-stop-daemon -p ${VARNISHNCSA_PID} -s SIGUSR1 + eend $? +} + +reload() { + flush + rotate +} diff --git a/www-servers/varnish/varnish-4.0.0.ebuild b/www-servers/varnish/varnish-4.0.0-r1.ebuild index d21d9c823dc0..704dcd928996 100644 --- a/www-servers/varnish/varnish-4.0.0.ebuild +++ b/www-servers/varnish/varnish-4.0.0-r1.ebuild @@ -1,12 +1,12 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/varnish-4.0.0.ebuild,v 1.1 2014/04/12 22:45:47 blueness Exp $ +# $Header: /var/cvsroot/gentoo-x86/www-servers/varnish/varnish-4.0.0-r1.ebuild,v 1.1 2014/05/22 20:23:48 idl0r Exp $ EAPI="5" PYTHON_COMPAT=( python{2_6,2_7,3_2,3_3} pypy pypy2_0 ) -inherit autotools-utils eutils systemd python-single-r1 +inherit user autotools-utils eutils systemd python-r1 DESCRIPTION="Varnish is a state-of-the-art, high-performance HTTP accelerator" HOMEPAGE="http://www.varnish-cache.org/" @@ -20,7 +20,8 @@ IUSE="jemalloc jit static-libs" CDEPEND=" || ( dev-libs/libedit sys-libs/readline ) dev-libs/libpcre[jit?] - jemalloc? ( dev-libs/jemalloc )" + jemalloc? ( dev-libs/jemalloc ) + sys-libs/ncurses" #varnish compiles stuff at run time RDEPEND=" @@ -46,7 +47,10 @@ PATCHES=( AUTOTOOLS_AUTORECONF="yes" pkg_setup() { - python-single-r1_pkg_setup + ebegin "Creating varnish user and group" + enewgroup varnish 40 + enewuser varnish 40 -1 /var/lib/varnish varnish + eend $? } src_prepare() { @@ -69,18 +73,32 @@ src_configure() { src_install() { autotools-utils_src_install - newinitd "${FILESDIR}"/varnishd.initd-r2 varnishd - newconfd "${FILESDIR}"/varnishd.confd-r2 varnishd + python_replicate_script "${D}/usr/share/varnish/vmodtool.py" - insinto /etc/logrotate.d - newins "${FILESDIR}/varnishd.logrotate" varnishd + newinitd "${FILESDIR}"/varnishlog.initd varnishlog + newconfd "${FILESDIR}"/varnishlog.confd varnishlog - dodir /var/log/varnish + newinitd "${FILESDIR}"/varnishncsa.initd varnishncsa + newconfd "${FILESDIR}"/varnishncsa.confd varnishncsa + + newinitd "${FILESDIR}"/varnishd.initd-r3 varnishd + newconfd "${FILESDIR}"/varnishd.confd-r3 varnishd + + insinto /etc/logrotate.d/ + newins "${FILESDIR}/varnishd.logrotate-r2" varnishd + + diropts -m750 + + dodir /var/log/varnish/ systemd_dounit "${FILESDIR}/${PN}d.service" - insinto /etc/varnish + insinto /etc/varnish/ doins lib/libvmod_std/vmod.vcc + + fowners root:varnish /etc/varnish/ + fowners varnish:varnish /var/lib/varnish/ + fperms 0750 /var/lib/varnish/ /etc/varnish/ } pkg_postinst () { |