2

Is there a way to activate the Varnish use using the command line, not the admin interface? In the bin/magento comand line tool there are options for cache but nothing specific for Varnish.

I am building an Ansible script that automatizes the installation and configuration of the M2EE and this step seems that has to be done manually (which I did and works well). I would prefer a command line action than changed direct values in the mySql, but maybe you have other suggestions.

2

How about adding mysql script.sql with the following contents:

insert into core_config_data(scope,scope_id,path,value) values ('default',0,'system/full_page_cache/caching_application',2), ('default',0,'system/full_page_cache/varnish/access_list','localhost'), ('default',0,'system/full_page_cache/varnish/backend_host','localhost'),('default',0,'system/full_page_cache/varnish/backend_port','8080');

You can change localhost and 8080 to your varnish settings.

  • thanks, as I said I would consider this my second option, as I see it "hackish" - because it modifies directly values in the db and overpassing whatever business logic M2 may have when doing the proper activation. – Elzo Valugi Mar 29 '17 at 11:06
1

Use:

./bin/magento config:set system/full_page_cache/caching_application 1

And follow the same patterns for the other paths, like so:

./bin/magento config:set system/full_page_cache/varnish/access_list localhost ./bin/magento config:set system/full_page_cache/varnish/backend_host localhost ./bin/magento config:set system/full_page_cache/varnish/backend_port 8080

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.