Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidjguru/68323f7f42b5093686c9e0b09a08832c to your computer and use it in GitHub Desktop.
Save davidjguru/68323f7f42b5093686c9e0b09a08832c to your computer and use it in GitHub Desktop.
Decoupled Drupal using Lando in Containers: Configuration for Debugging

Configuration for Debugging Decoupled Drupal using Lando.

Architecture

This snippet is for a decoupled system divided in some folders, something like:

/root_project/
   |
   |_/backend_folder/
   |_____/frontend_folder/

And so, you need debug your Drupal backend folder using xdebug from Lando and VSCode as IDE.

Beware

Can require restart the Lando system and rebuild the containers when you change versions or ports. Use:

$ lando stop && lando poweroff && lando start

In the last versions > 3.0 is using port 9003.

# Placed in /root-project/.lando.yml
[...]
services:
appserver:
composer_version: "1.10.21"
xdebug: debug
config:
php: .lando/php.ini
[..]
# Placed in /root-project/backend/.vscode/launch.json
# Remember: that pathMapping ⇒ "/app/backend/web" is defined in your lando main file:
# cmd: drupal --root=/app/backend/web
# It can be different in your installation / configuration.
# Don't forget delete the comment, JSON doesn't allow it.
{
"version": "0.2.0",
"configurations": [
{
"name": "XDebug - Lando",
"type": "php",
"request": "launch",
"port": 9003,
"log": true,
"pathMappings": {
"/app/backend/web": "${workspaceRoot}/web",
}
}
]
}
[PHP]
; Placed in /root-project/.lando/
; Local settings
xdebug.mode = debug
xdebug.client_host = ${LANDO_HOST_IP}
xdebug.client_port = 9003
xdebug.start_with_request = yes
xdebug.log = /tmp/xdebug.log
; Remote settings
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_host = ${LANDO_HOST_IP}
xdebug.idekey = VSCODE
xdebug.remote_log = /tmp/xdebug.log
xdebug.remote_port = 9003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment