magento-cloud-docker icon indicating copy to clipboard operation
magento-cloud-docker copied to clipboard

Added n98-magerun2 command to CLI containers

Open MagicLegend opened this issue 2 years ago • 2 comments

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

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

MagicLegend avatar Apr 22 '22 15:04 MagicLegend

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?

MagicLegend avatar Apr 22 '22 16:04 MagicLegend

Functional Acceptance Test Results

:white_check_mark:  All functional acceptance tests have passed.

PHP 7.2

  • :white_check_mark:  Elasticsearch72Cest
  • :white_check_mark:  Acceptance72Cest
  • :white_check_mark:  Services72Cest

PHP 7.3

  • :white_check_mark:  Elasticsearch73Cest
  • :white_check_mark:  Acceptance73Cest
  • :white_check_mark:  ServicesCest

PHP 7.4

  • :white_check_mark:  Elasticsearch74Cest
  • :white_check_mark:  Acceptance74Cest

PHP 8.1

  • :white_check_mark:  AcceptanceCest
  • :white_check_mark:  DeveloperCest
  • :white_check_mark:  ElasticsearchCest
  • :white_check_mark:  OpensearchCest
  • :white_check_mark:  MailHogCest

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