magento / magento-cloud-docker

All Submissions you make to Magento Inc. (“Magento") through GitHub are subject to the following terms and conditions: (1) You grant Magento a perpetual, worldwide, non-exclusive, no charge, royalty free, irrevocable license under your applicable copyrights and patents to reproduce, prepare derivative works of, display, publically perform, sublicense and distribute any feedback, ideas, code, or other information (“Submission") you submit through GitHub. (2) Your Submission is an original work of authorship and you are the owner or are legally entitled to grant the license stated above. (3) You agree to the Contributor License Agreement found here: https://github.com/magento/magento2/blob/master/CONTRIBUTOR_LICENSE_AGREEMENT.html
Open Software License 3.0
256 stars 192 forks source link

Added n98-magerun2 command to CLI containers #346

Open MagicLegend opened 2 years ago

MagicLegend commented 2 years ago

Description

This PR adds the N98-Magerun2 binary to the CLI containers to be used during development. Magerun can be ran in a similar fashion as the other commands.

Fixed Issues (if relevant)

  1. Resolves magento/magento-cloud-docker#345

Manual testing scenarios

E.g. in the images/php/7.4-cli folder:

  1. docker build --tag magento/magento-cloud-docker-php:7.4-cli-1.3.2-magerun .
  2. docker run --rm magento/magento-cloud-docker-php:7.4-cli-1.3.2-magerun magerun2 list

It should output the list of possible commands. I have noticed that for me it was required to force ANSI output with the --ansi flag; is this only on my machine, or reproducible across the board? If the latter we should consider updating the magerun2 command to always pass the --ansi flag.

I have tested the 7.2-cli, 7.3-cli and 7.4-cli containers. I might have missed some incompatibility somewhere.

Release notes

For user-facing changes, add a meaningful release note. For examples, see Magento Cloud Docker release notes.

Added N98-Magerun2 binary to CLI containers.

Associated documentation updates

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

If this change will be accepted I will do the digging in the DevDocs to add references to this functionality to it.

Contribution checklist

MagicLegend commented 2 years ago

Potential issues I've found during usage:

magerun is an alias for docker-compose run --rm deploy magerun2

Here I had left query logging enabled:

magerun sys:cron:list
Creating <project>-docker_deploy_run ... done

In Write.php line 62:

  The path "/app/var/debug/db.log" is not writable.  

sys:cron:list [--format [FORMAT]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--root-dir [ROOT-DIR]] [--skip-config] [--skip-root-check] [--skip-core-commands] [--skip-magento-compatibility-check] [--] <command>

ERROR: 1

Disabling query logging fixed the issue.


This appeared to happen after a cache flush and before a setup:di:compile:

magerun sys:cron:list
Creating <project>-docker_deploy_run ... done                                                                                                                                          

In ClassReader.php line 28:                                                                                                                                                         

  Class Magento\Cron\Model\ResourceModel\Schedule\Collection\Interceptor does not exist                                                                                             

sys:cron:list [--format [FORMAT]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--root-dir [ROOT-DIR]] [--skip-config] [--skip-root-check] [--skip-core-commands] [--skip-magento-compatibility-check] [--] <command>                                                                                        

ERROR: 1

Manually running setup:di:compile fixed the issue.


Due to the container executing magerun as www-data it cannot write log files:

Xdebug: [Log Files] File '/app/var/log/xdebug-deploy.log' could not be opened

Can we do something about the permissions this user has on the var/log directory?

magento-cloud-ft-jenkins-svc commented 2 years ago

Functional Acceptance Test Results

:white_check_mark:  All functional acceptance tests have passed.

PHP 7.2

PHP 7.3

PHP 7.4

PHP 8.1

This comment was generated by Jenkins job magento-cloud-docker/functional build 126.