You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
according to this article, since varnish 5 you can separate configurations by using labels.
situation:
single machine
1 varnish
2 (or even more) plone projects (running in separate zope instances)
(optionally using load balancing)
problem:
not able to configure that in the recipe
therefore manually adapting the generated vcl file(s)
here is a small introduction how to solve this:
create a section per domain/project to achieve its varnish config you desire:
buildout.cfg
[buildout]
parts+=
varnish-conf-1
varnish-conf-2
[varnish-configuration-base]
recipe = plone.recipe.varnish:configuration
# whatever settings you see fit for all the generated config files
# most commonly will be stuff like
# bind =
# cookie-whitelist =
# grace-* =
# health-probe-* =
# balancer =
# whatever else ...
[varnish-conf-1]
<= varnish-configuration-base
backends =
{domain-a}:127.0.0.1:{port-a like 8080}
{domain-a}:127.0.0.1:{port-b like 8081}
zope2_vhm_map =
{domain-a}:{plone instance inside zope; most often /Plone}
[varnish-conf-2]
<= varnish-configuration-base
backends =
{domain-b}:127.0.0.1:{port-a like 8090}
{domain-b}:127.0.0.1:{port-b like 8091}
{domain-b}:127.0.0.1:{port-b like 8092}
zope2_vhm_map =
{domain-b}:{plone instance inside zope; most often /Plone}
this will generate two files:
./parts/varnish-conf-1/default.vcl
./parts/varnish-conf-2/default.vcl
we can copy both files to /etc/varnish (assuming you are on Debian/ubuntu)
iham
changed the title
using multiple separate varnish configurations (labels)
solution: using multiple separate varnish configurations (labels)
Sep 14, 2022
according to this article, since varnish 5 you can separate configurations by using labels.
situation:
problem:
here is a small introduction how to solve this:
create a section per domain/project to achieve its varnish config you desire:
buildout.cfg
this will generate two files:
we can copy both files to /etc/varnish (assuming you are on Debian/ubuntu)
now lets go for the labels as mentioned in https://info.varnish-software.com/blog/one-vcl-per-domain and update/replace the /etc/varnish/default.vcl:
see the "vcl(conf-*)" lines?
those are the varnish labels which are loading the vcl files.
in order to make varnish do its label "magic" on each startup we need a script:
/etc/varnish/start.cli
in the systemd varnish.service change the parameters to use the start.cli instead of a file to load (empty -f is necessary):
and reload systemctl and service varnish restart.
done - no more handwritten code inside the generated varnish configs.
The text was updated successfully, but these errors were encountered: