bash
bin/magento varnish:vcl:generate --access-list localhost --backend-host localhost --backend-port 8080 --output-file var/default.vcl
bash
varnishadm vcl.load default var/default.vcl
varnishadm vcl.use default
var/default.vcl file, pay attention to correct row return (miss);sub vcl_hit {
if (obj.ttl >= 0s) {
# Hit within TTL period
return (deliver);
}
if (std.healthy(req.backend_hint)) {
if (obj.ttl + 300s > 0s) {
# Hit after TTL expiration, but within grace period
set req.http.grace = "normal (healthy server)";
return (deliver);
} else {
# Hit after TTL and grace expiration
return (miss);
}
} else {
# server is not healthy, retrieve from cache
set req.http.grace = "unlimited (unhealthy server)";
return (deliver);
}
}
````
varnishadm command loads and activates config.var/default.vcl file, pay attention to deprecated return (fetch);sub vcl_hit {
if (obj.ttl >= 0s) {
# Hit within TTL period
return (deliver);
}
if (std.healthy(req.backend_hint)) {
if (obj.ttl + 300s > 0s) {
# Hit after TTL expiration, but within grace period
set req.http.grace = "normal (healthy server)";
return (deliver);
} else {
# Hit after TTL and grace expiration
return (fetch);
}
} else {
# server is not healthy, retrieve from cache
set req.http.grace = "unlimited (unhealthy server)";
return (deliver);
}
}
````
varnishadm commands results with error...in subroutine "vcl_hit"
...
sub vcl_hit {
----#######--
...which is the "vcl_hit" method
Legal returns are: "deliver" "fail" "miss" "pass" "restart" "synth"
Running VCC-compiler failed, exited with 2
VCL compilation failed
Command failed with error code 106
````
Hi @shkoliar. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.3-develop instance - upcoming 2.3.x release
For more details, please, review the Magento Contributor Assistant documentation.
@shkoliar do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
FYI, varnish VCL config generated from Magento admin panel has correct values. The issue is related only to bin/magento varnish:vcl:generate command.
Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Verify that the issue is reproducible on 2.2-develop branch. Details
- Add the comment @magento give me 2.2-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x
[ ] 6. Add label Issue: Confirmed once verification is complete.
[ ] 7. Make sure that automatic system confirms that report has been added to the backlog.
@magento give me 2.2-develop instance
Hi @engcom-Bravo. Thank you for your request. I'm working on Magento 2.2-develop instance for you
Hi @engcom-Bravo, here is your Magento instance.
Admin access: https://i-23670-2-2-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
:white_check_mark: Confirmed by @engcom-Bravo
Thank you for verifying the issue. Based on the provided information internal tickets MC-18131, MC-18132 were created
Issue Available: @engcom-Bravo, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._
After digging in the source code for bin/magento varnish:vcl:generate cli command, I've found out that command line parameter --export-version responsible for vcl version output.
To sum up, --export-version parameter, when omitted, defaults to Varnish 4, and to get vcl config for Varnish 5 we need to include that parameter with corresponding version value.
It would be good to add more information about varnish:vcl:generate command to dev docs.
Dev docs have a note about actual command and its parameters, but no detailed description and defaults like for other commands.
https://devdocs.magento.com/guides/v2.2/reference/cli/magento.html
https://devdocs.magento.com/guides/v2.3/reference/cli/magento.html
FYI: I managed to reproduce the issue on Magento 2.3.2 when I exported the vcl file from the admin panel (Varnish 4). Solved it manually by editing the file & replacing the fetch with miss on sub vcl_hit{...}.
Most helpful comment
FYI: I managed to reproduce the issue on Magento 2.3.2 when I exported the vcl file from the admin panel (Varnish 4). Solved it manually by editing the file & replacing the
fetchwithmissonsub vcl_hit{...}.