ece-tools icon indicating copy to clipboard operation
ece-tools copied to clipboard

Add option for http_cache_hosts

Open phoenix-bjoern opened this issue 6 years ago • 8 comments

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.

phoenix-bjoern avatar Mar 02 '20 00:03 phoenix-bjoern

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 avatar Mar 02 '20 18:03 YPyltiai

@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 avatar Mar 04 '20 16:03 phoenix-bjoern

@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?

YPyltiai avatar Mar 04 '20 16:03 YPyltiai

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 avatar Mar 09 '20 17:03 shiftedreality

@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.

phoenix-bjoern avatar Aug 13 '20 10:08 phoenix-bjoern

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

NadiyaS avatar Oct 26 '20 18:10 NadiyaS

@phoenix-bjoern is this request still actual?

andriyShevtsov avatar May 31 '22 19:05 andriyShevtsov

Yes, it is and I would be happy if this gets option gets supported in ece-tools.

phoenix-bjoern avatar Jun 01 '22 05:06 phoenix-bjoern