Skip to content

Commit

Permalink
Issue #443: Add support for xdebug in lando with vscode (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
yorkshire-pudding authored Sep 25, 2024
1 parent 7523e1a commit d447d67
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ config:
php: 8.3
webroot: backdrop
database: mysql
# Set Xdebug off by default. We use the tooling below to turn it on as needed.
xdebug: false
# Need to disable bee so can use the version in the repo.
bee: false
services:
appserver:
config:
php: .lando/php.ini
build_as_root:
# As bee is now added by default, we need to remove any existing versions
# of bee if you tested a versioned install of bee by adding in the config
Expand All @@ -31,6 +35,10 @@ services:
run:
# Run setup tasks.
- /app/.lando/setup.sh setup
overrides:
environment:
XDEBUG-CONFIG: "start_with_request=yes"
XDEBUG_MODE: 'debug,develop'
database:
healthcheck: mysql --defaults-extra-file=/app/.lando/mysql.cnf --silent --execute "SHOW DATABASES;"
multisite:
Expand Down Expand Up @@ -62,6 +70,20 @@ tooling:
cmd:
- cd /app/backdrop && /app/phpunit --testsuite backdrop --configuration /app/tests
- cd /app/multisite && /app/phpunit --testsuite multisite --configuration /app/tests
xdebug-on:
service: appserver
description: Enable Xdebug.
user: root
cmd:
- docker-php-ext-enable xdebug && kill -USR2 $(pgrep -o php-fpm) 2>/dev/null || /etc/init.d/apache2 reload
- tput setaf 2 && echo "Xdebug On" && tput sgr 0 && echo
xdebug-off:
service: appserver
description: Disable Xdebug.
user: root
cmd:
- rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && kill -USR2 $(pgrep -o php-fpm) 2>/dev/null || /etc/init.d/apache2 reload
- tput setaf 1 && echo "Xdebug Off" && tput sgr 0 && echo
proxy:
multisite:
- multi-1.lndo.site
Expand Down
6 changes: 6 additions & 0 deletions .lando/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
xdebug.mode = coverage,develop,debug
xdebug.idekey = docker
xdebug.client_host = ${LANDO_HOST_IP}
xdebug.client_port = 9003
xdebug.start_with_request = yes
xdebug.log = /tmp/xdebug.log
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/app/": "${workspaceFolder}/",
}
}
]
}

3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ and this project follows the
which is based on the major version of Backdrop CMS with a semantic version
system for each contributed module, theme and layout.

## [Unreleased] - 2024-09-19
## [Unreleased] - 2024-09-25

### Added
- An option for the `db-import` command to allow import from newer MariaDB
servers with the enable sandbox command in the dump file if the destination
database or client does not support it.
- Tooling for the lando recipe to support Xdebug with VS Code.

### Fixed
- Unhandled errors and warnings if commands run outside Backdrop root and/or
Expand Down

0 comments on commit d447d67

Please sign in to comment.