-
Notifications
You must be signed in to change notification settings - Fork 7
Enable Xdebug in dev #60
Conversation
| ENV COMPOSER_ALLOW_SUPERUSER=true | ||
|
|
||
| RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ | ||
| pecl install \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like compiling things for a dynamic language, but no alternative
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did wonder if the compilation could be done separately and the result copied in to save app changes from re-running it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory the end result is just a .so file in the right place, which if the PHP (and OS?) version match should be movable across filesystems. Maintaining the code to move it around might not be worth it though if the primary use case of dev is overriding the code with a host folder mounted as a volume.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will ignore for now, can revisit if it does become annoying.
|
Just tried it out a bit more, and it's very slow on Docker for Mac. https://jtreminio.com/blog/developing-at-full-speed-with-xdebug/ looks an interesting technique. |
|
|
||
| fastcgi_pass app:9000; | ||
| fastcgi_pass $fastcgi_pass:9000; | ||
| fastcgi_read_timeout 1d; # For Xdebug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like variables can't be set with time values.
| - /app/var | ||
| - /app/vendor | ||
| depends_on: | ||
| - api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately extends was removed from Docker Compose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is basically a copy of app with a derived image, which lives only locally. Fair.
| @@ -1,3 +1,10 @@ | |||
| resolver 127.0.0.11; | |||
|
|
|||
| map $cookie_XDEBUG_SESSION $fastcgi_pass { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this needs to set something specific in the IDE/host, it would need documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should work with any value.
Surprisingly easy to get working with PhpStorm on a Mac (https://blog.jetbrains.com/phpstorm/2018/08/quickstart-with-docker-in-phpstorm/).