Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow redis compression options to be specified during setup:install process #21053

Merged
merged 6 commits into from
Mar 30, 2019
Merged

Conversation

cmacdonald-au
Copy link
Contributor

@cmacdonald-au cmacdonald-au commented Feb 8, 2019

Description (*)

When installing magento, "some" redis cache specific options can be specified. The defaults are usually okay, but in some scenarios they need to be changed.

This PR provides the ability to set the compress_data and compression_lib options consistently for default/backend/redis and page_cache/redis.

Providing these options is preferred over hand-rolled app/etc/env.php "fiddling" when executing a repeatable installation test for the purpose of environment validation.

Fixed Issues (if relevant)

  1. n/a

Manual testing scenarios (*)

  1. --cache-backend=redis --cache-backend-redis-server=127.0.0.1 --cache-backend-redis-port=6379 --cache-backend-redis-db=3 --page-cache=redis --page-cache-redis-server=127.0.0.1 --page-cache-redis-port=6379 --page-cache-redis-db=4 --cache-backend-redis-compression-lib=lzf --cache-backend-redis-compress-data=1
  2. results in the appropriate change in app/etc/env.php
...
    'cache' => [
        'frontend' => [
            'default' => [
                'id_prefix' => '74c_',
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => [
                    'server' => '127.0.0.1',
                    'database' => '3',
                    'port' => '6379',
                    'password' => '',
                    'compress_data' => '1',
                    'compression_lib' => 'lzf'
                ]
            ],
            'page_cache' => [
                'id_prefix' => '74c_',
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => [
                    'server' => '127.0.0.1',
                    'database' => '4',
                    'port' => '6379',
                    'compress_data' => '1',
                    'password' => '',
                    'compression_lib' => ''
                ]
            ]
        ]
    ]
  1. installation process should complete and site should function as expected.
  2. Cm_Cache_Backend_Redis will throw an exception if an invalid compression_lib (eg: notavalidlib) is supplied and compress_data is enabled.
./bin/magento setup:install --cache-backend=redis --cache-backend-redis-compression-lib=notavalidlib --cache-backend-redis-compress-data=1
Starting Magento installation:
...
...
Running schema recurring...
In Redis.php line 1186:

  Unrecognized 'compression_lib'.

  1. Any value can be set as the compression_lib if compress_data is disabled (compression will not be attempted).
./bin/magento setup:install --cache-backend=redis --cache-backend-redis-compression-lib=notavalidlib --cache-backend-redis-compress-data=0
Starting Magento installation:
...
...
[SUCCESS]: Magento installation complete.
...

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team
Copy link
Contributor

Hi @cmacdonald-au. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Feb 8, 2019

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @aleron75, thank you for the review.
ENGCOM-4267 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@cmacdonald-au thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@VasylShvorak
Copy link
Contributor

✔️ QA passed

@m2-assistant
Copy link

m2-assistant bot commented Mar 30, 2019

Hi @cmacdonald-au, 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.

@magento-engcom-team magento-engcom-team merged commit 337397a into magento:2.3-develop Mar 30, 2019
magento-engcom-team pushed a commit that referenced this pull request Mar 30, 2019
@magento-engcom-team magento-engcom-team added this to the Release: 2.3.2 milestone Mar 30, 2019
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