docker
templates
rabbitmq
messaging
mqtt
RabbitMQ
RabbitMQ is a messaging/event queue broker, useful for asynchronous processing and PUB/SUB architecture.
Directory Structure
Container directory structure container_root/
../.env
../.gitignore
../docker-compose.yml
../provision/
../rabbitmq.config
../rabbitmq.enabled_plugins
Container Files
.env
rabbitmq .env ## Default: rabbitmq
RABBITMQ_CONTAINER_NAME=
## Default: rabbitmq
RABBITMQ_USER=
## Default: rabbitmq
RABBITMQ_PASS=
## Default: 5672
RABBITMQ_AMPQ_PORT=
## Default: 15672
RABBITMQ_HTTP_PORT=
## Default: ./data/rabbitmq
RABBITMQ_DATA_DIR=
## Default: ./logs/rabbitmq
RABBITMQ_LOGS_DIR=
## Default: ./provision/rabbitmq.config
RABBITMQ_CONFIG_FILE=
## Default: ./provision/rabbitmq.enabled_plugins
RABBITMQ_ENABLED_PLUGINS_FILE=
.gitignore
rabbitmq .gitignore provision/*
!*.example
!*.example.*
!example.*
!.example.*
!example.*
!example.*.*
docker-compose.yml
rabbitmq docker-compose.yml ---
services:
rabbitmq:
image: rabbitmq:management
container_name: ${RABBITMQ_CONTAINER_NAME:-rabbitmq}
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER:-rabbitmq}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASS:-rabbitmq}
# RABBITMQ_DEFAULT_VHOST: ${RABBITMQ_VHOST:-rabbitmq}
# RABBITMQ_ENABLED_PLUGINS_FILE: /etc/rabbitmq/enabled_plugins
ports:
## AMQP protocol
- ${RABBITMQ_AMPQ_PORT:-5672}:5672
- ${RABBITMQ_HTTP_PORT:-15672}:15672
volumes:
- ${RABBITMQ_DATA_DIR:-./data/rabbitmq}:/var/lib/rabbitmq
- ${RABBITMQ_LOGS_DIR:-./logs/rabbitmq}:/var/log/rabbitmq
- ${RABBITMQ_CONFIG_FILE:-./provision/rabbitmq.config}:/etc/rabbitmq/rabbitmq.config
- ${RABBITMQ_ENABLED_PLUGINS_FILE:-./provision/rabbitmq.enabled_plugins}:/etc/rabbitmq/enabled_plugins
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 30s
timeout: 30s
retries: 3
provision/rabbitmq.config
rabbitmq.config [
{rabbit, [
{queue_index_max_journal_entries, 10000},
{vm_memory_high_watermark, 0.4},
{disk_free_limit, {mem_relative, 0.1}}
]}
].
provision/rabbitmq.enabled_plugins
rabbitmq.enabled_plugins [rabbitmq_management,rabbitmq_prometheus].
Notes
The rabbitmq.config
and rabbitmq.enabled_plugins
files are not required.
These files allow you to modify RabbitMQ's container runtime, installing plugins like rabbitmq_management
(for a webUI), or modifying RabbitMQ's parameters on free disk space & memory usage.
If you do not create these files, RabbitMQ will run with its predefined defaults.
Links