aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrevor Bramwell <tbramwell@linuxfoundation.org>2018-10-01 10:28:17 -0700
committerTrevor Bramwell <tbramwell@linuxfoundation.org>2018-10-01 10:31:09 -0700
commit42aeeea8514b0ca99005ae64ca360a949ef9c6ef (patch)
tree234a5cd3abe85b5763376058ebcaa4514ee89ae0
parent7d275735c62c9d0ce423327d67494859e285fce7 (diff)
Use Upstream Rabbitmq Docker Container
The upstream rabbitmq container supports specifying the default admin user and password through the environment variables: RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS. Utilizing these variables removes the need to build a rabbitmq container specific to the Pharos LaaS Dashboard. Change-Id: I390d7fa9254a0f28b374235254caff59b219cd87 Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
-rw-r--r--config.env.sample4
-rw-r--r--docker-compose.yml3
-rw-r--r--rabbitmq/Dockerfile4
-rwxr-xr-xrabbitmq/init.sh10
-rw-r--r--src/pharos_dashboard/settings.py6
5 files changed, 6 insertions, 21 deletions
diff --git a/config.env.sample b/config.env.sample
index 8d0afd6..a2675ef 100644
--- a/config.env.sample
+++ b/config.env.sample
@@ -20,8 +20,8 @@ JIRA_USER_NAME=sample_jira_user
JIRA_USER_PASSWORD=sample_jira_pass
# Rabbitmq
-RABBITMQ_USER=opnfv
-RABBITMQ_PASSWORD=opnfvopnfv
+RABBITMQ_DEFAULT_USER=opnfv
+RABBITMQ_DEFAULT_PASS=opnfvopnfv
# Cleanup: time is in days
BOOKING_EXPIRE_TIME=30
diff --git a/docker-compose.yml b/docker-compose.yml
index 44a263f..63a778b 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -53,8 +53,7 @@ services:
- pharos-data:/var/lib/postgresql/data
rabbitmq:
- restart: always
- build: ./rabbitmq/
+ image: rabbitmq
container_name: rm01
env_file: config.env
ports:
diff --git a/rabbitmq/Dockerfile b/rabbitmq/Dockerfile
deleted file mode 100644
index 71162a4..0000000
--- a/rabbitmq/Dockerfile
+++ /dev/null
@@ -1,4 +0,0 @@
-FROM rabbitmq
-
-ADD init.sh /init.sh
-CMD ["/init.sh"] \ No newline at end of file
diff --git a/rabbitmq/init.sh b/rabbitmq/init.sh
deleted file mode 100755
index 9d04dd1..0000000
--- a/rabbitmq/init.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-# Create Rabbitmq user
-( sleep 10 ; \
-rabbitmqctl add_user $RABBITMQ_USER $RABBITMQ_PASSWORD 2>/dev/null ; \
-rabbitmqctl set_user_tags $RABBITMQ_USER administrator ; \
-rabbitmqctl set_permissions -p / $RABBITMQ_USER ".*" ".*" ".*" ; \
-echo "*** User '$RABBITMQ_USER' with password '$RABBITMQ_PASSWORD' completed. ***") &
-
-rabbitmq-server $@
diff --git a/src/pharos_dashboard/settings.py b/src/pharos_dashboard/settings.py
index e3b36b0..8155fd4 100644
--- a/src/pharos_dashboard/settings.py
+++ b/src/pharos_dashboard/settings.py
@@ -165,10 +165,10 @@ OAUTH_CALLBACK_URL = os.environ['DASHBOARD_URL'] + '/accounts/authenticated'
CELERY_TIMEZONE = 'UTC'
RABBITMQ_URL = 'rabbitmq'
-RABBITMQ_USER = os.environ['RABBITMQ_USER']
-RABBITMQ_PASSWORD = os.environ['RABBITMQ_PASSWORD']
+RABBITMQ_DEFAULT_USER = os.environ['RABBITMQ_DEFAULT_USER']
+RABBITMQ_DEFAULT_PASS = os.environ['RABBITMQ_DEFAULT_PASS']
-BROKER_URL = 'amqp://' + RABBITMQ_USER + ':' + RABBITMQ_PASSWORD + '@rabbitmq:5672//'
+BROKER_URL = 'amqp://' + RABBITMQ_DEFAULT_USER + ':' + RABBITMQ_DEFAULT_PASS + '@rabbitmq:5672//'
BOOKING_EXP_TIME = os.environ['BOOKING_EXPIRE_TIME']
BOOKING_MAX_NUM = os.environ['BOOKING_MAXIMUM_NUMBER']