Skip to content

Commit

Permalink
Merge pull request #170 from stellarwp/1.5.0
Browse files Browse the repository at this point in the history
1.5.0
  • Loading branch information
lucatume authored Sep 6, 2023
2 parents 7bdc058 + e18b52a commit b98954c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .env.slic
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ XDK=slic
# Whether to enable XDebug in the containers or not.
XDE=0
# The remote host XDebug should connect to.
# This default value should work out of the box on Docker for Mac and Windows, but it will not on Linux.
# Override this value in the .env.slic.local file if required.
# This default value should work out of the box on Docker for Mac and Windows.
# On Linux, this is automatically set in src/slic.php to make the Docker gateway IP map to this host.
# Override this value in the .env.slic.local file, if required.
# E.g. to get the current host IP on Debian derivatives: ip route | grep docker0 | awk '{print $9}'
XDH=host.docker.internal
# The remote host port XDebug will connect to. Avoids the default 9000 as your host machine might have php-fpm already
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [1.5.0] - 2023-09-06
* Fix - Added `extra_hosts:"${host:-host}:host-gateway"` to slick-stack.yml for Linux compatibility, enabling Xdebug without modifying the XDH environment variable. [Ref](https://github.com/docker/for-linux/issues/264#issuecomment-785247571).

# [1.4.4] - 2023-08-15
* Change - Update base WordPress container from 6.1 to 6.2.
* Change - Add WP CLI to the `wordpress` container as `wp`.
Expand Down
6 changes: 6 additions & 0 deletions slic-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ services:
interval: 1s
timeout: 3s
retries: 30
extra_hosts:
# Set as host=host.docker.internal in src/slic.php on Linux for XDebug.
- "${host:-host}:host-gateway"

chrome:
image: ${SLIC_CHROME_CONTAINER:-selenium/standalone-chrome:3.141.59}
Expand Down Expand Up @@ -191,3 +194,6 @@ services:
- ${COMPOSER_CACHE_DIR:-./.cache}:/composer-cache
# Scripts volume
- ${SLIC_SCRIPTS}:/slic-scripts
extra_hosts:
# Set as host=host.docker.internal in src/slic.php on Linux for XDebug.
- "${host:-host}:host-gateway"
2 changes: 1 addition & 1 deletion slic.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
] );

$cli_name = 'slic';
const CLI_VERSION = '1.4.4';
const CLI_VERSION = '1.5.0';

// If the run-time option `-q`, for "quiet", is specified, then do not print the header.
if ( in_array( '-q', $argv, true ) || ( in_array( 'exec', $argv, true ) && ! in_array( 'help', $argv, true ) ) ) {
Expand Down
9 changes: 9 additions & 0 deletions src/slic.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,15 @@ function setup_slic_env( $root_dir, $reset = false ) {
load_env_file( $root_dir . '/.env.slic.run' );
}

/*
* Set the host env var to make xdebug work on Linux with host.docker.internal.
* This will already be set on Mac/Windows, and overriding it would break things.
* See extra_hosts: in slick-stack.yml.
*/
if ( PHP_OS === 'Linux' ) {
putenv( sprintf( 'host=%s', getenv( 'XDH' ) ?: 'host.docker.internal' ) );
}

$default_wp_dir = root( '/_wordpress' );
$wp_dir = getenv( 'SLIC_WP_DIR' );

Expand Down

0 comments on commit b98954c

Please sign in to comment.