From fe9422b44ae6de357439a2fb1f5d80058b876666 Mon Sep 17 00:00:00 2001 From: Oleksandr Peresypkin Date: Wed, 3 Nov 2021 09:42:56 +0000 Subject: [PATCH 1/2] Add the ability to set up a custom Xdebug host IP * Add the ability to set up a custom Xdebug host IP for the case when Docker is deployed inside a virtual machine (e.g. Vagrant + VirtualBox) for local development. --- generator/src/templates/deploy.bash.twig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generator/src/templates/deploy.bash.twig b/generator/src/templates/deploy.bash.twig index 1a5d1b168..ee1daaf29 100644 --- a/generator/src/templates/deploy.bash.twig +++ b/generator/src/templates/deploy.bash.twig @@ -122,6 +122,7 @@ readonly SPRYKER_STORES=({{ regions | map((regionData, region) => "'local REGION readonly SPRYKER_DEFAULT_STORE="{{ (regions | first)['stores'] | keys | first }}" readonly SPRYKER_FILE_MODE="{{ _fileMode }}" readonly SPRYKER_XDEBUG_MODE_ENABLE="{{ docker['debug']['xdebug']['enabled'] is not defined or docker['debug']['xdebug']['enabled'] == true ? '1' : '' }}" +readonly SPRYKER_CUSTOM_XDEBUG_HOST_IP="{{ docker['debug']['xdebug']['custom_host_ip'] | default('') }}" readonly SPRYKER_SYNC_SESSION_NAME="{{ _syncSessionName }}" readonly SPRYKER_SYNC_VOLUME="${SPRYKER_DOCKER_PREFIX}_${SPRYKER_DOCKER_TAG}_data_sync" readonly DOCKER_COMPOSE_FILES_EXTRA="{{ docker['compose']['yamls'] | default([]) | join(' ') }}" @@ -158,7 +159,7 @@ readonly SSH_AUTH_SOCK_IN_CLI="$([ -n "${SSH_AUTH_SOCK}" ] && [ -z "${COMPOSER_A # Global variables readonly USER_FULL_ID=$(Environment::getFullUserId) -readonly SPRYKER_XDEBUG_HOST_IP=$(Environment::getHostIp) +readonly SPRYKER_XDEBUG_HOST_IP=${SPRYKER_CUSTOM_XDEBUG_HOST_IP:-$(Environment::getHostIp)} readonly SECRETS_ENVIRONMENT=("COMPOSER_AUTH='${COMPOSER_AUTH}'") command=${1} From 13deb2fa5427980e702fcfdd878e85daba8fa70e Mon Sep 17 00:00:00 2001 From: Oleksandr Peresypkin Date: Mon, 30 May 2022 06:18:17 +0200 Subject: [PATCH 2/2] Update documentation --- ...-installing-in-development-mode-on-windows.md | 16 ++++++++++------ .../02-deploy.file.reference.v1.md | 1 + docs/09-troubleshooting.md | 11 +++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/docs/06-installation/02-installation-guides/03-installing-in-development-mode-on-windows.md b/docs/06-installation/02-installation-guides/03-installing-in-development-mode-on-windows.md index 22fff4da2..062b56cc8 100644 --- a/docs/06-installation/02-installation-guides/03-installing-in-development-mode-on-windows.md +++ b/docs/06-installation/02-installation-guides/03-installing-in-development-mode-on-windows.md @@ -63,13 +63,17 @@ $ docker-compose --version ``` ::: -8. In `{shop_name}/docker/context/php/debug/etc/php/debug.conf.d/69-xdebug.ini`, set `xdebug.remote_host` and `xdebug.client_host` to `host.docker.internal`: +8. In `deploy.dev.yml`, set the debug configuration as follows: -```text -... -xdebug.remote_host=host.docker.internal -... -xdebug.client_host=host.docker.internal +```yaml +docker: + ... + debug: + enabled: true + xdebug: + enabled: true + custom_host_ip: host.docker.internal + ... ``` 9. Add your user to the `docker` group: diff --git a/docs/07-deploy-file/02-deploy.file.reference.v1.md b/docs/07-deploy-file/02-deploy.file.reference.v1.md index aee2a7d3e..2fc7cd2df 100644 --- a/docs/07-deploy-file/02-deploy.file.reference.v1.md +++ b/docs/07-deploy-file/02-deploy.file.reference.v1.md @@ -673,6 +673,7 @@ docker: ``` * `docker: debug: xdebug: enabled:` - defines if Xdebug is enabled. +* `docker: debug: xdebug: custom_host_ip:` - defines the custom host IP. It can be set as `host.docker.internal` when working in Windows environment with WSL2. *** ### docker: logs: diff --git a/docs/09-troubleshooting.md b/docs/09-troubleshooting.md index 326773b37..6bf396bc2 100644 --- a/docs/09-troubleshooting.md +++ b/docs/09-troubleshooting.md @@ -271,6 +271,17 @@ docker: xdebug: enabled: true ``` +When working on Windows with WSL2, ensure the debug configuration is set up as follows: +```yaml +docker: + ... + debug: + enabled: true + xdebug: + enabled: true + custom_host_ip: host.docker.internal + ... +``` 2. Ensure that IDE is listening to the port 9000. 3. Check if the host is accessible from the container: ```bash