Open jtreminio opened 5 years ago
Hi, nice article. Could you also post your docker-compose and docker version ?
Why not to use solution from https://stackoverflow.com/a/19273025/2553217 ?
perfect solution! I was able to do the same with varnish instead of nginx. @asvsot even turning remote autostart off, xdebug is still loaded as module and so still slower than completely turning the module off. I used to do it but of course the server needed to be restarted each time.
@jtreminio Genius is simple. Thanks a lot.
Magento developers... here is a complete solution implementation integrated with dockergento by ModestCoders (@danielozano) https://github.com/developersalliance/magento2-dockergento
Thanks for this. It saved me from buying a new machine due to enormous lag during development...
Your approach set me on the right path. I do not use docker for mac anymore (developing a Symfony app, it was too slow and too much hassle to get it working properly with all the sync issues).
Using brew with local installation of LEMP|LAMP stack works like a charm and is much faster. Although of course a little less portable than a Docker container, for this project it works better for me.
Since I do not use docker, I could not instantiate two docker contianers but implemented two instances of php-fpm running, each with different php.ini (for xdebug enable/disable) and with another fcgi config for having another pool listening on another port. This way, using nginx map, I map the request to the right port, both running on localhost :)
@jtborger If docker is still slow is about sync of files then. Checkout mutagen.io as this is a pretty badass over here right now, it made my Magento2 instance in docker work like a charm (ofc with help of this article. For now I just do sed command to turn on/off xdebug till will find time to implement this article to my setup.
Thanks for that incredible article. I tried to apply it. but apparently there is a bug in Nginx printing using a variable in fastcgi_pass
https://stackoverflow.com/questions/30463779/does-nginx-fastcgi-pass-support-variables https://www.ruby-forum.com/t/bug-with-variables-in-fastcgi-pass/155801/2
Wondering how could you achieve it?
Thanks for that too.
@salarmehr-cbs
I have a working example here: https://github.com/Carpenter0100/docker-setup
I think the port is the reason. Take a look at that: https://github.com/Carpenter0100/docker-setup/blob/master/src/nginx/conf.d/default.conf
And that: https://github.com/Carpenter0100/docker-setup/blob/master/src/nginx/sites/default.conf#L52
Thank you @jtreminio for this excellent idea!
I could check by myself, but maybe you already have the answer: is this still relevant with Xdebug 3, as a lot has been improvide performance-wise in this version?
Thank you @jtreminio for this excellent idea!
I could check by myself, but maybe you already have the answer: is this still relevant with Xdebug 3, as a lot has been improvide performance-wise in this version?
Per Derick Rethans (creator of Xdebug):
No penalty for loading Xdebug 3, but if you turn on features, it will impact
My workaround for docker slowness on my mac is to point docker nginx to the PHP on my mac host:
upstream fastcgi_backend { server host.docker.internal:9000; }
Docker is not necessary for everything...
This completely ignores the whole point of virtualization and containerization. You're depending on a PHP service that may not match your production environment, either because of different versions or because of INI settings.
This also runs into the non-case-sensitive problem that Windows and MacOS have that Linux does not.
@davidtay I'm not sure what point you're trying to make, on an article about using containerization tech.
I have written a bit about why virtualization is a good idea (Make $ vagrant up yours). I know a VM and a container are not the same thing, but for our purposes they serve similar functions for a common goal.
Regardless, I do not think your comments belong in this thread. You may want to write your own blog detailing your reasoning, but this thread is not the place.
Good luck.
This also runs into the non-case-sensitive problem that Windows and MacOS have that Linux does not.
I always advise to create separate volume in macOS which is formatted in case-sensitive APFS and store all dev projects there. I usually make a symlink in my home directory for ease of use.
This helps a lot, because you will still commit code from this non-case-sensitive file system, which might lead to problems.
Great read! I'll try this approach soon!
https://jtreminio.com/blog/developing-at-full-speed-with-xdebug/