Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Extend description of debugging CLI command on Pro Staging and Production #6934

Merged
merged 12 commits into from
Apr 7, 2020

Conversation

NadiyaS
Copy link
Contributor

@NadiyaS NadiyaS commented Mar 26, 2020

Purpose of this pull request

Update instructions for using Xdebug to debug Magento CLI commands. Add information about specifying the Xdebug configuration file when debugging on Pro Production and Staging environments.

Affected DevDocs pages

whatsnew
Updated Xdebug instructions for debugging CLI commands on Magento Cloud Pro Production and Staging environments to specify the required Xdebug php configuration file (php.xdebug.ini) when debugging commands.

@devops-devdocs
Copy link
Collaborator

An admin must run tests on this PR before it can be merged.

@jeff-matthews jeff-matthews added the Internal Dev Differentiates work between community and Magento staff label Mar 26, 2020
@meker12 meker12 requested a review from arhiopterecs March 26, 2020 19:47
@meker12 meker12 self-assigned this Mar 26, 2020
@meker12 meker12 self-requested a review March 26, 2020 19:48
@meker12 meker12 added Technical Updates to the code or processes that alter the technical content of the doc 2.x and removed Progress: review labels Mar 26, 2020
@@ -325,6 +325,16 @@ php -d xdebug.profiler_enable=On -d xdebug.max_nesting_level=9999 ...

If you expect to use SSH and debug multiple times, you can put the export commands into a bash script in the `/tmp` directory to run them each time.

## Debug CLI commands for Pro Staging and Production {#pro-debugcli}
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of creating a separate section, I think it's better to include the information inline in the existing section. However, the instructions in that section were a bit disjointed which makes it hard to integrate new content. I suggest replacing the entire section, starting at line 301 with the content below the ----. If the suggested revision introduced any technical errors or confusion, let's discuss.


Debug CLI commands {#debugcli}

When you debug CLI commands, you must configure environment variables to enable Xdebug. These variables are removed when the SSH session ends. If you expect to debug over multiple SSH sessions, add the export commands for the variable configuration to a bash script in the /tmp directory to run each time you start a session.

{:.procedure}
To enable Xdebug for debugging CLI commands:

  1. SSH to the environment you want to debug.

  2. Configure environment variables:

    export XDEBUG_CONFIG='PHPSTORM'
    export PHP_IDE_CONFIG="serverName=<name of the server that is configured in PHPSTORM>"

    Optionally, add Xdebug runtime options to the environment variable configuration.

    php -d xdebug.profiler_enable=On -d xdebug.max_nesting_level=9999 ...
  3. Begin debugging.

    On Starter environments and Pro Integration environments, run the CLI command to debug, for example:

    php bin/magento cache:clean

    On Pro Staging and Production environments, you must specify the path to the Xdebug php configuration file when debugging CLI commands, for example:

    php -c /etc/platform/USERNAME/php.xdebug.ini bin/magento cache:clean

Comment on lines 323 to 336
1. Begin debugging

On Starter environments and Pro Integration environments, run the CLI command to debug.
You may add runtime options, for example:

```bash
php -d xdebug.profiler_enable=On -d xdebug.max_nesting_level=9999 bin/magento cache:clean
```

On Pro Staging and Production environments, you must specify the path to the Xdebug php configuration file when debugging CLI commands, for example:

If you expect to use SSH and debug multiple times, you can put the export commands into a bash script in the `/tmp` directory to run them each time.
```bash
php -c /etc/platform/USERNAME/php.xdebug.ini bin/magento cache:clean
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like lines 325 - 336 are indented one space too far.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are right. There were 4 spaces instead of 3. Fixed

@shrielenee
Copy link
Contributor

@NadiyaS It looks like the linting test failed because there is a listing error:

Run mdl --style=_checks/styles/style-rules-prod --ignore-front-matter --git-recurse -- .
src/cloud/howtos/debug.md:319: MD009 Trailing spaces

A detailed description of the rules is available at https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md
##[error]Process completed with exit code 1.

@shrielenee
Copy link
Contributor

@NadiyaS Please fix (ask if you have any questions!) and we'll merge. Thanks!

@meker12
Copy link
Contributor

meker12 commented Apr 4, 2020

Still waiting for technical review on this one from @arhiopterecs before it can be merged. Thx.

@shrielenee shrielenee added the Waiting for Response Waiting for response from internal/external parties label Apr 4, 2020
Comment on lines 320 to 321
These variables are removed when the SSH session ends.
If you expect to use SSH and debug multiple times, you can put the export commands into a bash script in the `/tmp` directory to run them each time.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that it’s enough to indicate that the variables are related to the session.
I propose to remove this:
"If you expect to use SSH and debug multiple times, you can put the export commands into a bash script in the /tmp directory to run them each time."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@meker12
Copy link
Contributor

meker12 commented Apr 7, 2020

running tests

@meker12 meker12 merged commit b3e6ce5 into magento:master Apr 7, 2020
@ghost
Copy link

ghost commented Apr 7, 2020

Hi @NadiyaS, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@hguthrie hguthrie removed the Waiting for Response Waiting for response from internal/external parties label Oct 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2.x Internal Dev Differentiates work between community and Magento staff Technical Updates to the code or processes that alter the technical content of the doc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants