Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 480252 - www-servers/varnish - add support for running multiple instances
Summary: www-servers/varnish - add support for running multiple instances
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-08 12:07 UTC by frank
Modified: 2014-07-30 14:58 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
init script patch for multiple instances support (initscript.diff,2.63 KB, patch)
2013-11-08 20:10 UTC, frank
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description frank 2013-08-08 12:07:18 UTC
as www-servers/varnish supports running multiple instances with the -n parameter it would be nice if gentoo's init script/configuration would do it too the same way as eg. packages like mysql and openvpn do...
i'll look into this myself when i'll get an idea what's the right way to implement it. if the maintainer would give me a hint in the right direction i would really appreciate it ;)

Reproducible: Always
Comment 1 Anthony Basile gentoo-dev 2013-08-08 13:58:08 UTC
(In reply to frank from comment #0)
> as www-servers/varnish supports running multiple instances with the -n
> parameter it would be nice if gentoo's init script/configuration would do it
> too the same way as eg. packages like mysql and openvpn do...
> i'll look into this myself when i'll get an idea what's the right way to
> implement it. if the maintainer would give me a hint in the right direction
> i would really appreciate it ;)
> 
> Reproducible: Always

It might be possible to create a bash string of named instances which we loop over and start one instance of varnish per instance.  Take a look at man varnishd:

       -n name
              Specify  a  name  for  this instance.  Amonst other things, this
              name is used to construct the name of  the  directory  in  which
              varnishd  keeps  temporary  files  and persistent state.  If the
              specified name begins with a forward slash, it is interpreted as
              the absolute path to the directory which should be used for this
              purpose.

So the bash would look something like:

INSTANCES="a b c"
for i in $INSTANCES ; do
    echo "pretending to start varnishd -n $i"
done


Give it a go, see where you get.
Comment 2 frank 2013-11-08 20:10:20 UTC
Created attachment 362810 [details, diff]
init script patch for multiple instances support

i finally had some time to come back to this, so inspired by memcached's init script here we are with an improved varnishd init script...
disclaimer: i ignore gentoo's rc coding guidelines so feel free to adjust it before (hopefully) applying it to the package and of course i only guarantee it works for me ;)
Comment 3 Anthony Basile gentoo-dev 2014-05-21 12:57:20 UTC
(In reply to frank from comment #2)
> Created attachment 362810 [details, diff] [details, diff]
> init script patch for multiple instances support
> 
> i finally had some time to come back to this, so inspired by memcached's
> init script here we are with an improved varnishd init script...
> disclaimer: i ignore gentoo's rc coding guidelines so feel free to adjust it
> before (hopefully) applying it to the package and of course i only guarantee
> it works for me ;)

frank, sorry for the delay in answering.  Can you update and test the patch against www-servers/varnish/files/varnishd.initd-r2 since there have been some changes since you submitted the above patch.  I'm not so worried about merging which I can manually figure out as the testing.
Comment 4 Christian Ruppert (idl0r) gentoo-dev 2014-05-22 20:28:54 UTC
Hi Frank,

please give varnish-4.0.0-r1 a try. It got some major changes and running multiple instances of either varnishd, varnishncsa and/or varnishlog should work perfectly fine now.

Just link /etc/init.d/varnishd.foo -> /etc/init.d/varnishd, create a new config /etc/conf.d/varnishd.foo and adjust the config file there as well as the listening port of varnishd. The same can be done for varnishncsa and varnishlog.
Comment 5 Anthony Basile gentoo-dev 2014-06-09 19:18:11 UTC
(In reply to Christian Ruppert (idl0r) from comment #4)
> Hi Frank,
> 
> please give varnish-4.0.0-r1 a try. It got some major changes and running
> multiple instances of either varnishd, varnishncsa and/or varnishlog should
> work perfectly fine now.
> 
> Just link /etc/init.d/varnishd.foo -> /etc/init.d/varnishd, create a new
> config /etc/conf.d/varnishd.foo and adjust the config file there as well as
> the listening port of varnishd. The same can be done for varnishncsa and
> varnishlog.

Christian, if your satisfied with your fix, let's just close this.
Comment 6 Anthony Basile gentoo-dev 2014-07-30 14:58:56 UTC
I think we're done here.  Reopen if this is still an issue.