Add option for http_cache_hosts
To enable Varnish in env.php an additional command needs to be executed:
bin/magento setup:config:set --http-cache-hosts=varnish
It seems there is no possibility to append
'http_cache_hosts' => [
[
'host' => 'varnish'
]
]
to env.php in ece-tools.
Hi @phoenix-bjoern , did you try extending this via scenarios? If it's a single command to be done during deploy, you may be able to add it via scenarios for now, since we cannot add it natively to main scenario until we have good ways of testing it and running in production.
See this: https://devdocs.magento.com/cloud/deploy/scenario-based-deployment.html
@YPyltiai thanks for the feedback. Of course this would be doable. However I think this is a missing feature as Varnish is the default FPC on-premise and in order to invalidate cache elements the setting in env.php is required. IMHO support in ece-tools is a must-have. Would you accept a PR if we would takeover the coding part?
@phoenix-bjoern it makes sense - my only comment is about the design part of it. Current flows are specific to Cloud and we added scenario concept to allow for out of Cloud customization. We just need to think if we just do the variable here to control it or fork scenario & extend it for Varnish support there (out of Cloud scenario). We should accept PR but let's discuss this design question first. Let me tag few people here.
@NadiyaS , @shiftedreality , @kandy - what do you guys think?
I would like to suggest leaving this functionality in ./bin/magento and add to ECE-Tools via separate customized Step if needed instead of adding functionality directly into the package.
@shiftedreality @YPyltiai We can either use bin/magento or the config writer to set the http_cache_hosts to the app/etc/env.php. But what about the configuration of the varnish hostname? Would it be part of
MAGENTO_CLOUD_RELATIONSHIPS ? Maybe like this:
{
...
"redis": [
{
"host": "redis",
"port": "6379"
}
],
"varnish": [
{
"host": "varnish1, varnish2",
}
]
}```
IMHO this is an architectural decision. If you let us know what your thoughts are on that we can create a PR for it.
Hi @phoenix-bjoern
MAGENTO_CLOUD_RELATIONSHIPS is not configured by ece-tools on cloud environments, but you may set your own environment variable (e.g. CUSTOM_CONNECTIONS) which has the same structure as MAGENTO_CLOUD_RELATIONSHIPS with all service's connections and ece-tools will read data from your variable instead of MAGENTO_CLOUD_RELATIONSHIPS. For this you need to redefine the name of variable in ENV_RELATIONSHIPS. See https://github.com/magento/ece-tools/blob/develop/config/schema.yaml#L662
@phoenix-bjoern is this request still actual?
Yes, it is and I would be happy if this gets option gets supported in ece-tools.