Skip to content

Commit

Permalink
feat: update xdebug setup
Browse files Browse the repository at this point in the history
Setup `xdbug.client_host` to `host.docker.internal`.

See https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host
See docker/for-linux#264

Also setup other config values which can be configured throught the
`XDEBUG_CONFIG`.
  • Loading branch information
d0niek committed Oct 11, 2023
1 parent 80ddee5 commit d008428
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ NODE_PORT=3505

###> Devel ###
XDEBUG_IDEKEY=xdebug
XDEBUG_HOST=
XDEBUG_PORT=9000
XDEBUG_HOST=host.docker.internal
XDEBUG_PORT=9003
XDEBUG_MODE=develop
XDEBUG_LOG_LEVEL=7
###< Devel ###
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ make a [backup](#backup).
If you want to debug a shop with [xdebug](https://xdebug.org/):

- be sure you're running **dev** environment (and images),
- setup `XDEBUG_HOST` to your local machine ip,
- setup `XDEBUG_MODE` to `debug`,
- add/setup `debug` to `XDEBUG_MODE`,
- reload docker with `docker-compose up -d`.

Now you're ready to remote debugging.
10 changes: 8 additions & 2 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ services:
- SYMFONY_ENV=dev
- XDEBUG_MODE=${XDEBUG_MODE:-develop}
- XDEBUG_CONFIG=
cli_color=1
client_host=${XDEBUG_HOST}
client_port=${XDEBUG_PORT:-9000}
xdebug.start_with_request=yes
client_port=${XDEBUG_PORT:-9003}
log=/var/www/html/var/logs/xdebug.log
log_level=${XDEBUG_LOG_LEVEL:-7}
idekey=${XDEBUG_IDEKEY:-xdebug}
- XDEBUG_SESSION=${XDEBUG_IDEKEY:-xdebug}
extra_hosts:
# Ensure that host.docker.internal is correctly defined on Linux
- host.docker.internal:host-gateway

node:
image: ${NODE_IMAGE}
Expand Down

0 comments on commit d008428

Please sign in to comment.