Managing Magento 2 with magerun2

On Servebolt, the swiss army knife for Magento 2, n98-magerun2.phar, is preinstalled and available from everywhere on the command line just by typing magerun2 . It’s not only preinstalled, but it also comes with auto-complete. This means that you can use the tab-key to view available commands.

Magento 2 already relies heavily on the Command Line Interface (CLI) with the bin/magento tool. magerun2 provides all of the features that the magento command offers, and many more. It makes sense start using magerun2instead of using the magento command.

Set deploy mode (to developer or production mode)

$ magerun2 deploy:mode:set production

Switching base URL

Changing the base URL is common when you are switching from a development environment, to going live.

List current configuration

$ magerun2 sys:store:config:base-url:list

Changing/Updating this base URL

In the following example we update the URL to https://m2test.servebo.lt 

$ magerun2 config:store:set web/unsecure/base_url https://m2test.servebo.ltweb/unsecure/base_url => https://m2test.servebo.lt$ magerun2 config:store:set web/secure/base_url https://m2test.servebo.ltweb/secure/base_url => https://m2test.servebo.lt$ magerun2 config:store:set web/unsecure/base_link_url https://m2test.servebo.ltweb/unsecure/base_url => https://m2test.servebo.lt$ magerun2 config:store:set web/secure/base_link_url https://m2test.servebo.ltweb/secure/base_url => https://m2test.servebo.lt$ magerun2 cache:flush$ magerun2 sys:store:config:base-url:list

Next steps

Now that you’ve got Magento 2 running fast, secure and smooth on your Servebolt Bolt, here are some additional documentation articles you should check out:

  1. Magento 2 tools on Servebolt
  2. Magento 2 on Servebolt Tips
  3. Managing Magento 2 with magerun2