devdocs icon indicating copy to clipboard operation
devdocs copied to clipboard

Compatibility concerns with Varnish 6.4

Open medigeek opened this issue 3 years ago • 2 comments

General issue

Topic: https://devdocs.magento.com/guides/v2.4/config-guide/varnish/config-varnish-configure.html

Description:

The file /etc/varnish/varnish.params is missing / not found on CentOS 7 with newer versions of varnish 6.x

According to the official "what's new" document of varnish:

The biggest change that resulted in unifying our systemd setup across all official packages is that the varnish.params file available on Red Hat derivatives is gone. We noticed that using an environment file to hide the fact that varnishd is configured via command line arguments misled some people into thinking that what was proposed in the file was your only set of configuration options. For example, you can specify multiple listen addresses using multiple -a options but you only get variables for one address and a catch-all variable DAEMON_OPTS for anything not fitting in the template. In addition using an environment file pollutes the process’s environment.

Possible solutions:

We could add a note/workaround in the docs about this missing varnish.params issue, as a lot of people will definitely stumble upon this issue while trying to upgrade to varnish 6.4 and magento 2.4.2.

The recommended solution is:

EDITOR=nano systemctl edit --full varnish

this is basically a wrapper to:

cp /lib/systemd/system/varnish.service /etc/systemd/system/varnish.service
nano /etc/systemd/system/varnish.service

Change the port 6081 to 80: ExecStart=/usr/sbin/varnishd -a :80 -f /etc/varnish/default.vcl -s malloc,256m

Then restart varnish:

systemctl stop varnish
systemctl start varnish
systemctl status varnish

Verify the varnish is listening on port 80:

netstat -plntu | grep 'varn\|80'

Additional information:

We installed varnish 6.4 on centos 7 using the packagecloud.io https://packagecloud.io/varnishcache/varnish64

curl -s https://packagecloud.io/install/repositories/varnishcache/varnish64/script.rpm.sh | sudo bash
yum info varnish
yum install varnish

medigeek avatar Jul 11 '21 10:07 medigeek

Hi @medigeek. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Jul 11 '21 10:07 m2-assistant[bot]

Thanks for taking the time to let us know about this. We are looking into your solution.

hguthrie avatar Jul 14 '21 14:07 hguthrie