Skip to content

Conversation

@oshmyheliuk
Copy link
Contributor

@oshmyheliuk oshmyheliuk commented Aug 27, 2020

Description

Fixed issue with not working xdebug.

Fixed Issues (if relevant)

  1. https://jira.corp.magento.com/browse/MCLOUD-6430

Manual testing scenarios

  1. Need to be tested on macOS/Windows and Linux system
  2. Clone magento-cloud 2.3.5 template
  3. For macOS/Windows use current branch for build:compose command and follow steps from devdocs
    https://devdocs.magento.com/cloud/docker/docker-development-debug.html
  4. For Linux:
  5. build php fpm image from this branch
docker build -t test/php-fpm.7.3:latest ./vendor/magento/magento-cloud-docker/images/php/7.3-fpm
  1. Create docker-compose.override.yaml file
version: "2.1"

services:
    fpm_xdebug:
        image: 'test/php-fpm.7.3:latest'
  1. Follow steps from devdocs with one difference: run build:compose command with additional option --set-docker-host
./vendor/bin/ece-docker build:compose --mode="developer" --with-xdebug --set-docker-host

https://devdocs.magento.com/cloud/docker/docker-development-debug.html

Release notes

Added the --set-docker-host option to the ece-docker build:compose command to configure the host.docker.internal name in the fpm:xdebug container. On Linux systems, this option is required to use Xdebug in the Docker development environment.

Associated documentation updates

Add link to Magento DevDocs PR or Issue, if needed.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • Pull request introduces user-facing changes and includes meaningful release notes and documentation
  • All commits are accompanied by meaningful commit messages

* Include Xdebug if --with-xdebug is set
*/
if ($config->hasServiceEnabled(ServiceInterface::SERVICE_FPM_XDEBUG)) {
$envVariables = ['PHP_EXTENSIONS' => implode(' ', array_unique(array_merge($phpExtensions, ['xdebug'])))];
Copy link
Contributor

@NadiyaS NadiyaS Aug 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you merge with xdebug here? Should not it be in the config already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this configuration only for fpm_xdebug container and it needs to have enabled xdebug extension.
$phpExtensions may not have xdebug if it not set-up in .magento.app.yaml

[ ! -z "${MAGENTO_RUN_MODE}" ] && sed -i "s/!MAGENTO_RUN_MODE!/${MAGENTO_RUN_MODE}/" /usr/local/etc/php-fpm.conf

# Set host.docker.inernal for LINUX os
if [[ "$SET_DOCKER_HOST" = "true" ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have it enabled by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need it by default? This option has a sense only for Linux system.
Also I tested it on macOS with generated host.docker.inernal and xdebug didn't work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ic, thanks

@mveeramneni mveeramneni self-assigned this Sep 1, 2020
@mveeramneni
Copy link

Tested in MacOS and it's working fine. @BaDos is testing in his virual box

@BaDos
Copy link
Contributor

BaDos commented Sep 2, 2020

Tested on my linux machine, it works.
QA approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants