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

Comments: Developing at Full Speed with Xdebug #12

Open
jtreminio opened this issue Dec 17, 2018 · 13 comments
Open

Comments: Developing at Full Speed with Xdebug #12

jtreminio opened this issue Dec 17, 2018 · 13 comments

Comments

@jtreminio
Copy link
Owner

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

@clevercodenl
Copy link

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

@asvsot
Copy link

asvsot commented Jun 20, 2019

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

@apedicdev
Copy link

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
Copy link

gallyamov commented Sep 12, 2019

@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
Copy link

jtborger commented Oct 22, 2019

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
Copy link

@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
Copy link

ghost commented Jul 6, 2020

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
Copy link

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
Copy link

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
Copy link
Owner Author

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
Copy link
Owner Author

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
Copy link
Owner Author

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

Copy link

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!

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

10 participants