michaelmcandrew / civicrm-buildkit-docker

This is a read only copy. Please make PRs here: https://lab.civicrm.org/michaelmcandrew/civicrm-buildkit-docker
https://lab.civicrm.org/michaelmcandrew/civicrm-buildkit-docker
GNU Affero General Public License v3.0
40 stars 31 forks source link

Localhost network issue, or just too resource intensive for this hardware? #55

Open phillipadsmith opened 4 years ago

phillipadsmith commented 4 years ago

Hey there @michaelmcandrew,

First, thank you for your work on this. It appears to make it blissfully simple to get Drupal + CiviCRM set up on my laptop for local development.

I'm wondering, however, if I'm encountering a networking issue or if my laptop is just under powered for the job of running this Docker stack?

What I'm experiencing is that initial network request to the running application on http://drupal8-clean.localhost:7979 will take anywhere from 30 seconds to a minute before a response is sent. Once the response starts coming, it comes quickly.

That leads me to believe it's a networking issue, but I'm not sure where to start my efforts at investigation given my limited experience with Docker containers.

My laptop specs are as follows: 3.1 GHz Intel Core i7 16 GB 1867 MHz DDR3 1TB SSD OSX 10.13.6

Though it's not the newest machine, it's been sufficiently responsive when running Docker applications in the past.

Any pointers on where to start poking around to get this development environment a bit more snappy would be greatly appreciated. 🙏

Many thanks in advance, Phillip.

wmortada commented 4 years ago

That laptop doesn't sound under-powered to me. Sounds very similar to my spec (2.7GHz IntelCore i7 x4, 16GB RAM, 500GB SSD). The main difference is that I'm running Ubuntu rather than OSX. It runs pretty snappily for me. Perhaps someone else who is running a Mac could advise?

phillipadsmith commented 4 years ago

That laptop doesn't sound under-powered to me. Sounds very similar to my spec (2.7GHz IntelCore i7 x4, 16GB RAM, 500GB SSD). The main difference is that I'm running Ubuntu rather than OSX. It runs pretty snappily for me. Perhaps someone else who is running a Mac could advise?

@wmortada Did you make any changes to the default networking setup? To me, it feels like a network resolution issue with routing to the sub-domain on localhost .

phillipadsmith commented 4 years ago

@michaelmcandrew Any thoughts on the above?

EDIT: I installed this on a small Linode server (2GB RAM) and it's very, very fast. Given that, I believe more strongly that this is some kind of localhost routing / networking issue on my laptop.

wmortada commented 4 years ago

@phillipadsmith I didn't make any changes to the network. It works pretty much out of the box for me. The only change I had to make was to the UID as per the readme.

phillipadsmith commented 4 years ago

The only change I had to make was to the UID as per the readme.

Had a look again and that didn't apply in my case.

I've re-built the containers and then re-created the CiviCRM install using buildkit/civibuild and it's exactly the same issue, unfortunately. Basically, unusable. :(

Getting this warning too: Screenshot_2020-05-11__7_21_PM

michaelmcandrew commented 4 years ago

Hey @phillipadsmith - I thought I had replied to this but I don't see any comments above - sorry.

It sounds like it might be a network issue and that it is probably mac specific (docker networking is a little different on macs). I don't think your laptop is under powered. I haven't got any experience with Drupal 8 or macs so it is kind of tricky to help. I can offer some general debugging advice but you'll probably have to do the digging yourself and or find other mac and/or Drupal 8 users and see if they have had experienced similar problems.

initial network request to the running application on http://drupal8-clean.localhost:7979 will take anywhere from 30 seconds to a minute before a response is sent. Once the response starts coming, it comes quickly.

Does this delay happen for every request? It sounds a bit like a timeout issue. I know that CMS's often ping back to the mother ship to check for updates, etc. I wonder if it is trying to do this each time and one of these requests is timing out.

I am presuming that those containers can contact the outside world if you have been able to install things but going into the container and running a command like time echo "<?php file_get_contents('https://civicrm.org');" | php would be useful to double check.

Creating and opening a test.php file in /buildkit/build/drupal-demo/web with <?php phpinfo(); would be useful in indicating whether the problem is in or outside the Drupal 8 application code.

The other thing to suggest would be to turn on debugging with xdebug (which is fairly simple if you have an editor that supports it - I use vscode), break at exceptions, and see if you can track down the call that is taking so long. That would likely help pinpoint the problem.

wmortada commented 4 years ago

Hi @phillipadsmith just a note that the warning you are getting is nothing to do with Docker, CiviCRM or Buildkit. It is an incompatibility of the Drupal userprotect module with PHP 7.3. I've seen the same error when creating dmaster.

I would however take that as a positive sign that you've installed Drupal and CiviCRM!

phillipadsmith commented 4 years ago

@michaelmcandrew @wmortada Many thanks for your patience with my slow response -- I missed these notifications earlier somehow.

In the end, I just installed a vanilla version of Ubuntu 18.04 -- to match what's running on our production server -- in VirtualBox, and then ran Buildkit there instead.

Worked perfectly, and runs super fast.

The more I was reading up on Docker these last week, the more I'm feeling like it's not a solution that's optimized for running on OSX, and thus -- given that I don't use it to deploy anything -- is probably not the right way to go anyway.

Happy to do some sleuthing, however, if that's helpful. I still have it installed.

wmortada commented 4 years ago

@phillipadsmith glad you managed to get Buildkit running on Ubuntu.

phillipadsmith commented 4 years ago

glad you managed to get Buildkit running on Ubuntu.

Was a piece of cake!

michaelmcandrew commented 4 years ago

this sounds like a good approach

szechyjs commented 3 years ago

I experience the same slowness issue with a more than capable i7 MBP. I did a test with a phpinfo() page and it is super fast as one would expect, however, it's all downhill from there. A plain Wordpress page (without any CiviCRM content) takes about 10s to respond, and any page with CiviCRM content easily takes 30s (or more) for a response.

michaelmcandrew commented 3 years ago

@szechyjs - thanks for the report. It seems mac specific but I don't have a mac so can't really help with this, though I would be happy to help you help yourself.

szechyjs commented 3 years ago

I'm willing to bet this might be the solution: https://stackoverflow.com/a/56408694/280980

I've seen similar things in the past, the way docker on mac mounts directories is not very efficient.

michaelmcandrew commented 3 years ago

Yes, that sounds like it could potentially work. Feel free to explore that route if you want to. If you do work out a solution, then hopefully we will be able to integrate it in a way that does not add unnecessary complexity for the linux people :)

dandrzejewski commented 2 years ago

This is happening to me too, using Docker on Windows.

I'm trying to investigate but not getting too far, watching the apache logs, I don't see a single thing logged until about 15 seconds after the request, which is when everything goes through.

That said, I think it might be apache, because when I comment out the:

` <Directory "/buildkit/build/wp-clean/web"> Options All AllowOverride All

Require all granted
</Directory>`

In the apache configs, I at least get a 403 instantly.

michaelmcandrew commented 2 years ago

Hey @dandrzejewski - let me know if you have any specific questions I can try and answer :)