Tuesday, 23 January 2018

RabbitMQ deployment With Docker

You can use to deploy your own RabbitMQ server using docker. There are several ways to configure your deployment, but this is a generic method to configure RabbitMQ in docker.

  • Deploy with the web interface to manage your server.
  • Specify a username and password for managing the server.
  • Use a volume to keep state across containers being created/destroyed.
  • Uses port 80 for the web interface so that you can just go to the hostname in your browser without having to enter a port number.

Server Requirements : 
  • 512 MB of RAM
  • 1 vCPU
#!/bin/bash

# Settings
CONTAINER_NAME="rabbitmq-container"
DEFAULT_USER="root"
DEFAULT_PASSWORD="yourpassword"
CLUSTER_COOKIE="random"
HOSTNAME="rabbitmq.yourdomain.com"

# Don't change below this line.
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
docker kill $CONTAINER_NAME
docker rm $CONTAINER_NAME

docker run -d \
--restart=always \
--hostname $HOSTNAME \
--name $CONTAINER_NAME \
-p 80:15672 \
-p 4369:4369 \
-p 5671:5671 \
-p 5672:5672 \
-p 15671:15671 \
-p 25672:25672 \
-e RABBITMQ_ERLANG_COOKIE="$CLUSTER_COOKIE" \
-e RABBITMQ_DEFAULT_USER="$DEFAULT_USER" \
-e RABBITMQ_DEFAULT_PASS="$DEFAULT_PASSWORD" \
-v $DIR/rabbitmq-state:/var/lib/rabbitmq \
rabbitmq:3-management



Featured post

How to create dynamic schema in mongodb

Sometime what we need in our application is to create mongodb schema for collection and some of our collection schema are same but names are...

Popular Posts