Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

varnish setup #153

Closed
IJOL opened this issue Sep 12, 2021 · 4 comments
Closed

varnish setup #153

IJOL opened this issue Sep 12, 2021 · 4 comments

Comments

@IJOL
Copy link

IJOL commented Sep 12, 2021

Hi Jeroen:

We are trying to get varnish to work locally we got a functional vcl from magento2 itself, we changed the vcl to "backend" host and port 80, AFAIK this should work..put it in conf, but we got "backend fetch failed" from varnish, any idea why?

@julienloizelet
Copy link
Contributor

Hi @IJOL, I will let @JeroenBoersma answers but if it can help, I succeeded in making Varnish locally working by modifying the generated VCL as below:

  • First, I removed the following part:
 .probe = {
    .url = "/pub/health_check.php";
    .timeout = 2s;
    .interval = 5s;
    .window = 10;
    .threshold = 5;
    }

@IJOL
Copy link
Author

IJOL commented Sep 13, 2021

Many thanks Julien, after your comments and the #98 comments, we found the varnish related dev subcommands.. so its working now well..

But i wonder if your are working with latest magento v2.3.* and up , we were forced to make some adjustements to the way docroot it's set in the nginx web config, for magento2 host we needed to change docroot from $dev_customer/$dev_project and the usual htdocs later to htdocs/pub, and to be able to share this config with other hosts type ( namely magento1 ones ) made some ( to my view ) nasty fixes... you can have a look at them here [https://github.com/BITVAX/docker-compose-development/tree/trivax_100]... any help in better solving this issues?, or the way to solve them without nasty adjustments, as we may lack some knowledge of the way things are supposed to work with the repository master branch..

Thanks anyway your comment was really helpful

@julienloizelet
Copy link
Contributor

julienloizelet commented Sep 13, 2021

... we were forced to make some adjustements to the way docroot it's set in the nginx web config, for magento2 host we needed to change docroot from $dev_customer/$dev_project and the usual htdocs later to htdocs/pub...
Thanks anyway your comment was really helpful

Well, I never had to do this kind of changes in the nginx conf and I worked with Magento from 2.2 to 2.4.

I guess I won't be able to help you much on this but; just in case, I remember that it is quite important to have your sources in a magento2 folder.

I mean, I'm used to have the following directory structure :

docker-compose-development sources
│   
│ (sources of this repo)    
│
│   
└───workspace
    │   
    │
    └───m231
    │   │
    │   │   
    │   │
    │   └───magento2
    │    │   
    │    │ (sources of a Magento 2.3.1)    
    │
    │   
    │
    └───m242
         │   
         │
         └───magento2
          │   
          │ (sources of a Magento 2.4.2)    
    

p.s : you are maybe already using such a structure and there is maybe no link between your issue and my comment, but that's all is coming in my mind at this moment.

EDIT: I guess you should look at this file : https://github.com/JeroenBoersma/docker-compose-development/blob/master/build/dist/web/nginx/content/vars#L16
It seems that there is some magic that depends on the directory structure in order to define the "htdocs".
With my structure above, htdocs remains unchanged : "pub". But if your directory is called "magento", then it will be changed to "magento" as far as I understand, and then your nightmare begins :)

@IJOL
Copy link
Author

IJOL commented Sep 13, 2021

Hi..

Well given your directory structure i bet you were accessing with something like, http://m242.magento2.localhost or alike, and one of the automatic docroots is pub so far so good..

We were using dcd for magento1 previously with great success, and our dir struct was, as we did for m1 development

workspace -> customer -> project (m2|m1) -> htdocs

and issuing an url like http://customer.m2.magento2.localhost and thus all the tweaks we needed to do in nginx config....

Thanks.. more reading and less writing i should say in my case ;)

@IJOL IJOL closed this as completed Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants