jorge07 / symfony-6-es-cqrs-boilerplate

Symfony 6 DDD ES CQRS backend boilerplate.
MIT License
1.07k stars 187 forks source link

[Windows] fix: allow HTTP requests to be debugged #159

Closed jon-ht closed 4 years ago

jon-ht commented 4 years ago

I followed your steps from https://github.com/jorge07/alpine-php/blob/master/doc/IDE.md and I still had troubles to get HTTP requests "debuggable".

I've added some docs in PHPStorm section of your readme because even if it sounds obvious, newcomers might be confused with debugging.

Also, I think xdebug config overrides should be done at jorge07/alpine-php instead. And https://github.com/jorge07/alpine-php/issues/60 gave me some keys to make it works.

jon-ht commented 4 years ago

Another thing, not related to this I suppose but I'm getting 504 Gateway Time-out (after ~30 sec) when I debug HTTP request, do you have an idea why ?

jorge07 commented 4 years ago

I spent some time this night and found the same 504. Xdebug stops at the breakpoint but seems phpstorm doesn't notice. I'm using a really old version atm, so I'll update to 2020 version to try this and also have support for 7.4

jorge07 commented 4 years ago

I've tried this configurations but it doesn't work for me. I've tried latest master too and it works. Here my current configuration:

Http test

test

Server

server

 Interpreter

interpreter test

jorge07 commented 4 years ago

@jon-ht can you give a try to master and tell me what are the problems you're facing?

jon-ht commented 4 years ago

On master (so without nginx fixes) PHPStorm never breaks to specified breakpoint, even when I check Break at first line.

Now if I switch to this branch, everything works as expected and I can debug through PHPStorm.

Note: I used Docker PHP interpreter before, but it looks like either Docker or SSH interpreter works well (on this branch, not master...)

image

jorge07 commented 4 years ago

@jon-ht can you setup a SSH remote interpreter instead the docker one and have a try?

jorge07 commented 4 years ago

hey @jon-ht

I got it working in master with docker interpreter in master. The only change I did was put xdebug.remote_host=GATEWAY

This post give me the clue: https://www.pascallandau.com/blog/setup-phpstorm-with-xdebug-on-docker/

Docker interpreter

Unfortunately I can't merge this as it is because the xdebug config will only work on mac or windows. But I would like to update the documentation and the IDE and the nginx config for dev.

jon-ht commented 4 years ago

Hi @jorge07,

I can confirm your solution works on master on Windows

image

So, should I remove nginx/docs update to only mention your link in the docs ?

jorge07 commented 4 years ago

Add your screenshot to the doc for docker interpreter in mac and windows and keep doc and nginx. The link I post can create more confusion than benefits for beginners I think

jon-ht commented 4 years ago

IMO, nginx config can be reverted to the one on master because it doesn't seem to help debugging, or it might be required for linux users ?

jon-ht commented 4 years ago

Hum, sorry to bother you, but I think I had an old configuration from this branch while trying on master: PHPStorm doesn't break at first line or anywhere else if I only put xdebug.remote_host=GATEWAY on Docker interpreter

jon-ht commented 4 years ago

Okay, another point, nginx config can be reverted (but you won't be able to validate Xdebug config, even if it's working 🤯).

The key, in my case is to override PHP config

services:
  php:
    volumes:
      - ./etc/dev/php/docker-xdebug.ini:/etc/php7/conf.d/docker-php-ext-xdebug.ini

I don't know why but my PHPStorm seems to totally ignore configuration options passed via CLI interpreter like mentionned in screeshots above. You can also notice I made a mistake by configuring my Docker interpreter, that's what made my try again and found I had an old config

jorge07 commented 4 years ago

Hum, sorry to bother you, but I think I had an old configuration from this branch while trying on master: PHPStorm doesn't break at first line or anywhere else if I only put xdebug.remote_host=GATEWAY on Docker interpreter

You've to put xdebug.remote_host=host.docker.com I think

jon-ht commented 4 years ago

You've to put xdebug.remote_host=host.docker.com I think

Nope, didn't work :/

jorge07 commented 4 years ago

try adding as extra arguments xdebug.remote_connect_back=0 like the remote host

jon-ht commented 4 years ago

Tried to pass all config from ini file to in-line arguments and didn't work :/

jorge07 commented 4 years ago

I tried today docker4mac and it was a nightmare. PHPStorm not recognising the php bin output, symfony extremely slow, even with cached volumes... and I finally got it working except the http calls debugger. I will definitely not use it. A good reminder of why I was using dinghy. My suggestion here is create a custom docker-compose just for docker4windows and add a flag to the makefile. Also instead of mount a xdebug volume, use XDEBU_CONFIG env var for example

jon-ht commented 4 years ago

I made it work on Ubuntu only by adding what you did on master

image

I'll try to update the PR according to your feedbacks.

Anyway, thanks for your time :)

jorge07 commented 4 years ago

Amazing. Thanks for the time you've spend with this, I really appreciate