How to keep module enabled across instances in Magento 2? Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How to change theme for magento multiple store?Configuration MigrationMagento 2: How to Read From Configuration TreeMagento 2 - Environment dependent configurationConditional RequireJs configuration (Load requirejs-config.js programmatically?)How can I find all config entries for enabled payment or shipping methods and copy them to another store?How to print all magento configurations (config array) : Magento 2Magento 2 CAPTCHA not showing when enabledHow to Migrate two different Magento 1 instances to Magento 2?Magento 2: how to hide product from minicart

Is there an efficient way for synchronising audio events real-time with LEDs using an MCU?

Where can I find how to tex symbols for different fonts?

Why I cannot instantiate a class whose constructor is private in a friend class?

How would it unbalance gameplay to rule that Weapon Master allows for picking a fighting style?

Is Bran literally the world's memory?

Bright yellow or light yellow?

Why is arima in R one time step off?

What's called a person who works as someone who puts products on shelves in stores?

How would you suggest I follow up with coworkers about our deadline that's today?

Will I lose my paid in full property

Simulate round-robin tournament draw

Getting AggregateResult variables from Execute Anonymous Window

Why isn't everyone flabbergasted about Bran's "gift"?

Marquee sign letters

How was Lagrange appointed professor of mathematics so early?

false 'Security alert' from Google - every login generates mails from 'no-reply@accounts.google.com'

Is it appropriate to mention a relatable company blog post when you're asked about the company?

Is there a possibility to generate a list dynamically in Latex?

How to keep bees out of canned beverages?

Determinant of a matrix with 2 equal rows

What does the black goddess statue do and what is it?

Coin Game with infinite paradox

How to translate "red flag" into Spanish?

Did war bonds have better investment alternatives during WWII?



How to keep module enabled across instances in Magento 2?



Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?How to change theme for magento multiple store?Configuration MigrationMagento 2: How to Read From Configuration TreeMagento 2 - Environment dependent configurationConditional RequireJs configuration (Load requirejs-config.js programmatically?)How can I find all config entries for enabled payment or shipping methods and copy them to another store?How to print all magento configurations (config array) : Magento 2Magento 2 CAPTCHA not showing when enabledHow to Migrate two different Magento 1 instances to Magento 2?Magento 2: how to hide product from minicart



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















is there any way to keep free contributed plugin (for example MageMonkey 2) to be enabled across different instances of website(dev, stage, prod), keeping the configuration?










share|improve this question
























  • As per I know currently we don't have mixture of this 2 commands php bin/magento deploy:mode:set developer/production & php bin/magento module:enable MODULE_NAME

    – Ankit Shah
    Mar 29 '17 at 8:53











  • Thank You, for response. I can execute this commands in my CI scripts, I meant more generic way, for example to enable module in update script from other module, or extension allowing to keep configuration through instances, like features in drupal, or some hook around composer.

    – Damir Gadiev
    Mar 29 '17 at 9:16

















1















is there any way to keep free contributed plugin (for example MageMonkey 2) to be enabled across different instances of website(dev, stage, prod), keeping the configuration?










share|improve this question
























  • As per I know currently we don't have mixture of this 2 commands php bin/magento deploy:mode:set developer/production & php bin/magento module:enable MODULE_NAME

    – Ankit Shah
    Mar 29 '17 at 8:53











  • Thank You, for response. I can execute this commands in my CI scripts, I meant more generic way, for example to enable module in update script from other module, or extension allowing to keep configuration through instances, like features in drupal, or some hook around composer.

    – Damir Gadiev
    Mar 29 '17 at 9:16













1












1








1








is there any way to keep free contributed plugin (for example MageMonkey 2) to be enabled across different instances of website(dev, stage, prod), keeping the configuration?










share|improve this question
















is there any way to keep free contributed plugin (for example MageMonkey 2) to be enabled across different instances of website(dev, stage, prod), keeping the configuration?







magento2 module configuration






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 3 mins ago









Muhammad Anas

8051322




8051322










asked Mar 29 '17 at 8:35









Damir GadievDamir Gadiev

62




62












  • As per I know currently we don't have mixture of this 2 commands php bin/magento deploy:mode:set developer/production & php bin/magento module:enable MODULE_NAME

    – Ankit Shah
    Mar 29 '17 at 8:53











  • Thank You, for response. I can execute this commands in my CI scripts, I meant more generic way, for example to enable module in update script from other module, or extension allowing to keep configuration through instances, like features in drupal, or some hook around composer.

    – Damir Gadiev
    Mar 29 '17 at 9:16

















  • As per I know currently we don't have mixture of this 2 commands php bin/magento deploy:mode:set developer/production & php bin/magento module:enable MODULE_NAME

    – Ankit Shah
    Mar 29 '17 at 8:53











  • Thank You, for response. I can execute this commands in my CI scripts, I meant more generic way, for example to enable module in update script from other module, or extension allowing to keep configuration through instances, like features in drupal, or some hook around composer.

    – Damir Gadiev
    Mar 29 '17 at 9:16
















As per I know currently we don't have mixture of this 2 commands php bin/magento deploy:mode:set developer/production & php bin/magento module:enable MODULE_NAME

– Ankit Shah
Mar 29 '17 at 8:53





As per I know currently we don't have mixture of this 2 commands php bin/magento deploy:mode:set developer/production & php bin/magento module:enable MODULE_NAME

– Ankit Shah
Mar 29 '17 at 8:53













Thank You, for response. I can execute this commands in my CI scripts, I meant more generic way, for example to enable module in update script from other module, or extension allowing to keep configuration through instances, like features in drupal, or some hook around composer.

– Damir Gadiev
Mar 29 '17 at 9:16





Thank You, for response. I can execute this commands in my CI scripts, I meant more generic way, for example to enable module in update script from other module, or extension allowing to keep configuration through instances, like features in drupal, or some hook around composer.

– Damir Gadiev
Mar 29 '17 at 9:16










1 Answer
1






active

oldest

votes


















0














Suggested solution:



I've managed situation by adding required module to composer.json of my custom administrative module managing dependencies to another modules and adding UpgradeData.php with update script.



More detailed explanation:



Code structure



|--app/
|--code/
|--<My Vendor>/
|-- ...
|--<My Module>/
|-- ...
|--Helper
|--Configuration.php
|--Setup/
|--UpgradeData.php # save custom module settings here
|-- ...
|--composer.json # module's composer file
|-- ...
|--vendor/
|--<ContribVendor>/
|--<ContribModule>/
|-- ...
|--composer.json # home directory composer file
|--auth.json # can be gitignored


Module composer.json sample




"name": "<My Vendor>/<My Module>",
"description": "N/A",
"require": 7.0.2,
"type": "magento2-module",
"version": "<My Module version>",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload":
"files": [
"registration.php"
]




Upgrade script sample:



<?php
namespace <MyVendor>UpdatesSetup;

use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use <MyVendor><My Module>HelperConfiguration;
class UpgradeData implements UpgradeDataInterface

/**
* @var <MyVendor><My Module>HelperConfiguration
*/
protected $config;

public function __construct(
Configuration $config
)
$this->config = $config;


/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

$setup->startSetup();
try
if (version_compare($context->getVersion(), '<ModuleVersion>', '<='))
$this->config->setMyModuleSettings(); # Implemented in HELPER below.


catch (Exception $e)
print $e->getMessage();


$setup->endSetup();




Helper script sample:



<?php
namespace FFWUpdatesHelper;

use MagentoConfigModelResourceModelConfig;
use MagentoFrameworkAppHelperContext;

class Configuration extends MagentoFrameworkAppHelperAbstractHelper

/**
* @var MagentoConfigModelResourceModelConfig
*/
protected $config;

public function construct(
Context $context,
Config $config
)
parent::__construct($context);
$this->config = $config;


/**
* Helper to set <My Module> settings.
*/
public function setMyModuleSettings()
$this->config->saveConfig('<Config key according to schema.xml of module implementing config - ContribModule in our case>', <Value>, '<Scope>', '<ScopeId>');




Final step



I my CI i run 2 steps on each deployment - during development:



magento setup:upgrade
magento setup:di:compile


Disclaimer



Do not forget to add your api keys for contrib module to composer auth.json file (or any other authentication method for composer).






share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f166688%2fhow-to-keep-module-enabled-across-instances-in-magento-2%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Suggested solution:



    I've managed situation by adding required module to composer.json of my custom administrative module managing dependencies to another modules and adding UpgradeData.php with update script.



    More detailed explanation:



    Code structure



    |--app/
    |--code/
    |--<My Vendor>/
    |-- ...
    |--<My Module>/
    |-- ...
    |--Helper
    |--Configuration.php
    |--Setup/
    |--UpgradeData.php # save custom module settings here
    |-- ...
    |--composer.json # module's composer file
    |-- ...
    |--vendor/
    |--<ContribVendor>/
    |--<ContribModule>/
    |-- ...
    |--composer.json # home directory composer file
    |--auth.json # can be gitignored


    Module composer.json sample




    "name": "<My Vendor>/<My Module>",
    "description": "N/A",
    "require": 7.0.2,
    "type": "magento2-module",
    "version": "<My Module version>",
    "license": [
    "OSL-3.0",
    "AFL-3.0"
    ],
    "autoload":
    "files": [
    "registration.php"
    ]




    Upgrade script sample:



    <?php
    namespace <MyVendor>UpdatesSetup;

    use MagentoFrameworkSetupUpgradeDataInterface;
    use MagentoFrameworkSetupModuleContextInterface;
    use MagentoFrameworkSetupModuleDataSetupInterface;
    use <MyVendor><My Module>HelperConfiguration;
    class UpgradeData implements UpgradeDataInterface

    /**
    * @var <MyVendor><My Module>HelperConfiguration
    */
    protected $config;

    public function __construct(
    Configuration $config
    )
    $this->config = $config;


    /**
    * @inheritdoc
    * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
    */
    public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

    $setup->startSetup();
    try
    if (version_compare($context->getVersion(), '<ModuleVersion>', '<='))
    $this->config->setMyModuleSettings(); # Implemented in HELPER below.


    catch (Exception $e)
    print $e->getMessage();


    $setup->endSetup();




    Helper script sample:



    <?php
    namespace FFWUpdatesHelper;

    use MagentoConfigModelResourceModelConfig;
    use MagentoFrameworkAppHelperContext;

    class Configuration extends MagentoFrameworkAppHelperAbstractHelper

    /**
    * @var MagentoConfigModelResourceModelConfig
    */
    protected $config;

    public function construct(
    Context $context,
    Config $config
    )
    parent::__construct($context);
    $this->config = $config;


    /**
    * Helper to set <My Module> settings.
    */
    public function setMyModuleSettings()
    $this->config->saveConfig('<Config key according to schema.xml of module implementing config - ContribModule in our case>', <Value>, '<Scope>', '<ScopeId>');




    Final step



    I my CI i run 2 steps on each deployment - during development:



    magento setup:upgrade
    magento setup:di:compile


    Disclaimer



    Do not forget to add your api keys for contrib module to composer auth.json file (or any other authentication method for composer).






    share|improve this answer



























      0














      Suggested solution:



      I've managed situation by adding required module to composer.json of my custom administrative module managing dependencies to another modules and adding UpgradeData.php with update script.



      More detailed explanation:



      Code structure



      |--app/
      |--code/
      |--<My Vendor>/
      |-- ...
      |--<My Module>/
      |-- ...
      |--Helper
      |--Configuration.php
      |--Setup/
      |--UpgradeData.php # save custom module settings here
      |-- ...
      |--composer.json # module's composer file
      |-- ...
      |--vendor/
      |--<ContribVendor>/
      |--<ContribModule>/
      |-- ...
      |--composer.json # home directory composer file
      |--auth.json # can be gitignored


      Module composer.json sample




      "name": "<My Vendor>/<My Module>",
      "description": "N/A",
      "require": 7.0.2,
      "type": "magento2-module",
      "version": "<My Module version>",
      "license": [
      "OSL-3.0",
      "AFL-3.0"
      ],
      "autoload":
      "files": [
      "registration.php"
      ]




      Upgrade script sample:



      <?php
      namespace <MyVendor>UpdatesSetup;

      use MagentoFrameworkSetupUpgradeDataInterface;
      use MagentoFrameworkSetupModuleContextInterface;
      use MagentoFrameworkSetupModuleDataSetupInterface;
      use <MyVendor><My Module>HelperConfiguration;
      class UpgradeData implements UpgradeDataInterface

      /**
      * @var <MyVendor><My Module>HelperConfiguration
      */
      protected $config;

      public function __construct(
      Configuration $config
      )
      $this->config = $config;


      /**
      * @inheritdoc
      * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
      */
      public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

      $setup->startSetup();
      try
      if (version_compare($context->getVersion(), '<ModuleVersion>', '<='))
      $this->config->setMyModuleSettings(); # Implemented in HELPER below.


      catch (Exception $e)
      print $e->getMessage();


      $setup->endSetup();




      Helper script sample:



      <?php
      namespace FFWUpdatesHelper;

      use MagentoConfigModelResourceModelConfig;
      use MagentoFrameworkAppHelperContext;

      class Configuration extends MagentoFrameworkAppHelperAbstractHelper

      /**
      * @var MagentoConfigModelResourceModelConfig
      */
      protected $config;

      public function construct(
      Context $context,
      Config $config
      )
      parent::__construct($context);
      $this->config = $config;


      /**
      * Helper to set <My Module> settings.
      */
      public function setMyModuleSettings()
      $this->config->saveConfig('<Config key according to schema.xml of module implementing config - ContribModule in our case>', <Value>, '<Scope>', '<ScopeId>');




      Final step



      I my CI i run 2 steps on each deployment - during development:



      magento setup:upgrade
      magento setup:di:compile


      Disclaimer



      Do not forget to add your api keys for contrib module to composer auth.json file (or any other authentication method for composer).






      share|improve this answer

























        0












        0








        0







        Suggested solution:



        I've managed situation by adding required module to composer.json of my custom administrative module managing dependencies to another modules and adding UpgradeData.php with update script.



        More detailed explanation:



        Code structure



        |--app/
        |--code/
        |--<My Vendor>/
        |-- ...
        |--<My Module>/
        |-- ...
        |--Helper
        |--Configuration.php
        |--Setup/
        |--UpgradeData.php # save custom module settings here
        |-- ...
        |--composer.json # module's composer file
        |-- ...
        |--vendor/
        |--<ContribVendor>/
        |--<ContribModule>/
        |-- ...
        |--composer.json # home directory composer file
        |--auth.json # can be gitignored


        Module composer.json sample




        "name": "<My Vendor>/<My Module>",
        "description": "N/A",
        "require": 7.0.2,
        "type": "magento2-module",
        "version": "<My Module version>",
        "license": [
        "OSL-3.0",
        "AFL-3.0"
        ],
        "autoload":
        "files": [
        "registration.php"
        ]




        Upgrade script sample:



        <?php
        namespace <MyVendor>UpdatesSetup;

        use MagentoFrameworkSetupUpgradeDataInterface;
        use MagentoFrameworkSetupModuleContextInterface;
        use MagentoFrameworkSetupModuleDataSetupInterface;
        use <MyVendor><My Module>HelperConfiguration;
        class UpgradeData implements UpgradeDataInterface

        /**
        * @var <MyVendor><My Module>HelperConfiguration
        */
        protected $config;

        public function __construct(
        Configuration $config
        )
        $this->config = $config;


        /**
        * @inheritdoc
        * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
        */
        public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

        $setup->startSetup();
        try
        if (version_compare($context->getVersion(), '<ModuleVersion>', '<='))
        $this->config->setMyModuleSettings(); # Implemented in HELPER below.


        catch (Exception $e)
        print $e->getMessage();


        $setup->endSetup();




        Helper script sample:



        <?php
        namespace FFWUpdatesHelper;

        use MagentoConfigModelResourceModelConfig;
        use MagentoFrameworkAppHelperContext;

        class Configuration extends MagentoFrameworkAppHelperAbstractHelper

        /**
        * @var MagentoConfigModelResourceModelConfig
        */
        protected $config;

        public function construct(
        Context $context,
        Config $config
        )
        parent::__construct($context);
        $this->config = $config;


        /**
        * Helper to set <My Module> settings.
        */
        public function setMyModuleSettings()
        $this->config->saveConfig('<Config key according to schema.xml of module implementing config - ContribModule in our case>', <Value>, '<Scope>', '<ScopeId>');




        Final step



        I my CI i run 2 steps on each deployment - during development:



        magento setup:upgrade
        magento setup:di:compile


        Disclaimer



        Do not forget to add your api keys for contrib module to composer auth.json file (or any other authentication method for composer).






        share|improve this answer













        Suggested solution:



        I've managed situation by adding required module to composer.json of my custom administrative module managing dependencies to another modules and adding UpgradeData.php with update script.



        More detailed explanation:



        Code structure



        |--app/
        |--code/
        |--<My Vendor>/
        |-- ...
        |--<My Module>/
        |-- ...
        |--Helper
        |--Configuration.php
        |--Setup/
        |--UpgradeData.php # save custom module settings here
        |-- ...
        |--composer.json # module's composer file
        |-- ...
        |--vendor/
        |--<ContribVendor>/
        |--<ContribModule>/
        |-- ...
        |--composer.json # home directory composer file
        |--auth.json # can be gitignored


        Module composer.json sample




        "name": "<My Vendor>/<My Module>",
        "description": "N/A",
        "require": 7.0.2,
        "type": "magento2-module",
        "version": "<My Module version>",
        "license": [
        "OSL-3.0",
        "AFL-3.0"
        ],
        "autoload":
        "files": [
        "registration.php"
        ]




        Upgrade script sample:



        <?php
        namespace <MyVendor>UpdatesSetup;

        use MagentoFrameworkSetupUpgradeDataInterface;
        use MagentoFrameworkSetupModuleContextInterface;
        use MagentoFrameworkSetupModuleDataSetupInterface;
        use <MyVendor><My Module>HelperConfiguration;
        class UpgradeData implements UpgradeDataInterface

        /**
        * @var <MyVendor><My Module>HelperConfiguration
        */
        protected $config;

        public function __construct(
        Configuration $config
        )
        $this->config = $config;


        /**
        * @inheritdoc
        * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
        */
        public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

        $setup->startSetup();
        try
        if (version_compare($context->getVersion(), '<ModuleVersion>', '<='))
        $this->config->setMyModuleSettings(); # Implemented in HELPER below.


        catch (Exception $e)
        print $e->getMessage();


        $setup->endSetup();




        Helper script sample:



        <?php
        namespace FFWUpdatesHelper;

        use MagentoConfigModelResourceModelConfig;
        use MagentoFrameworkAppHelperContext;

        class Configuration extends MagentoFrameworkAppHelperAbstractHelper

        /**
        * @var MagentoConfigModelResourceModelConfig
        */
        protected $config;

        public function construct(
        Context $context,
        Config $config
        )
        parent::__construct($context);
        $this->config = $config;


        /**
        * Helper to set <My Module> settings.
        */
        public function setMyModuleSettings()
        $this->config->saveConfig('<Config key according to schema.xml of module implementing config - ContribModule in our case>', <Value>, '<Scope>', '<ScopeId>');




        Final step



        I my CI i run 2 steps on each deployment - during development:



        magento setup:upgrade
        magento setup:di:compile


        Disclaimer



        Do not forget to add your api keys for contrib module to composer auth.json file (or any other authentication method for composer).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 31 '17 at 7:42









        Damir GadievDamir Gadiev

        62




        62



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f166688%2fhow-to-keep-module-enabled-across-instances-in-magento-2%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Nidaros erkebispedøme

            Birsay

            Was Woodrow Wilson really a Liberal?Was World War I a war of liberals against authoritarians?Founding Fathers...