Skip to content

gmr/alpine-rabbitmq-autocluster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alpine-rabbitmq-autocluster

Small RabbitMQ image (~42MB) with the autocluster plugin

RabbitMQ Version: 3.6.2 Autocluster Version: 0.6.1

Stars Pulls

Enabled plugins

  • Autocluster
  • Consistent Hash Exchange
  • Delayed Message Exchange
  • Federation
  • Federation Management
  • Management
  • Management Visualiser
  • Message Timestamp
  • MQTT
  • Recent History Exchange
  • Sharding
  • Shovel
  • Shovel Management
  • Stomp
  • Top
  • WebStomp

Configuration

All configuration of the auto-cluster plugin should be done via environment variables.

See the RabbitMQ AutoCluster plugin Wiki for configuration settings.

Example Usage

The following example configures the autocluster plugin for use in an AWS EC2 Autoscaling group:

docker run --name rabbitmq -d \
  -e AUTOCLUSTER_TYPE=aws \
  -e AUTOCLUSTER_CLEANUP=true \
  -e CLEANUP_WARN_ONLY=false \
  -e AWS_DEFAULT_REGION=us-east-1 \
  -p 4369:4369 \
  -p 5672:5672 \
  -p 15672:15672 \
  -p 25672:25672 \
  gavinmroy/alpine-rabbitmq-autocluster

To use the AWS autocluster features, you will need an IAM policy that allows the plugin to discover the node list. The following is an example of such a policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "autoscaling:DescribeAutoScalingInstances",
                "ec2:DescribeInstances"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

If you do not want to use the IAM role for the instances, you could create a role and specify the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY when starting the container.

I've included a CloudFormation template that should let you test the plugin. The template creates an IAM Policy and Role, Security Group, ELB, Launch Configuration, and Autoscaling group.

The following is the user data snippet that for the Ubuntu image that is used in the Launch Configuration:

#cloud-config
apt_update: true
apt_upgrade: true
apt_sources:
  - source: deb https://apt.dockerproject.org/repo ubuntu-trusty main
    keyid: 58118E89F3A912897C070ADBF76221572C52609D
    filename: docker.list
packages:
  - docker-engine
runcmd:
  - export AWS_DEFAULT_REGION=`ec2metadata --availability-zone | sed s'/.$//'`
  - docker run -d --name rabbitmq --net=host -p 4369:4369 -p 5672:5672 -p 15672:15672 -p 25672:25672 -e AUTOCLUSTER_TYPE=aws -e AWS_AUTOSCALING=true -e AUTOCLUSTER_CLEANUP=true -e CLEANUP_WARN_ONLY=false -e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION gavinmroy/alpine-rabbitmq-autocluster:3.6.2-0.6.0