From 8a2a8c8a8a44ae2f393a7278d21ff47a5cec9add Mon Sep 17 00:00:00 2001
From: Daneyon Hansen <danehans@cisco.com>
Date: Thu, 19 Feb 2015 01:27:29 +0000
Subject: [PATCH] Implements: blueprint update-rabbit-container

Previously, the rabbit container was configured for use in
a k8s cluster. This patch updates the container to run with fig
instead of k8s.

Change-Id: Ie04f2f16771c0f733b7b09b7747325bf0d7fb1a9
---
 docker/rabbitmq/Dockerfile        | 12 +++++++++++-
 docker/rabbitmq/rabbitmq-env.conf |  3 +--
 docker/rabbitmq/start.sh          |  7 +++----
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/docker/rabbitmq/Dockerfile b/docker/rabbitmq/Dockerfile
index 57ad486ea1..a4389598af 100644
--- a/docker/rabbitmq/Dockerfile
+++ b/docker/rabbitmq/Dockerfile
@@ -1,8 +1,18 @@
 FROM kollaglue/fedora-rdo-base
 MAINTAINER Kolla Project (https://launchpad.net/kolla)
 
-RUN yum -y install rabbitmq-server; yum clean all
+# Install required packages
+RUN yum -y install rabbitmq-server && yum clean all
+
+# Run the management plugin
+RUN /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management
+
+# Copy Rabbit conf files
 ADD rabbitmq.config /etc/rabbitmq/
 ADD rabbitmq-env.conf /etc/rabbitmq/
+
+# Copy start-up script
 ADD start.sh /start.sh
+
+# Start Rabbit through the start script
 CMD ["/start.sh"]
diff --git a/docker/rabbitmq/rabbitmq-env.conf b/docker/rabbitmq/rabbitmq-env.conf
index c2b843e5ed..e76f18f0b1 100644
--- a/docker/rabbitmq/rabbitmq-env.conf
+++ b/docker/rabbitmq/rabbitmq-env.conf
@@ -1,3 +1,2 @@
-RABBITMQ_NODE_PORT=@RABBITMQ_PORT@
+RABBITMQ_NODENAME=@RABBITMQ_NODENAME@
 RABBITMQ_LOG_BASE=@RABBITMQ_LOG_BASE@
-
diff --git a/docker/rabbitmq/start.sh b/docker/rabbitmq/start.sh
index d506364240..6d90c410af 100755
--- a/docker/rabbitmq/start.sh
+++ b/docker/rabbitmq/start.sh
@@ -4,7 +4,7 @@ set -e
 
 : ${RABBITMQ_USER:=guest}
 : ${RABBITMQ_PASS:=guest}
-: ${RABBITMQ_NODE_PORT:=5672}
+: ${RABBITMQ_NODENAME:=rabbit}
 : ${RABBITMQ_LOG_BASE:=/var/log/rabbitmq}
 
 sed -i '
@@ -13,9 +13,8 @@ sed -i '
 ' /etc/rabbitmq/rabbitmq.config
 
 sed -i '
-	s|@RABBITMQ_PORT@|'"$RABBITMQ_NODE_PORT"'|g
+	s|@RABBITMQ_NODENAME@|'"$RABBITMQ_NODENAME"'|g
 	s|@RABBITMQ_LOG_BASE@|'"$RABBITMQ_LOG_BASE"'|g
 ' /etc/rabbitmq/rabbitmq-env.conf
 
-exec /usr/lib/rabbitmq/bin/rabbitmq-server
-
+exec /usr/sbin/rabbitmq-server