Add elgentos/magento2-varnish-extended dependecy for optimized varnish VCL generation#273
Conversation
|
Thanks! I agree with this in principle. I want to review the module (but I know it's widely used and well trusted). I'm in favor of this for Mage-OS 3.0. |
|
I'm taking a look on this one. Ideally I'll be running some manual test, run automated tests, but any comment/idea to improve the testing is welcomed @dadolun95 @rhoerr |
|
Note the module requires PHP 8.3+, but Magento 2.4.9 (and by proxy Mage-OS 3) will too, so that's fine. |
|
Few information
Store that gets this module installed with the VCL configured
PHP 8.3 To sum up: |
|
@ryan |
|
@peterjaap What do you think? Is this module something that can be bundled with Mage-OS for general installation? Should it be? (Will it be beneficial? Are there risks or side effects we should consider?) |
|
@rhoerr it definitely can! One thing to note is that the notation for variables in the VCL has changed. Magento core uses:
Our extension uses;
I've seen this trips some people up. Also, in an earlier update BF cache has been added to Mage-OS, which is also in this extension. So that would then have double functionality. |
I just did a quick comparison with claude VCL Comparison: default (OOTB) vs elgentos extension
I think this is really cool @peterjaap @rhoerr Looks like the bf cache support was introduced in the theme-optimization module https://github.com/mage-os/module-theme-optimization/blob/main/Plugin/Framework/App/Response/Http.php Here's a quick comparison between them:
IMHO The modules are complementary, not alternatives. module-theme-optimization's own README already recommends elgentos for Varnish users (feel free to correct me if anything I've added is wrong or I am hallucinating) I can run some tests with both running, what do you think? |
|
The theme optimization module is definitely complementary with this, not conflicting. We decided not to touch varnish configuration there at all. They should be fine to use together. Bfcache there really only applies to native FPC. What happens if varnish xkey isn't installed? It looks like there's a setting to turn that aspect off. |
There is an option to disable it and it will fallback to the ban mechanism The only concern is when the configuration is enabled and xkey is not installed, I think it will break Varnish compilation error and/or the service might start to behaving weird or to reload. Ideally this is covered, but a configuration could bring the site down (I assume there are others configurations that can bring the site down as well already in Magento if you don't have locked the configuration) |
|
@marcelmtz I think the VCL won't even compile so it won't bring the site down |
rhoerr
left a comment
There was a problem hiding this comment.
Thanks! Given that, I'm good with bundling this. It seems like a clear improvement for anyone that is using Varnish and applies the updated VCL, and minimal risk or impact for anyone that isn't.
Let's hold a week for any other input.
|
Just tested, the VCL indeed doesn't compile when xkey isn't installed. The VCL won't load at all — it stays in a failed state and your previously active VCL remains in use (if one was already loaded). So no traffic impact if you're hot-reloading on a running instance. |
|
I gather it can still be disabled if needed? My concern woudl be automated CI deploy on initial release to hosting like hypernode. Can this affect compatibility? If so, this needs to be very well highlighted, and documented steps to perform maybe? Basically...how can this affect managed hosting solutions, and deployment? (all my deploys are 100% automated on a daily deploy schedule. what is in live branch, gets deployed.) I am for it, why not improve, things |
|
@ProxiBlue the extension doesn't do anything if you don't generate the VCL. So unless you generate the VCL in your pipeline, nothing happens after adding it. |
|
@peterjaap and it does not alter or disable existing generate vcl for varnish currently setup with my hypernode. that will continue to function after this is deployed into server? There were a few manual steps to do to setup varnish into hypernode, https://docs.hypernode.com/ecommerce-applications/magento-2/how-to-configure-varnish-for-magento-2-x.html#configure-magento-2-x-for-varnish So I just need to be sure that won;t break, and current vcl already setup and imported will just keep on working? |
|
Yes that will change, since the command varnish:vcl:generate is then taken care of by https://github.com/elgentos/magento2-varnish-extended/blob/master/Console/Command/GenerateVclCommand.php It should just do a fallback using the new VCL. So it will apply the optimized VCL when you run those commands that are mentioned in the Hypernode docs. |
Thank your for testing it out <3 |
|
Added two PRs to the elgentos repo I would love to see included before its merged into Mage-OS Security: elgentos/magento2-varnish-extended#126 |
|
I poked the PRs. Going to merge this now either way. |
As discussed during Mage-OS hackaton on December 14, we should include optimized vcl version for varnish.
This dependency includes bf-cache support, removes all marketing get parameters to minimize the cache objects, adds vmod xkey support.