Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.5.0 #170

Merged
merged 4 commits into from
Sep 6, 2023
Merged

1.5.0 #170

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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