rabbitmq Image

Lagoon RabbitMQ Dockerfile with management plugin installed, based on the official rabbitmq:3-management image at docker-hub.

This Dockerfile is intended to be used to setup a standalone RabbitMQ queue broker as well as base image to setup a cluster with HA queues support by default (Mirrored queues).
By default the RabbitMQ broker is started as single node. If you want to start a cluster, you need to use the rabbitmq-cluster Docker image, based on rabbitmq image plus the rabbitmq_peer_discovery_k8s plugin.

Lagoon & OpenShift adaptions

This image is prepared to be used on Lagoon which leverages OpenShift. There are therefore some things already done:

  • Folder permissions are automatically adapted with fix-permissions so this image will work with a random user and therefore also on OpenShift.
  • The file /etc/rabbitmq/definitions.json is parsed through envplate with an container-entrypoint.

Included RabbitMQ default schema (definitions.json)

To enable the support for Mirrored Queues, at least one policy must exists.
Into the definitions.json schema file, are definied the minimal entities to let the container running: virtualhost (vhost), username and password to access management UI, permissions and policies.

By default a policy called lagoon-ha is created at startup but it is not active because it doesn't match any queue's name pattern (see default Environment Variables).

"policies":[
        {"vhost":"${RABBITMQ_DEFAULT_VHOST}","name":"lagoon-ha","pattern":"${RABBITMQ_DEFAULT_HA_PATTERN}", "definition":{"ha-mode":"exactly","ha-params":2,"ha-sync-mode":"automatic","ha-sync-batch-size":5}}
  ]

By default, the ha-mode is set to exactly which controls the exact number of mirroring nodes for a queue (mirrors). The number of nodes, is controller by ha-params.
For further and custom configuration, please refer to official RabbitMQ documentation.

Environment Variables

Environment variables defined in RabbitMQ base image

Environment Variable Default Description
RABBITMQ_DEFAULT_USER guest Username for management UI access
RABBITMQ_DEFAULT_PASS guest Password for management UI access
RABBITMQ_DEFAULT_VHOST / RabbitMQ main virtualhost
RABBITMQ_DEFAULT_HA_PATTERN ^$ Regular expression to match for mirrored queues