I'm trying to set the varnish settings through environmental variables. I have the following ones set:
CONFIG__DEFAULT__SYSTEM__FULL_PAGE_CACHE__VARNISH__BACKEND_HOST: varnish-service CONFIG__DEFAULT__SYSTEM__FULL_PAGE_CACHE__VARNISH__BACKEND_PORT: 8090
If I go to the settings for Full Page Cache I can verify that it's set to the above mentioned values. See image below.
My problem comes when I'm trying to run
bin/magento cache:clean. In my
system.log I get the following error:
main.CRITICAL: Unable to connect to varnish:80 . Error #0: stream_socket_client(): unable to connect to varnish:80. As you can see these values are not respected when cleaning the cache.
To solve this for now I need to run
bin/magento setup:config:set --http-cache-hosts=varnish-service:8090 which solves the issue but I would still like Magento2 to respect the values I set through the environment variables so I can control it without running commands on the containers.
Magento version is 2.3.1 and I'm running my containers in Kubernetes.