jtreminio / jtreminio.github.io

7 stars 4 forks source link

Comments: Developing at Full Speed with Xdebug #12

Open jtreminio opened 5 years ago

jtreminio commented 5 years ago

https://jtreminio.com/blog/developing-at-full-speed-with-xdebug/

clevercodenl commented 5 years ago

Hi, nice article. Could you also post your docker-compose and docker version ?

asvsot commented 5 years ago

Why not to use solution from https://stackoverflow.com/a/19273025/2553217 ?

apedicdev commented 5 years ago

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.

gallyamov commented 5 years ago

@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

jtborger commented 5 years ago

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 :)

Jarzebowsky commented 5 years ago

@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.

ghost commented 4 years ago

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?

Carpenter0100 commented 4 years ago

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

michaelperrin commented 3 years ago

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?

jtreminio commented 3 years ago

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

jtreminio commented 3 years ago

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.

jtreminio commented 3 years ago

@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.

KubaRocks commented 2 years ago

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!