aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShrikant Bobade <shrikant_bobade@mentor.com>2017-08-17 19:04:21 +0530
committerBruce Ashfield <bruce.ashfield@windriver.com>2017-08-17 11:55:29 -0400
commita4a08a04d5852502c0ab950778e65306c55d85c5 (patch)
tree55225f3145d685efe25841f22eb8541679a11714
parent173d8ad1ae20df9a68fab6b34794ad44bbe11109 (diff)
downloadmeta-cloud-services-a4a08a04d5852502c0ab950778e65306c55d85c5.tar.gz
meta-cloud-services-a4a08a04d5852502c0ab950778e65306c55d85c5.tar.bz2
meta-cloud-services-a4a08a04d5852502c0ab950778e65306c55d85c5.zip
rabbitmq-server: add systemd support
add systemd support to bring-up out of box rabbitmq-server support. rabbitmq-server-setup: essential setup required by rabbitmq-server rabbitmq-server.service: systemd support service file Signed-off-by: Shrikant Bobade <shrikant_bobade@mentor.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rwxr-xr-xmeta-openstack/recipes-extended/rabbitmq/files/rabbitmq-server-setup26
-rw-r--r--meta-openstack/recipes-extended/rabbitmq/files/rabbitmq-server.service13
-rw-r--r--meta-openstack/recipes-extended/rabbitmq/rabbitmq-server_3.2.4.bb14
3 files changed, 52 insertions, 1 deletions
diff --git a/meta-openstack/recipes-extended/rabbitmq/files/rabbitmq-server-setup b/meta-openstack/recipes-extended/rabbitmq/files/rabbitmq-server-setup
new file mode 100755
index 00000000..343c7757
--- /dev/null
+++ b/meta-openstack/recipes-extended/rabbitmq/files/rabbitmq-server-setup
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# rabbitmq-server-setup RabbitMQ broker setup
+#
+# description: To Enable AMQP server provided by RabbitMQ,
+# this setup required before starting rabbitmq-server.
+#
+##
+
+
+# Ensure that HOME is set, since the erlang cookie file must be written
+# somewhere
+export HOME=/home/root
+
+USER=root
+ROTATE_SUFFIX=
+INIT_LOG_DIR=/var/log/rabbitmq
+
+# setup log dir and files for rabbitmq server
+if [ ! -d ${INIT_LOG_DIR} ]; then
+ mkdir ${INIT_LOG_DIR}
+ chmod 0755 ${INIT_LOG_DIR}
+ chown $USER:$USER ${INIT_LOG_DIR}
+ touch ${INIT_LOG_DIR}/startup_err
+ touch ${INIT_LOG_DIR}/startup_log
+fi
diff --git a/meta-openstack/recipes-extended/rabbitmq/files/rabbitmq-server.service b/meta-openstack/recipes-extended/rabbitmq/files/rabbitmq-server.service
new file mode 100644
index 00000000..414ea50e
--- /dev/null
+++ b/meta-openstack/recipes-extended/rabbitmq/files/rabbitmq-server.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=RabbitMQ Messaging broker/server service
+After=network.target
+
+[Service]
+Type=simple
+User=root
+ExecStartPre=/usr/bin/rabbitmq-server-setup
+ExecStart=/usr/bin/rabbitmq-server
+ExecStop=/usr/bin/rabbitmqctl stop
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openstack/recipes-extended/rabbitmq/rabbitmq-server_3.2.4.bb b/meta-openstack/recipes-extended/rabbitmq/rabbitmq-server_3.2.4.bb
index 101d098f..8e4be5f0 100644
--- a/meta-openstack/recipes-extended/rabbitmq/rabbitmq-server_3.2.4.bb
+++ b/meta-openstack/recipes-extended/rabbitmq/rabbitmq-server_3.2.4.bb
@@ -10,6 +10,8 @@ SRC_URI = "http://www.rabbitmq.com/releases/rabbitmq-server/v${PV}/${PN}-${PV}.t
file://rabbitmq-server \
file://remove-docs.patch \
file://cleanup_install.patch \
+ file://rabbitmq-server.service \
+ file://rabbitmq-server-setup \
"
SRC_URI[md5sum] = "09d1af64c005bc680d6790b90655d021"
@@ -44,9 +46,17 @@ do_install() {
mv ${D}/ebin ${RABBIT_LIB_DIR}/ebin
mv ${D}/include ${RABBIT_LIB_DIR}/include
mv ${D}/plugins ${RABBIT_LIB_DIR}/plugins
+
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/rabbitmq-server.service ${D}${systemd_unitdir}/system
+
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/rabbitmq-server-setup ${D}${bindir}
+ fi
}
-inherit useradd update-rc.d
+inherit useradd update-rc.d systemd
USERADD_PACKAGES = "${PN}"
GROUPADD_PARAM_${PN} = "--system rabbitmq"
@@ -56,6 +66,8 @@ USERADD_PARAM_${PN} = "--system --create-home --home /var/lib/rabbitmq \
INITSCRIPT_NAME = "rabbitmq-server"
INITSCRIPT_PARAMS = "defaults"
+SYSTEMD_SERVICE_${PN} = "rabbitmq-server.service"
+
FILES_${PN} += " ${libdir}/rabbitmq/lib/${PN}-${PV}/* \
${localstatedir}/* \
"