Git Product home page Git Product logo

Comments (6)

davidalger avatar davidalger commented on May 26, 2024 2

Final solution has been to update PR #35 to adhere to the following:

  1. Introduces a new command warden debug; when this is run the user is launched into a shell similarly to when warden shell is run, but in this case the shell is opened by default within the php-debug container.

  2. When user is launched into a debug container, the env variable XDEBUG_REMOTE_HOST is passed in and conditionally set to either host.docker.internal on macOS and to the gateway IP of the warden network on Linux systems.

  3. The base images have been updated to add the following to /etc/php-cli.ini bringing it all together without any potential for disrupting already present and reliable in-browser debugging:

[php]
xdebug.remote_autostart=on
xdebug.remote_host=${XDEBUG_REMOTE_HOST}

Big shout out to @wcrb15 for helping ascertain what the remote host should be configured to on Linux systems and to @molotovbliss for getting the ball rolling with the idea of a special debug command.

from warden.

wojtekn avatar wojtekn commented on May 26, 2024 1

@davidalger this sounds as a great idea.

I'm not sure if I'm missing something, but wouldn't it be just about adding those two config directives in /etc/php.d/15-xdebug.ini in this container?

from warden.

davidalger avatar davidalger commented on May 26, 2024 1

Per a conversation I had with @wcrb15 the gateway IP of the warden network works as the remote_host on Linux systems. So in order to resolve this, it should be possible to look up and pass this gateway IP address as an extra_hosts parameter on Linux systems allowing docker.host.internal to resolve there as well as on macOS within the php-debug container. For the sake of not disrupting any existing functionality, the use of connect back for browser requests should remain untouched.

The gateway IP address can be looked up via the following similar to [what is done here](docker container inspect traefik --format '{{.NetworkSettings.Networks.warden.Gateway}}'):

docker container inspect traefik --format '{{.NetworkSettings.Networks.warden.Gateway}}'

from warden.

molotovbliss avatar molotovbliss commented on May 26, 2024 1

Big shout out to @wcrb15 for helping ascertain what the remote host should be configured to on Linux systems and to @molotovbliss for getting the ball rolling with the idea of a special debug command.

Thanks for the 😊 props, and same to @chapagain for updating my old gist with this feature! Cheers. 🍻

from warden.

davidalger avatar davidalger commented on May 26, 2024

10/18/19, 10:10 AM
I pass the values to the container environment variables via docker compose and -e.
e.g. docker-compose run -e PHP_IDE_CONFIG="serverName=$server_name" -e XDEBUG_CONFIG="remote_host=172.17.0.1" magento-cli "$@" now i just use this command instead of running with php flags
ref: https://twitter.com/petey_tweety/status/1185211571493994496

from warden.

molotovbliss avatar molotovbliss commented on May 26, 2024

https://gist.github.com/molotovbliss/3eb18a2b0366d9b9e15647322641816d just to note for a possible way to get the container id along with passing the usual xdebug php params & script file to debug.


Created a PR with included help file and removal and clean-up. Version change may not be needed, FYI.

from warden.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.