Skip to content

Commit

Permalink
Merge pull request #188 from humanmade/backport-185-to-v3-branch
Browse files Browse the repository at this point in the history
[Backport v3-branch] Ensure XDebug is always on
  • Loading branch information
roborourke authored Jul 15, 2020
2 parents 0af83ee + 25ad74d commit a7ca2dc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ x-php: &php
- "proxy:${COMPOSE_PROJECT_NAME:-default}.altis.dev"
volumes:
- "${VOLUME}:/usr/src/app:delegated"
- "${PWD}/php.ini:/usr/local/etc/php/conf.d/altis.ini"
# Use zzz as a prefix to ensure the php.ini overrides are loaded last
- "${PWD}/php.ini:/usr/local/etc/php/conf.d/zzz-altis.ini"
- socket:/var/run/php-fpm
environment:
HOST_PATH: ${VOLUME}
Expand Down Expand Up @@ -50,8 +51,10 @@ x-php: &php
PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
ALTIS_ANALYTICS_PINPOINT_ENDPOINT: https://pinpoint-${COMPOSE_PROJECT_NAME:-default}.altis.dev
ALTIS_ANALYTICS_COGNITO_ENDPOINT: https://cognito-${COMPOSE_PROJECT_NAME:-default}.altis.dev
PHP_XDEBUG_ENABLED:
# Setting required for minimal config in PHPStorm
PHP_IDE_CONFIG: serverName=${COMPOSE_PROJECT_NAME:-default}.altis.dev
# Enables XDebug for all processes and allows setting remote_host externally for Linux support
XDEBUG_CONFIG: idekey=${COMPOSE_PROJECT_NAME:-default}.altis.dev remote_host=${XDEBUG_REMOTE_HOST:-host.docker.internal}

x-analytics: &analytics
ports:
Expand Down
3 changes: 3 additions & 0 deletions docker/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

# Set sendmail to use mailhog.
sendmail_path = ${PHP_SENDMAIL_PATH}

# XDebug
xdebug.default_enable = 1
4 changes: 3 additions & 1 deletion inc/composer/class-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ protected function start( InputInterface $input, OutputInterface $output ) {

if ( $input->getOption( 'xdebug' ) ) {
$env['PHP_IMAGE'] = 'humanmade/altis-local-server-php:3.1.0-dev';
$env['PHP_XDEBUG_ENABLED'] = true;
if ( in_array( php_uname( 's' ), [ 'BSD', 'Linux', 'Solaris', 'Unknown' ], true ) ) {
$env['XDEBUG_REMOTE_HOST'] = '172.17.0.1';
}
}

$compose = new Process( 'docker-compose up -d', 'vendor/altis/local-server/docker', $env );
Expand Down
5 changes: 0 additions & 5 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ function bootstrap() {
define( 'ALTIS_ANALYTICS_COGNITO_ENDPOINT', getenv( 'ALTIS_ANALYTICS_COGNITO_ENDPOINT' ) );
}

// Set XDebug cookie if environment variable is set.
if ( getenv( 'PHP_XDEBUG_ENABLED' ) ) {
setcookie( 'XDEBUG_SESSION', $_SERVER['HTTP_HOST'], strtotime( '+1 year' ), '/', $_SERVER['HTTP_HOST'] );
}

add_filter( 'qm/output/file_path_map', __NAMESPACE__ . '\\set_file_path_map', 1 );
}

Expand Down

0 comments on commit a7ca2dc

Please sign in to comment.