When scaling up, its necessary to have more than one varnish server, due to the way the config is tied to site config, it makes this very messy, requesting multi hosts for one purger
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | 2843978-33.patch | 6.51 KB | kiseleva.t |
| #32 | varnish_purge-multiple_ips-2843978-32.patch | 6.32 KB | kala4ek |
| #26 | Screenshot from 2023-06-01 09-39-07-redacted.png | 394.55 KB | jerrac |
| #14 | varnish_purge-ui-multiple-hosts.png | 138.47 KB | jkruppa |
| #12 | interdiff-2843978-10-12.txt | 1.07 KB | jkruppa |
Issue fork varnish_purge-2843978
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
zach.bimson commentedVery basic first run at a patch for this.. DOES NOT include admin form...
Discussion to be had around if this should be generic and added to http purge instead
Could create a new varnish purge multiple and have the host name field as a read-only list ?
What alternatives do we have for a multi valued text box ?
Comment #3
zach.bimson commentedComment #4
zach.bimson commentedComment #5
Saphyel commentedComment #6
zach.bimson commentedThanks for the review carlos, new patch here
Comment #7
Saphyel commentedComment #8
misc commentedSorry for not giving this attention, currently I have no access to environment with multiple varnish instances and can not test the code. So If anybody could do a review, by my guest :-)
Comment #9
jchatard commentedHi, I can confirm that the patch #7 is working fine on my setup with 2 Varnish instances.
The only drawback is that as mentioned by @zach.bimson, UI has not been updated so the configuration has to be overridden at the
settings.phplevel, which in my situation is exactly what I need/want.But this might no be the case for most users.
Cheers,
Jérémy
Comment #10
grimreaperHello,
Thanks for the patch. I can confirm it works (on at least still one Varnish).
But when going to the config inspector page I got a fatal error.
I have adapted the config schema. Here is a new patch.
Comment #11
misc commentedComment #12
jkruppa commentedHello,
Thanks for this patch, I'm also in the situation where I have 2 Varnish servers and the patch in #10 worked well.
I modified the patch to remain compatible when using a single Varnish, or not overriding conf in
settings.php.Multiple hotsnames can be set in the config form by separating names with a single blank space.
Comment #13
misc commentedWe had some changes in the code because of recent minor changes for coding standards etc - so patch fails now - so it would be great if you have the time for a re-roll?
Comment #14
jkruppa commentedHello,
Here is the last patch updated for the 8.x-1.x-dev version.
It has been tested successfully with two Varnish servers, both received purge/ban requests.
You can still use multiple hostnames from the UI :

Comment #15
nicrodgersPatch 14 applies cleanly to latest dev and works as per older version of the patches. Thanks for the reroll!
Comment #16
regilero commentedNote that patch #14 is fixing the VarnishPurger but it breaks the VarnishBundledPurger.
Comment #17
jerrac commentedPatch #14 worked for me against 8.x-2.1.
Can this get merged soon?
Comment #18
dasginganinjaI just queued a retest for the patch in #14 since it had a failure when it was uploaded. Hopefully the tests pass. 🤞
It appears that #16 has an issue with VarnishBundledPurger and this patch doesn't cover that.
At a minimum this should get reviewed and the tests should pass? It sounds like it needs work though.
If I get some availability in the coming months I'd like to take a peek at this unless somebody gets to it first.
Cheers!
Comment #20
goz commentedThis is still the case for 8.x-2.x, but patch does not apply
Comment #22
goz commentedMerge request use #14, but re-roll for 2.x
Comment #23
izus commentedPatch #21 worked for me against 8.x-2.2.
Thanks
Comment #24
zach.bimson commentedLove the power of the community! 6 years we are in :D
Comment #25
misc commentedCould someone please review this?
Comment #26
jerrac commentedJust ran into a need for this again. But #21 won't apply.
This is with explicitly setting varnish_purge to version ^2.x-dev in composer.json and using cweagans/composer-patches to apply the patch.
I initially tried with 2.1 and 2.2, not dev.
I also pulled up the patch dialog in PHPStorm and it said it can't apply a hunk.
Don't have time right now to dig in deeper. Hope this helps.
Comment #27
just_like_good_vibesif you use the patch derived from the MR 11 of @goz, it should be fine.
use this URL for the patch :
https://git.drupalcode.org/project/varnish_purge/-/merge_requests/11.patch
I have started testing this patch on the last version 2.2 and it seems to work fine.
Comment #28
jerrac commentedEr, I'm 99% sure that's the url I used when I was trying to patch.
That said, long story, but I ended up switching to the http purger built into Purge and was able to make it work. Just added a purger per instance of varnish.
Comment #29
clemorphyFor me, using https://git.drupalcode.org/project/varnish_purge/-/merge_requests/11.patch introduces a bug.
It fails to correctly send ban requests, queue is not decreasing, varnish cache is never cleared. I have the following error in the cron logs :
Drupal\purge\Plugin\Purge\Purger\Exception\BadPluginBehaviorException : Only NOT_SUPPORTED, PROCESSING, SUCCEEDED and FAILED are valid outbound states. dans Drupal\purge\Plugin\Purge\Invalidation\InvalidationBase->setStateContext() (ligne 144 de /var/www/ppd/xxxxxxxxx/web/modules/contrib/purge/src/Plugin/Purge/Invalidation/InvalidationBase.php).I am using a "Varnish Bundled Purger" with only one host set in my purger config.
Comment #30
o'briatIf your Varnish servers are load balanced, it should be easier to add a specific rules to your load balancer (filtered on drupal IP + PURGE/BAN method) so it send the request to both all Varnish instances, but... traffic mirroring seems to be as complex :( (ex: https://www.haproxy.com/documentation/haproxy-enterprise/enterprise-modu...)It seems that a another solution exist with the following haproxy config (not tested myself):
https://github.com/PHI67/http-multicaster
Comment #31
o'briatWhy not take example on the ZeroConfig Purger?=> (edit) very bad ideaIt does multiple call based on the reverseProxies list:
https://git.drupalcode.org/project/varnish_purge/-/blame/8.x-2.x/src/Plu...
See also issue https://www.drupal.org/project/varnish_purge/issues/3273684
Comment #32
kala4ekFresh patch based on 11MR (but it can be applied to latest 2.3 release). And also safe to use with composer.
Comment #33
kiseleva.t commentedExported MR11 for release 2.2 into patch file.