[Pkg-varnish-devel] Bug#708975: varnish: Varnish should use /run instead of /var/run
Jerome Warnier
jwarnier at beeznest.net
Sun May 19 21:24:15 UTC 2013
Package: varnish
Version: 3.0.2-2
Severity: minor
Dear Maintainer,
Varnish's initscript in Wheezy still uses /var/run to store its PID.
There is an effort to migrate to the new /run: http://wiki.debian.org/ReleaseGoals/RunDirectory
Fix is trivial.
In my case, this makes my Monit fail to correctly read /run/varnishd.pid.
Please note that Jessie might force the migration to /run.
Regards
-- System Information:
Debian Release: 7.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-4-amd64 (SMP w/16 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages varnish depends on:
ii adduser 3.113+nmu3
ii gcc 4:4.7.2-1
ii libc6 2.13-38
ii libc6-dev [libc-dev] 2.13-38
ii libedit2 2.11-20080614-5
ii libncurses5 5.9-10
ii libpcre3 1:8.30-5
ii libtinfo5 5.9-10
ii libvarnishapi1 3.0.2-2
varnish recommends no packages.
Versions of packages varnish suggests:
pn varnish-doc <none>
-- Configuration Files:
/etc/default/varnish changed:
START=yes
NFILES=181072
MEMLOCK=82000
INSTANCE=$(uname -n)
VARNISH_VCL_CONF=/etc/varnish/default.vcl
VARNISH_LISTEN_ADDRESS=
VARNISH_LISTEN_PORT=80
VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
VARNISH_ADMIN_LISTEN_PORT=6082
VARNISH_MIN_THREADS=400
VARNISH_MAX_THREADS=6000
VARNISH_THREAD_TIMEOUT=120
VARNISH_STORAGE=malloc,3G
VARNISH_SECRET_FILE=/etc/varnish/secret
VARNISH_TTL=120
DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
-f ${VARNISH_VCL_CONF} \
-T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
-t ${VARNISH_TTL} \
-w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \
-S ${VARNISH_SECRET_FILE} \
-s ${VARNISH_STORAGE}"
/etc/init.d/varnish changed:
. /lib/lsb/init-functions
NAME=varnishd
DESC="HTTP accelerator"
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/varnishd
PIDFILE=/run/$NAME.pid
test -x $DAEMON || exit 0
if [ -f /etc/default/varnish ] ; then
. /etc/default/varnish
fi
ulimit -n ${NFILES:-131072}
ulimit -l ${MEMLOCK:-82000}
DAEMON_OPTS=${DAEMON_OPTS:--b localhost}
export PATH="${PATH:+$PATH:}/usr/sbin:/usr/bin:/sbin:/bin"
start_varnishd() {
log_daemon_msg "Starting $DESC" "$NAME"
output=$(/bin/tempfile -s.varnish)
if start-stop-daemon \
--start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- \
-P ${PIDFILE} ${DAEMON_OPTS} > ${output} 2>&1; then
log_end_msg 0
else
log_end_msg 1
cat $output
exit 1
fi
rm $output
}
disabled_varnishd() {
log_daemon_msg "Not starting $DESC" "$NAME"
log_progress_msg "disabled in /etc/default/varnish"
log_end_msg 0
}
stop_varnishd() {
log_daemon_msg "Stopping $DESC" "$NAME"
if start-stop-daemon \
--stop --quiet --pidfile $PIDFILE --retry 10 \
--exec $DAEMON; then
log_end_msg 0
else
log_end_msg 1
fi
}
reload_varnishd() {
log_daemon_msg "Reloading $DESC" "$NAME"
if /usr/share/varnish/reload-vcl -q; then
log_end_msg 0
else
log_end_msg 1
fi
}
status_varnishd() {
status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}"
exit $?
}
case "$1" in
start)
case "${START:-}" in
[Yy]es|[Yy]|1|[Tt]|[Tt]rue)
start_varnishd
;;
*)
disabled_varnishd
;;
esac
;;
stop)
stop_varnishd
;;
reload)
reload_varnishd
;;
status)
status_varnishd
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
log_success_msg "Usage: $0 {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0
/etc/varnish/default.vcl changed:
backend default {
.host = "127.0.0.1";
.port = "8090";
}
sub vcl_recv {
set req.grace = 5m;
unset req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
if (req.http.Accept-Encoding) {
#unset req.http.Cookie;
if (req.url ~ "\.(gz|tgz|bz2|tbz|mp3|ogg|jpg|jpeg|png|gif|swf|avi|flv|fla)$" || req.url ~ "sitemap\.xml$") {
# No point in compressing these
remove req.http.Accept-Encoding;
} elsif (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate" && req.http.user-agent !~ "MSIE") {
set req.http.Accept-Encoding = "deflate";
} else {
# unkown algorithm
remove req.http.Accept-Encoding;
}
}
if (req.url ~ "^/vote-modahit" || req.url ~ "/moda-hit/") {
set req.backend = default;
return(pass);
}
# avoid cache on profile edition page
if (req.http.host ~ "^(www\.|cdn\.)?planeta\.com\.pe$") {
if (req.url ~ "editaperfil$" || req.url ~ "^/crp_register_3steps/") {
return(pass);
}
}
# Lo siguiente *no* ayuda para el problema de sesiones de nuevaq
#if (req.http.host ~ "^(www\.)?radionuevaq\.com\.pe$") {
# return(pass);
#}
# for Drupal Pressflow - see http://www.varnish-cache.org/trac/wiki/VarnishAndDrupal
## Remove has_js and Google Analytics __* cookies.
set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[a-z]+|has_js)=[^;]*", "");
## Remove a ";" prefix, if present.
set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");
## Remove empty cookies.
if (req.http.Cookie ~ "^\s*$") {
unset req.http.Cookie;
}
# Prevents calls to request_server.php from buggy Flash banners
# Force return from cache (do not call backend)
if (req.url ~ "request_server.php$" || req.url ~ "^search404" || req.url ~ "richmedia/php/request_server.php$") {
return(lookup);
}
# baneo de direccion IP de Ukrania
if (req.http.referer && req.http.referer ~ "^http://www.musicaenlinea2012.com/") {
error 403 "No flooding please";
}
if (req.http.X-Forwarded-For ~ "^176\.119\.0\." || req.http.X-Forwarded-For ~ "^91\.207\." || req.http.X-Forwarded-For ~ "^190\.118\.28\.93" || req.http.X-Forwarded-For ~ "^219\.160\.187\.95" || req.http.X-Forwarded-For ~ "^91\.121\.176\.108" || req.http.X-Forwarded-For ~ "^91\.121\.176\.113") {
error 403 "No flooding please";
}
if (req.url ~ "^/sites/" || req.url ~ "^/misc/" || req.url ~ "^/files/" || req.url ~ "^/css/" || req.url ~ "\.(png|gif|jpg|jpeg|swf|avi|flv|fla|css|ico)$") {
unset req.http.Cookie;
}
# If there is a cookie, let the request pass to the backend directly
if (req.http.Cookie ~ "(VARNISH|DRUPAL_UID|LOGGED_IN)") {
return (pass);
}
# exclude following urls from caching
if (req.url ~ "sitemap\.xml$" || req.url ~ ".*/server-status$" || req.url ~ ".*/nginx_status$" || req.url ~ "^cron\.php$") {
return (pass);
}
if (req.url ~ ".*/limpia-varnish$") {
#purge("req.http.host ~ " req.http.host);
# " && req.url ~ .*");
return (pass);
}
# exclude vroum.beeznest.com from caching
if (req.http.host ~ "^vroum.beeznest.com$") {
# @TODO Add anti-output buffering here
return (pass);
}
if (req.http.Cache-Control ~ "no-cache") {
return (pass);
}
}
sub vcl_hit {
#if (!obj.cacheable) {
# return (pass);
#}
if (req.http.Cache-Control ~ "no-cache") {
if (! (req.http.Via || req.http.User-Agent ~ "bot|MSIE")) {
set obj.ttl = 0s;
return (restart);
}
}
return (deliver);
}
sub vcl_fetch {
set beresp.grace = 5m;
if (beresp.status == 500 || beresp.status == 503) {
set beresp.saintmode = 60s; #if a 500 error page is answered, use the cache rather than the error page
return(restart);
}
# Give some cache time to more or less static pages
#if (req.url ~ "^/musica/(artistas|canciones)?" || req.url ~ "^/(canciones|artistas)") {
#set beresp.ttl = 15m;
#}
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = req.http.rlnclientipaddr;
# Prevent returning worm control pages
if (req.url ~ "^/w00tw00t") {
error 403 "Not permitted";
}
# Why it misses/hits - https://www.varnish-cache.org/trac/wiki/VCLExampleHitMissHeader
if (req.http.Cookie ~ "(VARNISH|DRUPAL_UID|LOGGED_IN)") {
set beresp.http.X-Cacheable = "NO:Got Session";
return(deliver);
# You are respecting the Cache-Control=private header from the backend
} elsif (beresp.http.Cache-Control ~ "private") {
set beresp.http.X-Cacheable = "NO:Cache-Control=private";
return(deliver);
# You are extending the lifetime of the object artificially
} elsif (beresp.ttl < 1s) {
set beresp.ttl = 5s;
set beresp.grace = 5s;
set beresp.http.X-Cacheable = "YES:FORCED";
# Varnish determined the object was cacheable
} else {
set beresp.http.X-Cacheable = "YES";
}
}
sub vcl_deliver {
if (obj.hits > 0) {
set resp.http.X-Cache = "HIT";
set resp.http.X-Cache-Hits = obj.hits;
} else {
set resp.http.X-Cache = "MISS";
}
return (deliver);
}
# Trial to increase cached time as defined in https://www.varnish-cache.org/trac/wiki/VCLExampleLongerCaching
sub vcl_error {
if(obj.status == 404) {
set obj.ttl =3600s;
set obj.http.Content-Type = "text/html; charset=utf-8";
synthetic {"
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>CRP - Corporación Radial del Perú - Dueños de la emoción</title>
<meta name="Description" content="Corporación Radial del Perú - CRP">
<meta name="keywords" content="corporación radial de Perú, corporación radial, corporación de radio, radio, radial, empresa de radio, crp, crp radio, radios musicales, música, dueños de la emoción, si no emocionas no conectas, siete formas de conectar con sus consumidores, producción de comerciales, locutores, audios, demos, ritmo romántica, ritmo, la inolvidable, inolvidable, moda, la cien, 100, radiomar plus, inca, inca sat, planeta, baladas, recuerdos, música variada, salsa, cumbia, folflore, pop, rock">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Expires" content="Mon, 04 Dec 1999 21:29:02 GMT">
<meta http-equiv="PRAGMA" content="NO-CACHE">
<link href='http://crp.pe/favicon/favicon.ico' rel='shortcut icon' type='image/x-icon'>
<link href='http://crp.pe/favicon/favicon.png' rel='shortcut icon' type='image/png'>
<script type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<link href="http://crp.pe/css/crp-radio.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper-crp-radio">
<h1 title="CRP - Corporación Radial del Perú - Dueños de la emoción"><span>CRP - Corporación Radial del Perú - Dueños de la emoción</span></h1>
<div id="radios-corporacion-radial-peru">
<ul>
<li id="ritmo" title="Radio Ritmo Romántica"><a href="http://www.ritmoromantica.com/" target="_blank"><span>Radio Ritmo Romántica</span></a></li>
<li id="inolvidable" title="Radio La Inolvidable"><a href="http://www.radiolainolvidable.com.pe/" target="_blank"><span>Radio La Inolvidable</span></a></li>
<li id="moda" title="Radio Moda Te Mueve"><a href="http://www.moda.com.pe/" target="_blank"><span>Radio Moda Te Mueve</span></a></li>
<li id="oasis" title="Radio Oasis"><a href="http://www.radiooasis.com.pe/" target="_blank"><span>Radio Oasis</span></a></li>
<li id="radiomar" title="Radiomar Plus"><a href="http://www.radiomar.com.pe/" target="_blank"><span>Radiomar Plus</span></a></li>
<li id="nueva-q" title="Radio Nueva Q"><a href="http://www.radionuevaq.com.pe/" target="_blank"><span>Radio Nueva Q FM</span></a></li>
<li id="planeta" title="Radio Planeta"><a href="http://www.planeta.com.pe/" target="_blank"><span>Radio Planeta</span></a></li>
<li id="inca" title="Radio Inca"><a href="http://www.radioinca.com.pe" target="_blank"><span>Radio Inca</span></a></li>
</ul>
</div>
<div id="footer-corporacion-radial-peru">
<div id="marca-peru" title="Marca Perú"></div>
Calle Justo Pastor Dávila 197 / Calle Juan Vargas 147 - Chorrillos - Lima - Perú<br />
Teléfono: 617 6600 | <a href="#" onclick="MM_openBrWindow('informacion-contacto.html','','scrollbars=yes,resizable=yes,width=980,height=680')">Información de contacto</a>
<div style="color: white">
Guru Meditation:<br />
</div>
</div>
</div>
</body>
</html>
"};
return (deliver);
} else {
set obj.http.Content-Type = "text/html; charset=utf-8";
synthetic {" <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>CRP - Libro de Reclamaciones</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
body{background:url(https://lh4.googleusercontent.com/-g18SAmQ0qbs/T-h4c-8gCZI/AAAAAAAAACU/DbhnRucAyV4/s0/bg-libro-reclamaciones.jpg) repeat-x;margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;color:#999;font-size:12px;line-height:18px}#wrpapper-libro-reclamaciones{background:url(https://lh5.googleusercontent.com/-6uDmRY0JjXI/T-h4c4l1ToI/AAAAAAAAACU/86tTmnRSLpc/s0/bg-header-libro-reclamaciones.jpg) no-repeat center top}#body-libro-reclamaciones{width:960px;margin:0 auto}#header-libro-reclamaciones{width:960px;height:140px;float:left}#header-libro-reclamaciones h1{display:block;margin:0;padding:0;width:280px;height:136px;float:left}#header-libro-reclamaciones h1 span{display:none}#cuerpo-libro-reclamaciones{clear:both;float:left;width:920px;padding:20px 20px 30px}#cuerpo-libro-reclamaciones .title-crp{display:block;margin:0 0 0 20px;padding:0;background:url(https://lh3.googleusercontent.com/-MFozXJg9Aoo/T-h4c9XjcbI/AAAAAAAAACU/NVL7M3ydJ0U/s0/bg-title.jpg) left center repeat-x;font-size:26px;height:26px}#cuerpo-libro-reclamaciones .title-crp span{display:block;background-color:#FFF;float:left;padding:5px;margin-left:30px}#emisoras{clear:both;background:url(https://lh3.googleusercontent.com/-1Zpz38SdxnA/T-h4dfRBJcI/AAAAAAAAACU/ylZofssYE0c/s0/crp.png) left top no-repeat;padding-left:180px;height:120px;margin-left:50px}#emisoras ul{margin:0;padding:0;list-style:none}#emisoras ul li{float:left;display:block;width:86px;background-repeat:no-repeat;text-align:center}#emisoras ul li a{display:block;width:86px;height:40px;font-size:10px;color:#333;text-decoration:none;text-align:center;padding-top:80px}#ritmo{background-image:url( https://lh6.googleusercontent.com/-9rUmC_PJDmc/T-h4f5M-X6I/AAAAAAAAACU/BRPjSSA6zgM/s0/ritmo.png)}#inolvidable{background-image:url( https://lh6.googleusercontent.com/-oM0rYZkP9G4/T-h4dq5He_I/AAAAAAAAACU/CLE3VkQemzI/s0/inolvidable.png)}#moda{background-image:url( https://lh5.googleusercontent.com/-VY-eYmR2lXU/T-h4d7kZO0I/AAAAAAAAACU/TLz5lCrhth8/s0/moda.png)}#oasis{background-image:url(https://lh4.googleusercontent.com/-hiYjNjMO3Ig/T-h8dGc3KaI/AAAAAAAAACg/mivOSjd9o7c/s0/oasis.png)}#radiomar{background-image:url( https://lh6.googleusercontent.com/-W1bqF4x0j20/T-h4f0BSz_I/AAAAAAAAACU/0J8JV9kQZ-8/s0/radiomar.png)}#nuevaq{background-image:url( https://lh6.googleusercontent.com/-c9yoFZCfT-A/T-h4eU_IuMI/AAAAAAAAACU/REO3W-pSfSM/s0/nuevaq.png)}#planeta{background-image:url( https://lh4.googleusercontent.com/-M0Ae25ssW_U/T-h4fRwChEI/AAAAAAAAACU/uh7kerMFq6I/s0/planeta.png)}#inca{background-image:url( https://lh5.googleusercontent.com/-CVZL2H8HX4s/T-h4dTNno0I/AAAAAAAAACU/rTaRkMB_Eq0/s0/inca.png)}#direcciones{text-align:center;font-size:11px;color:#999;padding-bottom:10px}.cntSeparator{font-size:54px;margin:10px 7px;color:#000}.reloj{text-align:center;width:500px;margin:0 auto;padding:50px 0 50px 400px;}
</style>
<script type="text/javascript">
jQuery.fn.countdown=function(userOptions){var options={stepTime:60,format:"dd:hh:mm:ss",startTime:"01:12:32:55",digitImages:6,digitWidth:53,digitHeight:77,timerEnd:function(){},image:"digits.png" };var digits=[],interval;var createDigits=function(where){var c=0;for(var i=0;i<options.startTime.length;i++){if(parseInt(options.startTime[i])>=0){elem=$('<div id="cnt_'+i+'" class="cntDigit" />').css({height:options.digitHeight*options.digitImages*10,float:'left',background:'url(\''+options.image+'\')',width:options.digitWidth});digits.push(elem);margin(c,-((parseInt(options.startTime[i])*options.digitHeight*options.digitImages)));digits[c].__max=9;switch(options.format[i]){case'h':digits[c].__max=(c%2==0)?2:9;if(c%2==0)digits[c].__condmax=4;break;case'd':digits[c].__max=9;break;case'm':case's':digits[c].__max=(c%2==0)?5:9}++c}else elem=$('<div class="cntSeparator"/>').css({float:'left'}).text(options.startTime[i]);where.append(elem)}};var margin=function(elem,val){if(val!==undefined)return digits[elem].css({'marginTop':val+'px'});return parseInt(digits[elem].css('marginTop').replace('px',''))};var moveStep=function(elem){digits[elem]._digitInitial=-(digits[elem].__max*options.digitHeight*options.digitImages);return function _move(){mtop=margin(elem)+options.digitHeight;if(mtop==options.digitHeight){margin(elem,digits[elem]._digitInitial);if(elem>0)moveStep(elem-1)();else{clearInterval(interval);for(var i=0;i<digits.length;i++)margin(i,0);options.timerEnd();return}if((elem>0)&&(digits[elem].__condmax!==undefined)&&(digits[elem-1]._digitInitial==margin(elem-1)))margin(elem,-(digits[elem].__condmax*options.digitHeight*options.digitImages));return}margin(elem,mtop);if(margin(elem)/options.digitHeight%options.digitImages!=0)setTimeout(_move,options.stepTime);if(mtop==0)digits[elem].__ismax=true}};$.extend(options,userOptions);this.css({height:options.digitHeight,overflow:'hidden'});createDigits(this);interval=setInterval(moveStep(digits.length-1),1000)};
</script>
<script type="text/javascript">
</script>
</head>
<body>
<div id="wrpapper-libro-reclamaciones">
<div id="body-libro-reclamaciones">
<div id="header-libro-reclamaciones">
<h1 title="CRP - Corporación Radial del Perú"><a href="http://www.crpradio.com.pe/" target="_blank"><span>CRP - Corporación Radial del Perú</span></a></h1>
</div>
<div id="cuerpo-libro-reclamaciones">
<h1 class="title-crp" title="Libro de Reclamaciones"><span>Estamos en mantenimiento. En unos momentos regresamos...</span></h1>
<p></p>
<div class="reloj">
<div id="counter_2"></div>
</div>
</div>
<div id="footer-libro-reclamaciones">
<div id="direcciones">Calle Justo Pastor Dávila 197 / Calle Juan Nepomuceno Vargas 147 - Chorrillos - Lima - Perú</div>
<div id="emisoras">
<ul>
<li id="ritmo"><a href="http://www.ritmoromantica.com/" title="Ritmo Romántica - Tu radio de baladas" target="_blank">93.1FM</a></li>
<li id="inolvidable"><a href="http://www.radiolainolvidable.com.pe/" title="Radio La Inolvidable" target="_blank">660AM/93.7FM</a></li>
<li id="moda"><a href="http://www.moda.com.pe/" title="Radio Moda Te Mueve" target="_blank">97.3FM</a></li>
<li id="oasis"><a href="http://www.radiooasis.com.pe/" title="Radio Oasis - Rock & Pop de los 80, 90 y hoy" target="_blank">100.1FM</a></li>
<li id="radiomar"><a href="http://www.radiomar.com.pe/" title="Radiomar Plus - Categóricamente Superior... Ay qué rico!" target="_blank">760AM/106.3FM</a></li>
<li id="nuevaq"><a href="http://www.radionuevaq.com.pe/" title="Radio Nueva Q FM - Donde manda nuestra cumbia!" target="_blank">107.1FM</a></li>
<li id="planeta"><a href="http://www.planeta.com.pe/" title="Radio Planeta - Tú música actual en inglés" target="_blank">107.7FM</a></li>
<li id="inca"><a href="http://www.radioinca.com.pe/" title="Radio Inca" target="_blank">540AM</a></li>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>
"};
return (deliver);
}
}
-- no debconf information
More information about the Pkg-varnish-devel
mailing list