Setting default_ttl in vcl file

Steve Scally steve at kcilink.com
Wed Oct 24 18:47:12 CEST 2007


Ingvar,

Sorry, I did not include my OS information, as the location of the  
files I was referencing pointed to FreeBSD or a BSD like system.  In  
the future I will clarify.

Dag-Erling,

"I could either add code to the rc script to read in a list of run- 
time parameters and pass them on the command line."

This would work great something like this: varnishd_ttl or  
varnishd_default_ttl etc,

/usr/local/etc/rc.d/varnishd

: ${varnishd_enable="NO"}
: ${varnishd_listen=":6081"}
: ${varnishd_config="%%PREFIX%%/etc/varnish/default.vcl"}
: ${varnishd_telnet="localhost:6082"}
: ${varnishd_storage="file,/tmp,50%"}
:${varnishd_ttl="3600"}
: ${varnishd_flags="-P ${pidfile} -a ${varnishd_listen} -f $ 
{varnishd_config} -T ${varnishd_telnet} -s ${varnishd_storage} -t  $ 
{varnish_ttl}"}

This will then allow me to add something like this to my /etc/rc.conf  
file:

varnishd_enable="YES"
varnishd_listen=":80"
varnishd_storage="file,/var/tmp,512M"
varnishd_config="/usr/local/etc/varnish/default.vcl"
varnishd_ttl="3600"

To better understand my setup, all our machines have their /etc/ 
configs auto generated using protofs.  This way each systems  
configurations do not have be kept in subversion only the template.   
Then by using the template all the configs can be regenerated.  So by  
enabling this new variable I simply add varnishd_ttl and the value I  
would like and then regenerate the configs and it produces the  
rc.conf above.

services :
   varnishd :
   apache22 :
   varnishlog :
extraconfig:
   varnishd_listen : :80
   varnishd_config : /usr/local/etc/varnish/default.vcl
   varnishd_storage : file,/var/tmp,512M
   varnishlog_file : /var/log/varnish/varnish-cache.log
   varnishd_ttl : 3600


Regards,

Steve


On Oct 24, 2007, at 4:33 AM, Ingvar Hagelund wrote:

> I take this off varnish-misc as it is quite distro specific.
>
> * Ingvar Hagelund
>>> The RedHat and Debian init scripts reads default values from their
>>> respective defaults file, that is, for RedHat, /etc/sysconfig/ 
>>> varnish,
>>> and for Debian, /etc/defaults/varnish.
>
> * Dag-Erling Smørgrav
>> The problem is that if you define DAEMON_OPTS, none of the other  
>> knobs
>> work, right?  FreeBSD at least has that issue:
>>
>> if you define varnishd_flags, you have to specify everything  
>> manually,
>> since the other knobs only serve to populate the default value for
>> varnishd_flags.
>
> At least for RedHat, there are no other knobs. All the startup
> configuration is in the file. There are no hard coded values in the  
> init
> script. The init script won't start varnishd if DAEMON_OPTS is  
> empty, or
> the config file does not exist.
>
>         if [ "$DAEMON_OPTS" = "" ]; then
>             echo "\$DAEMON_OPTS empty."
>             echo -n "Please put configuration options in
> /etc/sysconfig/varnish"
>             echo_failure
>
> The configuration file is fairly documented with the most used  
> options,
> and points to the manpage for more advanced users.
>
> I would not know if this is suitable for FreeBSD ports, but I think  
> it's
> quite a clean method to ensure that the user knows what she wants to
> change before changing it. As for myself, I dislike magic "invisible"
> default values.
>
> Ingvar
>
> -- 
> Buddha wears an iPod
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-misc

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.linpro.no/pipermail/varnish-dist/attachments/20071024/767976cc/attachment.htm 


More information about the varnish-dist mailing list