From 389ddf0687eb51083d643d00b741e2aa99fc055f Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Wed, 2 Dec 2020 15:40:05 +0100 Subject: [PATCH 1/2] fix(tric) update the version in the main file --- changelog.md | 6 ++++++ containers/wordpress/Dockerfile.debug | 11 +++++++---- src/commands/ssh.php | 23 +++++++++++++++++++++++ tric | 6 ++++-- 4 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 src/commands/ssh.php diff --git a/changelog.md b/changelog.md index 419c39d..5672677 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,12 @@ 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). +## [0.5.17] - 2020-12-04 +### Changed + +- Fix the XDebug version and `wordpress` service `Dockerfile` to keep using version `2` and not update to version `3` on a rebuild (e.g. one triggered by `tric update` or `tric build-stack` commands). +- Add the `tric ssh` command to allow opening a shell in a **running** stack service; differently from the `shell` command, the `ssh` command will **not** start the service if it's not already running. + ## [0.5.16] - 2020-11-26 ### Changed diff --git a/containers/wordpress/Dockerfile.debug b/containers/wordpress/Dockerfile.debug index 5f9bf3d..162518c 100644 --- a/containers/wordpress/Dockerfile.debug +++ b/containers/wordpress/Dockerfile.debug @@ -12,10 +12,13 @@ RUN if [ "${DOCKER_RUN_GID}" != 0 ]; then addgroup --gid ${DOCKER_RUN_GID} docke # Pull in an helper library to install PHP extensions. COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/ -# Install the XDebug extension. -RUN install-php-extensions xdebug -# Configure XDebug to autostart on all requests. -RUN echo 'xdebug.remote_autostart=1' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +# Install the XDebug extension, drama might ensue due to the version constraint, handle it. +# Install version 2 to keep the same config most people have. +RUN install-php-extensions xdebug-2.9.8 || docker-php-ext-enable xdebug.so +# Configure XDebug to autostart on all requests, use the version 2 configuration format. +RUN echo $'xdebug.remote_enable=1\n\ +xdebug.remote_autostart=\n' \ + >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini # Make the XDebug configuration file world-read/writeable as the user updating it might not be a sudo-er. RUN chmod a+rw /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini diff --git a/src/commands/ssh.php b/src/commands/ssh.php new file mode 100644 index 0000000..9b957e8 --- /dev/null +++ b/src/commands/ssh.php @@ -0,0 +1,23 @@ +{$cli_name} shell []\n" ); + echo colorize( "example: {$cli_name} shell wordpress\n" ); + echo colorize( "example: {$cli_name} shell chrome\n" ); + echo colorize( "example: {$cli_name} shell db\n" ); + + return; +} + +$service_args = args( [ 'service', '...' ], $args( '...' ), 0 ); +$service = $service_args( 'service', 'codeception' ); + +tric_realtime()( [ 'exec', $service, 'bash' ] ); diff --git a/tric b/tric index 0b437fe..d6159d9 100755 --- a/tric +++ b/tric @@ -26,7 +26,7 @@ $args = args( [ ] ); $cli_name = basename( $argv[0] ); -const CLI_VERSION = '0.5.15'; +const CLI_VERSION = '0.5.17'; $cli_header = implode( ' - ', [ light_cyan( $cli_name ) . ' version ' . light_cyan( CLI_VERSION ), @@ -62,7 +62,8 @@ Available commands: Advanced Usage: cc Runs a Codeception command in the stack, the equivalent of 'codecept ...'. -shell Opens a shell in a stack service, defaults to the 'codeception' one. +shell Opens a shell in a new stack service, defaults to the 'codeception' one. +ssh Opens a shell in a running stack service, defaults to the 'wordpress' one. cli Runs a wp-cli command in the stack or opens a session into the wp-cli container. site-cli Waits for WordPress to be correctly set up to run a wp-cli command in the stack. reset Resets {$cli_name} to the initial state as configured by the env files. @@ -124,6 +125,7 @@ switch ( $subcommand ) { case 'serve': case 'shell': case 'site-cli': + case 'ssh': case 'up': scaffold_installation(); // Do not break, let the command be loaded then. From f57e89f4d1f56f02d3a2f1fb87f1f6a57342d339 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Fri, 4 Dec 2020 14:36:40 +0100 Subject: [PATCH 2/2] fix(containers/wordpress) correct value for autostart --- containers/wordpress/Dockerfile.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/wordpress/Dockerfile.debug b/containers/wordpress/Dockerfile.debug index 6ad590c..1d4eca9 100644 --- a/containers/wordpress/Dockerfile.debug +++ b/containers/wordpress/Dockerfile.debug @@ -17,7 +17,7 @@ COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr RUN install-php-extensions xdebug-2.9.8 || docker-php-ext-enable xdebug.so # Configure XDebug to autostart on all requests, use the version 2 configuration format. RUN echo 'xdebug.remote_enable=1\n\ -xdebug.remote_autostart=\n' \ +xdebug.remote_autostart=1\n' \ >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini # Make the XDebug configuration file world-read/writeable as the user updating it might not be a sudo-er. RUN chmod a+rw /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini