From 68ff93ddd0b0e97f428477408d1578a40da97ff6 Mon Sep 17 00:00:00 2001 From: Valen Varangu-Booth Date: Sat, 19 Dec 2020 15:31:00 -0500 Subject: [PATCH 1/7] update xdebug port --- .vscode/launch.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 364ac59..bb184e2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "name": "Listen for XDebug", "type": "php", "request": "launch", - "port": 9000, + "port": 9003, "pathMappings": { "/buildkit/build": "${workspaceRoot}/build" }, From 883631559722010618e8c15b96dea342b52560cb Mon Sep 17 00:00:00 2001 From: Valen Varangu-Booth Date: Sat, 19 Dec 2020 16:19:11 -0500 Subject: [PATCH 2/7] use xdebug3 settings --- civicrm/docker-civicrm-entrypoint | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/civicrm/docker-civicrm-entrypoint b/civicrm/docker-civicrm-entrypoint index bd348a6..8abf20d 100644 --- a/civicrm/docker-civicrm-entrypoint +++ b/civicrm/docker-civicrm-entrypoint @@ -5,15 +5,15 @@ set -e CONTAINER_IP=`/sbin/ip route|awk '/default/ { print $3 }'` cat << EOF > /usr/local/etc/php/conf.d/debug.ini zend_extension=xdebug.so +xdebug.mode=debug +xdebug.start_with_request=yes xdebug.show_error_trace=1 -xdebug.remote_enable=1 -xdebug.remote_autostart=1 -xdebug.profiler_enable_trigger=1 -xdebug.profiler_output_dir=/debug +xdebug.discover_client_host=yes +sdebug.client_host=host.docker.internal +xdebug.output_dir=/debug xdebug.var_display_max_depth = 8 xdebug.var_display_max_children = 256 -xdebug.var_display_max_data = 1024 -xdebug.remote_host=${CONTAINER_IP} +xdebug.var_display_max_data = 1024 max_execution_time=600 EOF From 67af0ef30078e1c9fd7a6bfebc234d5431589d63 Mon Sep 17 00:00:00 2001 From: Valen Varangu-Booth Date: Sat, 19 Dec 2020 16:30:27 -0500 Subject: [PATCH 3/7] typo --- civicrm/docker-civicrm-entrypoint | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/civicrm/docker-civicrm-entrypoint b/civicrm/docker-civicrm-entrypoint index 8abf20d..b356705 100644 --- a/civicrm/docker-civicrm-entrypoint +++ b/civicrm/docker-civicrm-entrypoint @@ -8,8 +8,7 @@ zend_extension=xdebug.so xdebug.mode=debug xdebug.start_with_request=yes xdebug.show_error_trace=1 -xdebug.discover_client_host=yes -sdebug.client_host=host.docker.internal +xdebug.client_host=host.docker.internal xdebug.output_dir=/debug xdebug.var_display_max_depth = 8 xdebug.var_display_max_children = 256 From 21e6f07cc1b181673961d90048fee9a46bf02b39 Mon Sep 17 00:00:00 2001 From: Valen Varangu-Booth Date: Sat, 19 Dec 2020 20:44:12 -0500 Subject: [PATCH 4/7] add php/php-cli files --- civicrm/Dockerfile | 4 ++++ civicrm/php-cli.ini | 1 + civicrm/php.ini | 3 +++ 3 files changed, 8 insertions(+) create mode 100644 civicrm/php-cli.ini create mode 100644 civicrm/php.ini diff --git a/civicrm/Dockerfile b/civicrm/Dockerfile index fc65bd5..fafc7f1 100644 --- a/civicrm/Dockerfile +++ b/civicrm/Dockerfile @@ -109,6 +109,10 @@ COPY --chown=buildkit:buildkit amp.services.yml /buildkit/.amp/services.yml COPY buildkit.ini /usr/local/etc/php/conf.d/buildkit.ini +COPY php.ini /usr/local/etc/php/php.ini + +COPY php-cli.ini /usr/local/etc/php/php-cli.ini + COPY msmtprc /etc/msmtprc COPY apache.conf /etc/apache2/conf-enabled/buildkit.conf diff --git a/civicrm/php-cli.ini b/civicrm/php-cli.ini new file mode 100644 index 0000000..b35bf15 --- /dev/null +++ b/civicrm/php-cli.ini @@ -0,0 +1 @@ +xdebug.mode=off \ No newline at end of file diff --git a/civicrm/php.ini b/civicrm/php.ini new file mode 100644 index 0000000..30dd0ec --- /dev/null +++ b/civicrm/php.ini @@ -0,0 +1,3 @@ +xdebug.mode=debug +xdebug.start_with_request=yes +xdebug.show_error_trace=1 \ No newline at end of file From 22408d1bb596688e9ed4168959aa55c04d9584ff Mon Sep 17 00:00:00 2001 From: Valen Varangu-Booth Date: Sat, 19 Dec 2020 20:44:34 -0500 Subject: [PATCH 5/7] general xdebug config in buildkit.ini --- civicrm/buildkit.ini | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/civicrm/buildkit.ini b/civicrm/buildkit.ini index e217282..e95a63d 100644 --- a/civicrm/buildkit.ini +++ b/civicrm/buildkit.ini @@ -3,6 +3,11 @@ cgi.fix_pathinfo = Off sendmail_path=/usr/sbin/sendmail -t -i log_errors = On error_log = /dev/stderr -xdebug.show_error_trace = On -xdebug.remote_enable = On -xdebug.remote_autostart = 1 + +zend_extension=xdebug.so +xdebug.output_dir=/debug +xdebug.var_display_max_depth = 8 +xdebug.var_display_max_children = 256 +xdebug.var_display_max_data = 1024 +max_execution_time=600 +xdebug.show_error_trace = On \ No newline at end of file From 9deb288c6a61a9372a0d9a04ebb68ab37d49efd2 Mon Sep 17 00:00:00 2001 From: Valen Varangu-Booth Date: Sat, 19 Dec 2020 20:44:49 -0500 Subject: [PATCH 6/7] use host.docker.internal if available --- civicrm/docker-civicrm-entrypoint | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/civicrm/docker-civicrm-entrypoint b/civicrm/docker-civicrm-entrypoint index b356705..3509129 100644 --- a/civicrm/docker-civicrm-entrypoint +++ b/civicrm/docker-civicrm-entrypoint @@ -1,21 +1,22 @@ -#!/bin/sh +#!/bin/bash set -e -# xdebug setup -CONTAINER_IP=`/sbin/ip route|awk '/default/ { print $3 }'` -cat << EOF > /usr/local/etc/php/conf.d/debug.ini -zend_extension=xdebug.so -xdebug.mode=debug -xdebug.start_with_request=yes -xdebug.show_error_trace=1 -xdebug.client_host=host.docker.internal -xdebug.output_dir=/debug -xdebug.var_display_max_depth = 8 -xdebug.var_display_max_children = 256 -xdebug.var_display_max_data = 1024 -max_execution_time=600 +XDEBUG_CLIENT="" + +# Check if docker host available +if getent hosts host.docker.internal > /dev/null +then + XDEBUG_CLIENT="host.docker.internal" +else + # use gateway + XDEBUG_CLIENT=`/sbin/ip route|awk '/default/ { print $3 }'` +fi + +cat << EOF > /usr/local/etc/php/conf.d/99-debug-host.ini +xdebug.client_host=${XDEBUG_CLIENT} EOF + # first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then set -- apache2-foreground "$@" From dadfe9daba495f5640f4e3c80c70ff35728bb73f Mon Sep 17 00:00:00 2001 From: Valen Varangu-Booth Date: Sat, 19 Dec 2020 21:07:47 -0500 Subject: [PATCH 7/7] update twig templates --- publish/templates/civicrm/Dockerfile.twig | 4 +++ publish/templates/civicrm/buildkit.ini.twig | 11 +++++-- .../civicrm/docker-civicrm-entrypoint.twig | 29 +++++++++---------- publish/templates/civicrm/php-cli.ini.twig | 1 + publish/templates/civicrm/php.ini.twig | 3 ++ 5 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 publish/templates/civicrm/php-cli.ini.twig create mode 100644 publish/templates/civicrm/php.ini.twig diff --git a/publish/templates/civicrm/Dockerfile.twig b/publish/templates/civicrm/Dockerfile.twig index c992f6d..d38462d 100755 --- a/publish/templates/civicrm/Dockerfile.twig +++ b/publish/templates/civicrm/Dockerfile.twig @@ -118,6 +118,10 @@ COPY --chown=buildkit:buildkit amp.services.yml /buildkit/.amp/services.yml COPY buildkit.ini /usr/local/etc/php/conf.d/buildkit.ini +COPY php.ini /usr/local/etc/php/php.ini + +COPY php-cli.ini /usr/local/etc/php/php-cli.ini + COPY msmtprc /etc/msmtprc COPY apache.conf /etc/apache2/conf-enabled/buildkit.conf diff --git a/publish/templates/civicrm/buildkit.ini.twig b/publish/templates/civicrm/buildkit.ini.twig index e217282..e95a63d 100644 --- a/publish/templates/civicrm/buildkit.ini.twig +++ b/publish/templates/civicrm/buildkit.ini.twig @@ -3,6 +3,11 @@ cgi.fix_pathinfo = Off sendmail_path=/usr/sbin/sendmail -t -i log_errors = On error_log = /dev/stderr -xdebug.show_error_trace = On -xdebug.remote_enable = On -xdebug.remote_autostart = 1 + +zend_extension=xdebug.so +xdebug.output_dir=/debug +xdebug.var_display_max_depth = 8 +xdebug.var_display_max_children = 256 +xdebug.var_display_max_data = 1024 +max_execution_time=600 +xdebug.show_error_trace = On \ No newline at end of file diff --git a/publish/templates/civicrm/docker-civicrm-entrypoint.twig b/publish/templates/civicrm/docker-civicrm-entrypoint.twig index bd348a6..ee2400b 100755 --- a/publish/templates/civicrm/docker-civicrm-entrypoint.twig +++ b/publish/templates/civicrm/docker-civicrm-entrypoint.twig @@ -1,20 +1,19 @@ -#!/bin/sh +#!/bin/bash set -e -# xdebug setup -CONTAINER_IP=`/sbin/ip route|awk '/default/ { print $3 }'` -cat << EOF > /usr/local/etc/php/conf.d/debug.ini -zend_extension=xdebug.so -xdebug.show_error_trace=1 -xdebug.remote_enable=1 -xdebug.remote_autostart=1 -xdebug.profiler_enable_trigger=1 -xdebug.profiler_output_dir=/debug -xdebug.var_display_max_depth = 8 -xdebug.var_display_max_children = 256 -xdebug.var_display_max_data = 1024 -xdebug.remote_host=${CONTAINER_IP} -max_execution_time=600 +XDEBUG_CLIENT="" + +# Check if docker host available +if getent hosts host.docker.internal > /dev/null +then + XDEBUG_CLIENT="host.docker.internal" +else + # use gateway + XDEBUG_CLIENT=`/sbin/ip route|awk '/default/ { print $3 }'` +fi + +cat << EOF > /usr/local/etc/php/conf.d/99-debug-host.ini +xdebug.client_host=${XDEBUG_CLIENT} EOF # first arg is `-f` or `--some-option` diff --git a/publish/templates/civicrm/php-cli.ini.twig b/publish/templates/civicrm/php-cli.ini.twig new file mode 100644 index 0000000..b35bf15 --- /dev/null +++ b/publish/templates/civicrm/php-cli.ini.twig @@ -0,0 +1 @@ +xdebug.mode=off \ No newline at end of file diff --git a/publish/templates/civicrm/php.ini.twig b/publish/templates/civicrm/php.ini.twig new file mode 100644 index 0000000..30dd0ec --- /dev/null +++ b/publish/templates/civicrm/php.ini.twig @@ -0,0 +1,3 @@ +xdebug.mode=debug +xdebug.start_with_request=yes +xdebug.show_error_trace=1 \ No newline at end of file