/module-indexer-deploy-config

A Magento 2 module that allows developers to lock indexer modes via deployment config.

Primary LanguagePHPOpen Software License 3.0OSL-3.0

element119 | Indexer Deploy Config

A Magento 2 module that allows developers to lock indexer modes via deployment config.


github release github release date license packagist downloads

๐Ÿ“ Features

โœ”๏ธ Allows you to selectively lock indexer modes via the app/etc/config.php file

โœ”๏ธ Indexer configuration validated and imported as part of app:config:import

โœ”๏ธ Supports custom indexers

โœ”๏ธ Provides messaging for admins to see which indexers are locked via deploy config

โœ”๏ธ Informs admins when they try to change indexer modes that are locked via deploy config

โœ”๏ธ Supports Magento Open Source and Adobe Commerce

โœ”๏ธ Supports Hyvรค and Luma based themes

โœ”๏ธ Seamless integration with Magento

โœ”๏ธ Built with developers and extensibility in mind to make customisations as easy as possible

โœ”๏ธ Installable via Composer


๐Ÿ”Œ Installation

Run the following command to install this module:

composer require element119/module-indexer-deploy-config
php bin/magento setup:upgrade

โซ Updating

Run the following command to update this module:

composer update element119/module-indexer-deploy-config
php bin/magento setup:upgrade

โŒ Uninstallation

Run the following command to uninstall this module:

composer remove element119/module-indexer-deploy-config
php bin/magento setup:upgrade

๐Ÿ“š User Guide

Locking Indexer Modes

  1. Add a new indexers array to the app/etc/config.php file
  2. Add the realtime or schedule arrays to the indexers array as required
  3. Specify the indexer IDs you want to lock to a specific mode within the respective mode array

Example

'indexers' => [
    'realtime' => [
        'catalogrule_rule',
        'design_config_grid',
    ],
    'schedule' => [
        'catalog_category_product',
        'catalog_product_category',
        'catalog_product_attribute',
        'catalog_product_price',
    ],
],

Note

Empty indexer mode arrays may be omitted in the cases where you don't want to lock any indexers to that mode.


Indexer Mode Locking Cron Fallback

A new system configuration option allows you to enable a cron job that will ensure indexers are in the mode they are supposed to be in, according to deployment config. This option can be found in Stores -> Configuration -> Advanced -> System -> Indexer Mode Locking.

indexer-mode-locking-cron-config


indexer:lock-all Command

The module adds a new indexer:lock-all command that you can use to lock the indexer modes via the command line.

Description:
  Lock all indexers

Usage:
  indexer:lock-all [options]

Options:
  -m, --mode=MODE       Passing one of two modes (schedule, realtime) will lock all indexers to that mode.
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Note

You will need to run app:config:import after indexer modes have been set, unset, or changed in the deploy config.

Due to the fact that this new command writes to the deploy config files and this module makes additions to the deploy config pool, any automated deployment pipelines will need to run app:config:import in non-interactive mode by passing either -n or --no-interaction as command options to avoid the usual prompt.


no command arguments

No arguments locks the indexer modes to their current state.


realtime argument

Passing -m realtime as the argument sets all indexers to Update on Save.


schedule argument

Passing -m schedule as the argument sets all indexers to Update by Schedule.


Restricted Admin Controls

restrictded-admin-controls