Skip to content

RabbitMQ Configuration

RabbitMQ Info

You can view the status of RabbitmQ under the info section:

Here there are three buttons, and a text box which will show the full RabbitMQ start-up output. Enable and Disable stop and start RabbitMQ. Reset Data will clear the existing queue data and user setup for RabbitMQ. See the Advanced section below for more detail on resetting your RabbitMQ service.

RabbitMQ Configuration

The RabbitMQ message broker service can be enabled in your stratus panel under RabbitMQ->Configuration. Please note this will redeploy services.

You can change the default username / password. These credentials much match the ones placed in env.php. They are only used on the initial deploy of RabbitMQ. If you change these credentials after starting RabbitMQ, it will not affect the existing user. See the Advanced section for more details.

Below is an example configuration. Please note that on a production instance the host will be rabbitmq . On a development instance the host will be 0.0.0.0

'queue' => [
  'amqp' => [
    'host' => 'rabbitmq',
    'port' => '5672',
    'user' => 'username',
    'password' => '8b2sovjbgg4atsbpn0s0oam9u6vekh6i',
    'virtualhost' => '/',
    'ssl' => 'false',
    'ssl_options' => []
   ]
],
'cron_consumers_runner' => [
  'cron_run' => true,
  'max_messages' => 20000,
  'consumers' => [
    'async.operations.all',
    'codegeneratorProcessor'
  ]
]

To see a list of available consumers that you can set to run, please use:

php bin/magento queue:consumers:list

RabbitMQ Advanced Usage

RabbitMQ also ships with command line and other management utilities. Depending on your exact usage of RabbitMQ, you may need to use it to debug and investigate certain issues with your store. If you want to call RabbitMQ procedures from the command line you must use the rabbitmqadmin utility. For example, to list the existing users, run this command:

$ rabbitmqadmin --host rabbitmq -u kermit -p wakkawakka1234 list users 
+--------+--------------------------------+--------------------------------------------------+---------------+
|  name  |       hashing_algorithm        |                  password_hash                   |     tags      |
+--------+--------------------------------+--------------------------------------------------+---------------+
| kermit | rabbit_password_hashing_sha256 | 7YJGqcUKDcnvFkxwMOq+4OLCZw8RrYZL5sOGTAz2vXdXkLBF | administrator |
+--------+--------------------------------+--------------------------------------------------+---------------+

The official RabbitMQ documentation has various examples of how to use the rabbitmqadmin admin tool. On Mojo Stratus, its important to use the correct host and user in all your commands. Like the env.php setup, the host will always be rabbitmq or 0.0.0.0.

RabbitMQ Web Interface.

Since the RabbitMQ management plugins are enabled in Mojo Stratus, it is possible to access it with the right configuration. The Web UI is always running, but cannot be accessed by default. You can access it in two ways:

  1. Use an SSH tunnel to expose the web interface on a local port
  2. Set up a proxy pass directive in your Stratus Nginx configuration

SSH Tunnel

An SSH tunnel is the most secure way to access the RabbitMQ UI. To access it, make sure you already have an SSH user configured for your Stratus instance. And that you are able to connect with the user. Then via terminal, run this command with the correct user/host/port information to open a tunnel:

ssh -p <port> <user>@<ssh-endpoint>.mojostratus.io -L 15672:rabbitmq:15672

Change rabbitmq to 0.0.0.0, if you are using autoscaling. With the tunnel connected, open your local browser to http://localhost:15672/ . You should see a login screen like this:

Using the username/password configured for RabbitMQ in your initial start-up (under RabbitMQ -> Configuration) you can log in and access graphs and other data about RabbitMQ, as well as manage users etc. Read the official docs for more detail.

Nginx Proxy Pass

This is not recommended, but can be used for quick access without a tunnel. We also recommend securing the location by IP whitelist if you want to leave the UI exposed permanently. To enable RabbitMQ via direct web access, go to Nginx -> Includes in your Stratus panel.

Add a new location directive similar to this and click Update.

location /yourrabbitadmin/ {
    proxy_pass http://rabbitmq:15672/;
}

You should now see the same RabbitMQ admin login screen from the SSH tunnel section but on your Stratus website at https://mysite.com/yourrabbitadmin/

Resetting Data

Under RabbitMQ -> Info, there is an extra button titled Reset Data. This button should be used if you need to wipe your RabbitMQ service clean of all data and start with a new user. Otherwise, RabbitMQ data is persistent, similar to MySQL, if the service is stopped and restarted. Persistent data is important since some stores may use RabbitMQ to store important data like order data until its later saved within the Magento MySQL data.

The reset data button will warn you before proceeding. If you need to adjust your user credentials for RabbitMQ or make another use without losing data, use the RabbitMQ admin web interface or rabbitmqadmin CLI tool.