From eef32f0353d5cee9b4bb876767aab5c8298375eb Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Thu, 27 Aug 2015 19:01:57 -0700 Subject: Move scripts for rabbitmq to docker_templates Change-Id: I6f06c067c18e4a3eafbed2b2796aa1cfe6c9b28c Partially-Implements: blueprint remove-docker-dir --- docker_templates/rabbitmq/config-external.sh | 20 +++++++++++++++++++- docker_templates/rabbitmq/config-rabbit.sh | 8 +++++++- docker_templates/rabbitmq/start.sh | 24 +++++++++++++++++++++++- 3 files changed, 49 insertions(+), 3 deletions(-) mode change 120000 => 100644 docker_templates/rabbitmq/config-external.sh mode change 120000 => 100644 docker_templates/rabbitmq/config-rabbit.sh mode change 120000 => 100755 docker_templates/rabbitmq/start.sh (limited to 'docker_templates') diff --git a/docker_templates/rabbitmq/config-external.sh b/docker_templates/rabbitmq/config-external.sh deleted file mode 120000 index d0f0563db..000000000 --- a/docker_templates/rabbitmq/config-external.sh +++ /dev/null @@ -1 +0,0 @@ -../../docker/common/rabbitmq/config-external.sh \ No newline at end of file diff --git a/docker_templates/rabbitmq/config-external.sh b/docker_templates/rabbitmq/config-external.sh new file mode 100644 index 000000000..33810d621 --- /dev/null +++ b/docker_templates/rabbitmq/config-external.sh @@ -0,0 +1,19 @@ +#!/bin/bash +SOURCE_CONFIG="/opt/kolla/rabbitmq/rabbitmq.config" +TARGET_CONFIG="/etc/rabbitmq/rabbitmq.config" +SOURCE_ENV="/opt/kolla/rabbitmq/rabbitmq-env.conf" +TARGET_ENV="/etc/rabbitmq/rabbitmq-env.conf" +OWNER="rabbitmq" + +# Cluster configuration +if [[ -f "$SOURCE_CONFIG" ]]; then + cp -af $SOURCE_CONFIG $TARGET_CONFIG + chown ${OWNER}: $TARGET_CONFIG + chmod 0600 $TARGET_CONFIG +fi + +if [[ -f "$SOURCE_ENV" ]]; then + cp -af $SOURCE_ENV $TARGET_ENV + chown ${OWNER}: $TARGET_ENV + chmod 0600 $TARGET_ENV +fi diff --git a/docker_templates/rabbitmq/config-rabbit.sh b/docker_templates/rabbitmq/config-rabbit.sh deleted file mode 120000 index af4be1bf9..000000000 --- a/docker_templates/rabbitmq/config-rabbit.sh +++ /dev/null @@ -1 +0,0 @@ -../../docker/common/rabbitmq/config-rabbit.sh \ No newline at end of file diff --git a/docker_templates/rabbitmq/config-rabbit.sh b/docker_templates/rabbitmq/config-rabbit.sh new file mode 100644 index 000000000..c87a2ab48 --- /dev/null +++ b/docker_templates/rabbitmq/config-rabbit.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +function set_rabbitmq_cookie { + echo "${RABBITMQ_CLUSTER_COOKIE}" > /var/lib/rabbitmq/.erlang.cookie + chown -R rabbitmq: /var/lib/rabbitmq + chmod 400 /var/lib/rabbitmq/.erlang.cookie +} diff --git a/docker_templates/rabbitmq/start.sh b/docker_templates/rabbitmq/start.sh deleted file mode 120000 index 5a3f6c74c..000000000 --- a/docker_templates/rabbitmq/start.sh +++ /dev/null @@ -1 +0,0 @@ -../../docker/common/rabbitmq/start.sh \ No newline at end of file diff --git a/docker_templates/rabbitmq/start.sh b/docker_templates/rabbitmq/start.sh new file mode 100755 index 000000000..749bee963 --- /dev/null +++ b/docker_templates/rabbitmq/start.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -o errexit + +CMD="/usr/sbin/rabbitmq-server" +ARGS="" + +# loading common functions +source /opt/kolla/kolla-common.sh + +# Execute config strategy +set_configs + +# loading functions +source /opt/kolla/config-rabbit.sh + +# This catches all cases of the BOOTSTRAP variable being set, including empty +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + set_rabbitmq_cookie + exit 0 +fi + +$CMD $ARGS -- cgit v1.2.3