cancel
Showing results for 
Search instead for 
Did you mean: 

Can't make Varnish in Jelastic work with Magento

Can't make Varnish in Jelastic work with Magento

Hey,

 

I'm trying to use Varnish in my store which is Magento CE 2.2.7 but I can get it to work. My website is hosted in Jelastic with a node with apache and another with sql and now a varnish (5.2.1) one.

I tried several ways but can't get it to work. I went to magento backoffice and changed to Varnish and in the config form I inserted the IP and the port then exported the VCL and swaped with the default one changing the name to default. In the Varnish config I changed to 80 the ports. Restarted both nodes (Varnish and Apache) and nothing. What do i need to do more? or what I did wrong?

 

Thanks Smiley Very Happy

3 REPLIES 3

Re: Can't make Varnish in Jelastic work with Magento

Hello!
You need to initialize a director by setting its distribution algorithm and adding backend.
Please add the next section to varnish configuration

sub vcl_init {
  new myclust = directors.round_robin();
  myclust.add_backend(default);
}
sub vcl_recv {
    set req.backend_hint = myclust.backend();
    if (req.method == "PURGE") {
    ........

Also you can deploy Magento cluster from JPS
https://github.com/jelastic-jps/magento-cluster/blob/master/manifest.jps
via import https://docs.jelastic.com/environment-import
and check our varnish configuration.

Thanks,

Re: Can't make Varnish in Jelastic work with Magento

Thanks for the reply, in default.vcl that was the export from magento I added those lines but it gives 

Symbol not found directors.round_robin at (/etc/varnish/default.vcl Line 26 Pos 19)

I tried with hash() too and the result was the same.

 

The import it is possible to add that to a node in a project or it's needed to create a new project? I only saw how to create a new one

 

--------

 

It missed

import directors;

now it does not give me any error but doesn't seem to work anyway

 

Thanks Smiley Very Happy

Re: Can't make Varnish in Jelastic work with Magento

Could you provide all the content of the config /etc/varnish/default.vcl?

Thanks