Accepting request 485789 from network:messaging:amqp
1 OBS-URL: https://build.opensuse.org/request/show/485789 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rabbitmq-server?expand=0&rev=30
This commit is contained in:
commit
82ffdb072a
50
pull-request-20.patch
Normal file
50
pull-request-20.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From 6d9a00d54425b299c682af692c9fad413d9f5da4 Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Untz <vuntz@suse.com>
|
||||
Date: Wed, 29 Mar 2017 21:44:32 +0200
|
||||
Subject: [PATCH 1/2] OCF RA: Use rabbitmqctl_action wrapper for stop action
|
||||
|
||||
We want to use the wrapper function to call rabbitmqctl for stop, so
|
||||
that we interpret correctly the exit code.
|
||||
---
|
||||
scripts/rabbitmq-server.ocf | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/rabbitmq-server.ocf b/scripts/rabbitmq-server.ocf
|
||||
index 804e654..284360b 100755
|
||||
--- a/scripts/rabbitmq-server.ocf
|
||||
+++ b/scripts/rabbitmq-server.ocf
|
||||
@@ -299,7 +299,7 @@ rabbit_stop() {
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
- $RABBITMQ_CTL stop ${RABBITMQ_PID_FILE}
|
||||
+ rabbitmqctl_action stop ${RABBITMQ_PID_FILE}
|
||||
rc=$?
|
||||
|
||||
if [ "$rc" != 0 ]; then
|
||||
|
||||
From 3b9dcfc6653e7ae8e7ba9e2e738c9f7df30e5cce Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Untz <vuntz@suse.com>
|
||||
Date: Wed, 29 Mar 2017 21:45:52 +0200
|
||||
Subject: [PATCH 2/2] OCF RA: accept 1 as valid exit code from "rabbitmqctl
|
||||
status"
|
||||
|
||||
It may return 1 if the server is not completely running yet, and we
|
||||
don't want pacemaker to treat that as a complete unexpected error.
|
||||
---
|
||||
scripts/rabbitmq-server.ocf | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/rabbitmq-server.ocf b/scripts/rabbitmq-server.ocf
|
||||
index 284360b..bf8880d 100755
|
||||
--- a/scripts/rabbitmq-server.ocf
|
||||
+++ b/scripts/rabbitmq-server.ocf
|
||||
@@ -256,7 +256,7 @@ rabbitmqctl_action() {
|
||||
ocf_log debug "RabbitMQ server is running normally"
|
||||
return $OCF_SUCCESS
|
||||
;;
|
||||
- 2)
|
||||
+ 1|2)
|
||||
ocf_log debug "RabbitMQ server is not running"
|
||||
return $OCF_NOT_RUNNING
|
||||
;;
|
196
pull-request-21.patch
Normal file
196
pull-request-21.patch
Normal file
@ -0,0 +1,196 @@
|
||||
From 0a93dca147a5efbe7e5d6c6925873d7c99cfc1a7 Mon Sep 17 00:00:00 2001
|
||||
From: Alberto Planas <aplanas@gmail.com>
|
||||
Date: Wed, 29 Mar 2017 22:10:53 +0200
|
||||
Subject: [PATCH 1/3] OCF RA: Add new limit_nofile parameter to rabbitmq-server
|
||||
OCF RA
|
||||
|
||||
This enables to change the limit of open files, as the default on
|
||||
distributions is usually too low for rabbitmq. Default is 65535.
|
||||
---
|
||||
scripts/rabbitmq-server.ocf | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
diff --git a/scripts/rabbitmq-server.ocf b/scripts/rabbitmq-server.ocf
|
||||
index 804e654..7190d65 100755
|
||||
--- a/scripts/rabbitmq-server.ocf
|
||||
+++ b/scripts/rabbitmq-server.ocf
|
||||
@@ -30,6 +30,7 @@
|
||||
## OCF_RESKEY_mnesia_base
|
||||
## OCF_RESKEY_server_start_args
|
||||
## OCF_RESKEY_pid_file
|
||||
+## OCF_RESKEY_limit_nofile
|
||||
|
||||
#######################################################################
|
||||
# Initialization:
|
||||
@@ -44,11 +45,13 @@ OCF_RESKEY_ctl_default="/usr/sbin/rabbitmqctl"
|
||||
OCF_RESKEY_nodename_default="rabbit@localhost"
|
||||
OCF_RESKEY_log_base_default="/var/log/rabbitmq"
|
||||
OCF_RESKEY_pid_file_default="/var/run/rabbitmq/pid"
|
||||
+OCF_RESKEY_limit_nofile_default="65535"
|
||||
: ${OCF_RESKEY_server=${OCF_RESKEY_server_default}}
|
||||
: ${OCF_RESKEY_ctl=${OCF_RESKEY_ctl_default}}
|
||||
: ${OCF_RESKEY_nodename=${OCF_RESKEY_nodename_default}}
|
||||
: ${OCF_RESKEY_log_base=${OCF_RESKEY_log_base_default}}
|
||||
: ${OCF_RESKEY_pid_file=${OCF_RESKEY_pid_file_default}}
|
||||
+: ${OCF_RESKEY_limit_nofile=${OCF_RESKEY_limit_nofile_default}}
|
||||
|
||||
meta_data() {
|
||||
cat <<END
|
||||
@@ -144,6 +147,14 @@ Location of the file in which the pid will be stored
|
||||
<content type="string" default="${OCF_RESKEY_pid_file_default}" />
|
||||
</parameter>
|
||||
|
||||
+<parameter name="limit_nofile" unique="0" required="0">
|
||||
+<longdesc lang="en">
|
||||
+Soft and hard limit for NOFILE
|
||||
+</longdesc>
|
||||
+<shortdesc lang="en">NOFILE limit</shortdesc>
|
||||
+<content type="string" default="${OCF_RESKEY_limit_nofile_default}" />
|
||||
+</parameter>
|
||||
+
|
||||
</parameters>
|
||||
|
||||
<actions>
|
||||
@@ -176,6 +187,7 @@ RABBITMQ_LOG_BASE=$OCF_RESKEY_log_base
|
||||
RABBITMQ_MNESIA_BASE=$OCF_RESKEY_mnesia_base
|
||||
RABBITMQ_SERVER_START_ARGS=$OCF_RESKEY_server_start_args
|
||||
RABBITMQ_PID_FILE=$OCF_RESKEY_pid_file
|
||||
+RABBITMQ_LIMIT_NOFILE=$OCF_RESKEY_limit_nofile
|
||||
[ ! -z $RABBITMQ_NODENAME ] && NODENAME_ARG="-n $RABBITMQ_NODENAME"
|
||||
[ ! -z $RABBITMQ_NODENAME ] && export RABBITMQ_NODENAME
|
||||
|
||||
@@ -204,6 +216,10 @@ export_vars() {
|
||||
[ ! -z $RABBITMQ_PID_FILE ] && ensure_pid_dir && export RABBITMQ_PID_FILE
|
||||
}
|
||||
|
||||
+set_limits() {
|
||||
+ [ ! -z $RABBITMQ_LIMIT_NOFILE ] && ulimit -n $RABBITMQ_LIMIT_NOFILE
|
||||
+}
|
||||
+
|
||||
rabbit_validate_partial() {
|
||||
if [ ! -x $RABBITMQ_SERVER ]; then
|
||||
ocf_log err "rabbitmq-server server $RABBITMQ_SERVER does not exist or is not executable";
|
||||
@@ -276,6 +292,9 @@ rabbit_start() {
|
||||
|
||||
export_vars
|
||||
|
||||
+ # RabbitMQ requires high soft and hard limits for NOFILE
|
||||
+ set_limits
|
||||
+
|
||||
setsid sh -c "$RABBITMQ_SERVER > ${RABBITMQ_LOG_BASE}/startup_log 2> ${RABBITMQ_LOG_BASE}/startup_err" &
|
||||
|
||||
# Wait for the server to come up.
|
||||
|
||||
From 89d65b51aa7232207c29dd3010d669d4b54901f4 Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Untz <vuntz@suse.com>
|
||||
Date: Wed, 29 Mar 2017 22:20:25 +0200
|
||||
Subject: [PATCH 2/3] OCF RA: Add new limit_nofile parameter to
|
||||
rabbitmq-server-ha OCF RA
|
||||
|
||||
This enables to change the limit of open files, as the default on
|
||||
distributions is usually too low for rabbitmq. Default is 65535.
|
||||
---
|
||||
scripts/rabbitmq-server-ha.ocf | 17 +++++++++++++++++
|
||||
1 file changed, 17 insertions(+)
|
||||
|
||||
diff --git a/scripts/rabbitmq-server-ha.ocf b/scripts/rabbitmq-server-ha.ocf
|
||||
index 49f3af7..2d5d660 100755
|
||||
--- a/scripts/rabbitmq-server-ha.ocf
|
||||
+++ b/scripts/rabbitmq-server-ha.ocf
|
||||
@@ -50,6 +50,7 @@ OCF_RESKEY_max_rabbitmqctl_timeouts_default=3
|
||||
OCF_RESKEY_policy_file_default="/usr/local/sbin/set_rabbitmq_policy"
|
||||
OCF_RESKEY_rmq_feature_health_check_default=true
|
||||
OCF_RESKEY_rmq_feature_local_list_queues_default=true
|
||||
+OCF_RESKEY_limit_nofile_default=65535
|
||||
|
||||
: ${HA_LOGTAG="lrmd"}
|
||||
: ${HA_LOGFACILITY="daemon"}
|
||||
@@ -74,6 +75,7 @@ OCF_RESKEY_rmq_feature_local_list_queues_default=true
|
||||
: ${OCF_RESKEY_policy_file=${OCF_RESKEY_policy_file_default}}
|
||||
: ${OCF_RESKEY_rmq_feature_health_check=${OCF_RESKEY_rmq_feature_health_check_default}}
|
||||
: ${OCF_RESKEY_rmq_feature_local_list_queues=${OCF_RESKEY_rmq_feature_local_list_queues_default}}
|
||||
+: ${OCF_RESKEY_limit_nofile=${OCF_RESKEY_limit_nofile_default}}
|
||||
|
||||
#######################################################################
|
||||
|
||||
@@ -332,6 +334,14 @@ stopped/demoted.
|
||||
<content type="boolean" default="${OCF_RESKEY_rmq_feature_local_list_queues_default}" />
|
||||
</parameter>
|
||||
|
||||
+<parameter name="limit_nofile" unique="0" required="0">
|
||||
+<longdesc lang="en">
|
||||
+Soft and hard limit for NOFILE
|
||||
+</longdesc>
|
||||
+<shortdesc lang="en">NOFILE limit</shortdesc>
|
||||
+<content type="string" default="${OCF_RESKEY_limit_nofile_default}" />
|
||||
+</parameter>
|
||||
+
|
||||
$EXTENDED_OCF_PARAMS
|
||||
|
||||
</parameters>
|
||||
@@ -556,6 +566,10 @@ now() {
|
||||
date -u +%s
|
||||
}
|
||||
|
||||
+set_limits() {
|
||||
+ [ ! -z $OCF_RESKEY_limit_nofile ] && ulimit -n $OCF_RESKEY_limit_nofile
|
||||
+}
|
||||
+
|
||||
master_score() {
|
||||
local LH="${LL} master_score():"
|
||||
local score=$1
|
||||
@@ -1166,6 +1180,9 @@ start_beam_process() {
|
||||
|
||||
[ -f /etc/default/rabbitmq-server ] && . /etc/default/rabbitmq-server
|
||||
|
||||
+ # RabbitMQ requires high soft and hard limits for NOFILE
|
||||
+ set_limits
|
||||
+
|
||||
# run beam process
|
||||
command="${OCF_RESKEY_binary} >> \"${OCF_RESKEY_log_dir}/startup_log\" 2>/dev/null"
|
||||
RABBITMQ_NODE_ONLY=1 su rabbitmq -s /bin/sh -c "${command}"&
|
||||
|
||||
From 73080ac78348916635e45c2f62aa7d86c0765b42 Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Untz <vuntz@suse.com>
|
||||
Date: Tue, 4 Apr 2017 15:13:52 +0200
|
||||
Subject: [PATCH 3/3] OCF RA: Only set limit for open files when higher than
|
||||
current value
|
||||
|
||||
This allows to set the limit via some other way.
|
||||
---
|
||||
scripts/rabbitmq-server-ha.ocf | 5 ++++-
|
||||
scripts/rabbitmq-server.ocf | 5 ++++-
|
||||
2 files changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/scripts/rabbitmq-server-ha.ocf b/scripts/rabbitmq-server-ha.ocf
|
||||
index 2d5d660..ea07916 100755
|
||||
--- a/scripts/rabbitmq-server-ha.ocf
|
||||
+++ b/scripts/rabbitmq-server-ha.ocf
|
||||
@@ -567,7 +567,10 @@ now() {
|
||||
}
|
||||
|
||||
set_limits() {
|
||||
- [ ! -z $OCF_RESKEY_limit_nofile ] && ulimit -n $OCF_RESKEY_limit_nofile
|
||||
+ local current_limit=$(su $OCF_RESKEY_username -s /bin/sh -c "ulimit -n")
|
||||
+ if [ ! -z $OCF_RESKEY_limit_nofile -a $OCF_RESKEY_limit_nofile -gt $current_limit ] ; then
|
||||
+ ulimit -n $OCF_RESKEY_limit_nofile
|
||||
+ fi
|
||||
}
|
||||
|
||||
master_score() {
|
||||
diff --git a/scripts/rabbitmq-server.ocf b/scripts/rabbitmq-server.ocf
|
||||
index 7190d65..dbca06f 100755
|
||||
--- a/scripts/rabbitmq-server.ocf
|
||||
+++ b/scripts/rabbitmq-server.ocf
|
||||
@@ -217,7 +217,10 @@ export_vars() {
|
||||
}
|
||||
|
||||
set_limits() {
|
||||
- [ ! -z $RABBITMQ_LIMIT_NOFILE ] && ulimit -n $RABBITMQ_LIMIT_NOFILE
|
||||
+ local current_limit=$(su rabbitmq -s /bin/sh -c "ulimit -n")
|
||||
+ if [ ! -z $RABBITMQ_LIMIT_NOFILE -a $RABBITMQ_LIMIT_NOFILE -gt $current_limit ] ; then
|
||||
+ ulimit -n $RABBITMQ_LIMIT_NOFILE
|
||||
+ fi
|
||||
}
|
||||
|
||||
rabbit_validate_partial() {
|
74
pull-request-24.patch
Normal file
74
pull-request-24.patch
Normal file
@ -0,0 +1,74 @@
|
||||
From 525eaba13a395550b0711751c16732197ff4dc9e Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Untz <vuntz@suse.com>
|
||||
Date: Fri, 31 Mar 2017 13:05:51 +0200
|
||||
Subject: [PATCH] OCF RA: Add default_vhost parameter to rabbitmq-server-ha.ocf
|
||||
|
||||
This enables the cluster to focus on a vhost that is not /, in case the
|
||||
most important vhost is something else.
|
||||
|
||||
For reference, other vhosts may exist in the cluster, but these are not
|
||||
guaranteed to not suffer from any data loss. This patch doesn't address
|
||||
this issue.
|
||||
|
||||
Closes https://github.com/rabbitmq/rabbitmq-server-release/issues/22
|
||||
---
|
||||
scripts/rabbitmq-server-ha.ocf | 18 ++++++++++++++++--
|
||||
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/scripts/rabbitmq-server-ha.ocf b/scripts/rabbitmq-server-ha.ocf
|
||||
index 49f3af7..c5c2ebf 100755
|
||||
--- a/scripts/rabbitmq-server-ha.ocf
|
||||
+++ b/scripts/rabbitmq-server-ha.ocf
|
||||
@@ -42,6 +42,7 @@ OCF_RESKEY_mnesia_base_default="/var/lib/rabbitmq/mnesia"
|
||||
OCF_RESKEY_mnesia_schema_base_default="/var/lib/rabbitmq"
|
||||
OCF_RESKEY_host_ip_default="127.0.0.1"
|
||||
OCF_RESKEY_node_port_default=5672
|
||||
+OCF_RESKEY_default_vhost_default="/"
|
||||
OCF_RESKEY_erlang_cookie_default=false
|
||||
OCF_RESKEY_erlang_cookie_file_default="/var/lib/rabbitmq/.erlang.cookie"
|
||||
OCF_RESKEY_use_fqdn_default=false
|
||||
@@ -67,6 +68,7 @@ OCF_RESKEY_rmq_feature_local_list_queues_default=true
|
||||
: ${OCF_RESKEY_mnesia_schema_base=${OCF_RESKEY_mnesia_schema_base_default}}
|
||||
: ${OCF_RESKEY_pid_file=${OCF_RESKEY_pid_file_default}}
|
||||
: ${OCF_RESKEY_node_port=${OCF_RESKEY_node_port_default}}
|
||||
+: ${OCF_RESKEY_default_vhost=${OCF_RESKEY_default_vhost_default}}
|
||||
: ${OCF_RESKEY_erlang_cookie=${OCF_RESKEY_erlang_cookie_default}}
|
||||
: ${OCF_RESKEY_erlang_cookie_file=${OCF_RESKEY_erlang_cookie_file_default}}
|
||||
: ${OCF_RESKEY_use_fqdn=${OCF_RESKEY_use_fqdn_default}}
|
||||
@@ -262,6 +264,18 @@ ${OCF_RESKEY_binary} should listen on this port
|
||||
<content type="boolean" default="${OCF_RESKEY_node_port_default}" />
|
||||
</parameter>
|
||||
|
||||
+<parameter name="default_vhost" unique="0" required="0">
|
||||
+<longdesc lang="en">
|
||||
+Default virtual host used for monitoring if a node is fully synchronized with
|
||||
+the rest of the cluster. In normal operation, the resource agent will wait for
|
||||
+queues from this virtual host on this node to be synchronized elsewhere before
|
||||
+stopping RabbitMQ. This also means queues in other virtual hosts may not be
|
||||
+fully synchronized on stop operations.
|
||||
+</longdesc>
|
||||
+<shortdesc lang="en">Default virtual host used for waiting for synchronization</shortdesc>
|
||||
+<content type="string" default="${OCF_RESKEY_default_vhost_default}" />
|
||||
+</parameter>
|
||||
+
|
||||
<parameter name="erlang_cookie" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Erlang cookie for clustering. If specified, will be updated at the mnesia reset
|
||||
@@ -1491,7 +1505,7 @@ wait_sync() {
|
||||
opt_arg="--local"
|
||||
fi
|
||||
|
||||
- queues="${COMMAND_TIMEOUT} ${OCF_RESKEY_ctl} list_queues $opt_arg name state"
|
||||
+ queues="${COMMAND_TIMEOUT} ${OCF_RESKEY_ctl} -p ${OCF_RESKEY_default_vhost} list_queues $opt_arg name state"
|
||||
|
||||
su_rabbit_cmd -t "${wait_time}" "sh -c \"while ${queues} | grep -q 'syncing,'; \
|
||||
do sleep 2; done\""
|
||||
@@ -1793,7 +1807,7 @@ node_health_check_legacy() {
|
||||
local queues
|
||||
local rc_queues
|
||||
local timeout_queues
|
||||
- queues=`su_rabbit_cmd "${OCF_RESKEY_ctl} -q list_queues memory messages consumer_utilisation"`
|
||||
+ queues=`su_rabbit_cmd "${OCF_RESKEY_ctl} -q -p ${OCF_RESKEY_default_vhost} list_queues memory messages consumer_utilisation"`
|
||||
rc_queues=$?
|
||||
check_timeouts $rc_queues "rabbit_list_queues_timeouts" "list_queues"
|
||||
timeout_queues=$?
|
36
pull-request-25.patch
Normal file
36
pull-request-25.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From 9bd1b0a5f3e421823aaf7ef243ebe9c5d30b7855 Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Untz <vuntz@suse.com>
|
||||
Date: Fri, 31 Mar 2017 13:23:00 +0200
|
||||
Subject: [PATCH] OCF RA: Don't hardcode primitive name in
|
||||
rabbitmq-server-ha.ocf
|
||||
|
||||
We can compute the name of the primitive automatically from environment
|
||||
variables, instead of hard-coding p_rabbitmq-server; this makes the
|
||||
resource agent more flexible.
|
||||
|
||||
Closes https://github.com/rabbitmq/rabbitmq-server-release/issues/23
|
||||
---
|
||||
scripts/rabbitmq-server-ha.ocf | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/rabbitmq-server-ha.ocf b/scripts/rabbitmq-server-ha.ocf
|
||||
index 49f3af7..81fe19b 100755
|
||||
--- a/scripts/rabbitmq-server-ha.ocf
|
||||
+++ b/scripts/rabbitmq-server-ha.ocf
|
||||
@@ -89,6 +89,7 @@ OCF_RESKEY_command_timeout_default=""
|
||||
: ${OCF_RESKEY_command_timeout=${OCF_RESKEY_command_timeout_default}}
|
||||
TIMEOUT_ARG=$((OCF_RESKEY_CRM_meta_timeout / 6000 + 30))
|
||||
COMMAND_TIMEOUT="/usr/bin/timeout ${OCF_RESKEY_command_timeout} ${TIMEOUT_ARG}"
|
||||
+RESOURCE_NAME=`echo $OCF_RESOURCE_INSTANCE | cut -d ":" -f 1`
|
||||
|
||||
#######################################################################
|
||||
|
||||
@@ -654,7 +655,7 @@ get_node_start_time() {
|
||||
}
|
||||
|
||||
get_node_master_score() {
|
||||
- get_integer_node_attr $1 'master-p_rabbitmq-server'
|
||||
+ get_integer_node_attr $1 "master-${RESOURCE_NAME}"
|
||||
}
|
||||
|
||||
# Return either rabbit node name as FQDN or shortname, depends on the OCF_RESKEY_use_fqdn.
|
15
rabbitmq-env.conf
Normal file
15
rabbitmq-env.conf
Normal file
@ -0,0 +1,15 @@
|
||||
# See man rabbitmq-env.conf(5) for documentation
|
||||
|
||||
# Defaults to rabbit. This can be useful if you want to run more than one node
|
||||
# per machine - RABBITMQ_NODENAME should be unique per erlang-node-and-machine
|
||||
# combination. See the clustering on a single machine guide for details:
|
||||
# http://www.rabbitmq.com/clustering.html#single-machine
|
||||
#NODENAME=rabbit
|
||||
|
||||
# By default RabbitMQ will bind to all interfaces, on IPv4 and IPv6 if
|
||||
# available. Set this if you only want to bind to one network interface or#
|
||||
# address family.
|
||||
#NODE_IP_ADDRESS=127.0.0.1
|
||||
|
||||
# Defaults to 5672.
|
||||
#NODE_PORT=5672
|
@ -1,3 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 5 08:16:09 UTC 2017 - vuntz@suse.com
|
||||
|
||||
- Stop shipping rabbitmq-server OCF resource agent as source file
|
||||
while it's included in the upstream tarball. Add patches for code
|
||||
that was specific to our variant; they now got upstreamed, but
|
||||
are not in this version of rabbitmq yet: pull-request-20.patch
|
||||
and pull-request-21.patch.
|
||||
- Also package the rabbitmq-server-ha OCF resource agent as it
|
||||
seems to be more appropriate for clustering. Add upstream fixes
|
||||
for making it more solid: pull-request-24.patch and
|
||||
pull-request-25.patch.
|
||||
- Ship an example of /etc/rabbitmq/rabbitmq-env.conf, as this is
|
||||
useful indication. It only contains commented examples, based on
|
||||
what the Debian package is doing.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 15 13:09:26 UTC 2017 - mrueckert@suse.de
|
||||
|
||||
|
@ -1,390 +0,0 @@
|
||||
#!/bin/sh
|
||||
## The contents of this file are subject to the Mozilla Public License
|
||||
## Version 1.1 (the "License"); you may not use this file except in
|
||||
## compliance with the License. You may obtain a copy of the License
|
||||
## at http://www.mozilla.org/MPL/
|
||||
##
|
||||
## Software distributed under the License is distributed on an "AS IS"
|
||||
## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
## the License for the specific language governing rights and
|
||||
## limitations under the License.
|
||||
##
|
||||
## The Original Code is RabbitMQ.
|
||||
##
|
||||
## The Initial Developer of the Original Code is VMware, Inc.
|
||||
## Copyright (c) 2007-2012 VMware, Inc. All rights reserved.
|
||||
##
|
||||
|
||||
##
|
||||
## OCF Resource Agent compliant rabbitmq-server resource script.
|
||||
##
|
||||
|
||||
## OCF instance parameters
|
||||
## OCF_RESKEY_server
|
||||
## OCF_RESKEY_ctl
|
||||
## OCF_RESKEY_nodename
|
||||
## OCF_RESKEY_ip
|
||||
## OCF_RESKEY_port
|
||||
## OCF_RESKEY_config_file
|
||||
## OCF_RESKEY_log_base
|
||||
## OCF_RESKEY_mnesia_base
|
||||
## OCF_RESKEY_server_start_args
|
||||
## OCF_RESKEY_pid_file
|
||||
## OCF_RESKEY_limit_nofile
|
||||
|
||||
#######################################################################
|
||||
# Initialization:
|
||||
|
||||
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/resource.d/heartbeat}
|
||||
. ${OCF_FUNCTIONS_DIR}/.ocf-shellfuncs
|
||||
|
||||
#######################################################################
|
||||
|
||||
OCF_RESKEY_server_default="/usr/sbin/rabbitmq-server"
|
||||
OCF_RESKEY_ctl_default="/usr/sbin/rabbitmqctl"
|
||||
OCF_RESKEY_nodename_default="rabbit@localhost"
|
||||
OCF_RESKEY_log_base_default="/var/log/rabbitmq"
|
||||
OCF_RESKEY_pid_file_default="/var/run/rabbitmq/pid"
|
||||
OCF_RESKEY_limit_nofile_default="65535"
|
||||
: ${OCF_RESKEY_server=${OCF_RESKEY_server_default}}
|
||||
: ${OCF_RESKEY_ctl=${OCF_RESKEY_ctl_default}}
|
||||
: ${OCF_RESKEY_nodename=${OCF_RESKEY_nodename_default}}
|
||||
: ${OCF_RESKEY_log_base=${OCF_RESKEY_log_base_default}}
|
||||
: ${OCF_RESKEY_pid_file=${OCF_RESKEY_pid_file_default}}
|
||||
: ${OCF_RESKEY_limit_nofile=${OCF_RESKEY_limit_nofile_default}}
|
||||
|
||||
meta_data() {
|
||||
cat <<END
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
|
||||
<resource-agent name="rabbitmq-server">
|
||||
<version>1.0</version>
|
||||
|
||||
<longdesc lang="en">
|
||||
Resource agent for RabbitMQ-server
|
||||
</longdesc>
|
||||
|
||||
<shortdesc lang="en">Resource agent for RabbitMQ-server</shortdesc>
|
||||
|
||||
<parameters>
|
||||
<parameter name="server" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
The path to the rabbitmq-server script
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Path to rabbitmq-server</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_server_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="ctl" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
The path to the rabbitmqctl script
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Path to rabbitmqctl</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_ctl_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="nodename" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
The node name for rabbitmq-server
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Node name</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_nodename_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="ip" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
The IP address for rabbitmq-server to listen on
|
||||
</longdesc>
|
||||
<shortdesc lang="en">IP Address</shortdesc>
|
||||
<content type="string" default="" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="port" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
The IP Port for rabbitmq-server to listen on
|
||||
</longdesc>
|
||||
<shortdesc lang="en">IP Port</shortdesc>
|
||||
<content type="integer" default="" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="config_file" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Location of the config file (without the .config suffix)
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Config file path (without the .config suffix)</shortdesc>
|
||||
<content type="string" default="" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="log_base" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Location of the directory under which logs will be created
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Log base path</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_log_base_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="mnesia_base" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Location of the directory under which mnesia will store data
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Mnesia base path</shortdesc>
|
||||
<content type="string" default="" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="server_start_args" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Additional arguments provided to the server on startup
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Server start arguments</shortdesc>
|
||||
<content type="string" default="" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="pid_file" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Location of the file in which the pid will be stored
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Pid file path</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_pid_file_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="limit_nofile" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Soft and hard limit for NOFILE
|
||||
</longdesc>
|
||||
<shortdesc lang="en">NOFILE limit</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_limit_nofile}" />
|
||||
</parameter>
|
||||
|
||||
</parameters>
|
||||
|
||||
<actions>
|
||||
<action name="start" timeout="600" />
|
||||
<action name="stop" timeout="120" />
|
||||
<action name="status" timeout="20" interval="10" />
|
||||
<action name="monitor" timeout="20" interval="10" />
|
||||
<action name="validate-all" timeout="30" />
|
||||
<action name="meta-data" timeout="5" />
|
||||
</actions>
|
||||
</resource-agent>
|
||||
END
|
||||
}
|
||||
|
||||
rabbit_usage() {
|
||||
cat <<END
|
||||
usage: $0 {start|stop|status|monitor|validate-all|meta-data}
|
||||
|
||||
Expects to have a fully populated OCF RA-compliant environment set.
|
||||
END
|
||||
}
|
||||
|
||||
RABBITMQ_SERVER=$OCF_RESKEY_server
|
||||
RABBITMQ_CTL=$OCF_RESKEY_ctl
|
||||
RABBITMQ_NODENAME=$OCF_RESKEY_nodename
|
||||
RABBITMQ_NODE_IP_ADDRESS=$OCF_RESKEY_ip
|
||||
RABBITMQ_NODE_PORT=$OCF_RESKEY_port
|
||||
RABBITMQ_CONFIG_FILE=$OCF_RESKEY_config_file
|
||||
RABBITMQ_LOG_BASE=$OCF_RESKEY_log_base
|
||||
RABBITMQ_MNESIA_BASE=$OCF_RESKEY_mnesia_base
|
||||
RABBITMQ_SERVER_START_ARGS=$OCF_RESKEY_server_start_args
|
||||
RABBITMQ_PID_FILE=$OCF_RESKEY_pid_file
|
||||
RABBITMQ_LIMIT_NOFILE=$OCF_RESKEY_limit_nofile
|
||||
[ ! -z $RABBITMQ_NODENAME ] && NODENAME_ARG="-n $RABBITMQ_NODENAME"
|
||||
[ ! -z $RABBITMQ_NODENAME ] && export RABBITMQ_NODENAME
|
||||
|
||||
ensure_pid_dir () {
|
||||
PID_DIR=`dirname ${RABBITMQ_PID_FILE}`
|
||||
if [ ! -d ${PID_DIR} ] ; then
|
||||
mkdir -p ${PID_DIR}
|
||||
chown -R rabbitmq:rabbitmq ${PID_DIR}
|
||||
chmod 755 ${PID_DIR}
|
||||
fi
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
remove_pid () {
|
||||
rm -f ${RABBITMQ_PID_FILE}
|
||||
rmdir `dirname ${RABBITMQ_PID_FILE}` || :
|
||||
}
|
||||
|
||||
export_vars() {
|
||||
[ ! -z $RABBITMQ_NODE_IP_ADDRESS ] && export RABBITMQ_NODE_IP_ADDRESS
|
||||
[ ! -z $RABBITMQ_NODE_PORT ] && export RABBITMQ_NODE_PORT
|
||||
[ ! -z $RABBITMQ_CONFIG_FILE ] && export RABBITMQ_CONFIG_FILE
|
||||
[ ! -z $RABBITMQ_LOG_BASE ] && export RABBITMQ_LOG_BASE
|
||||
[ ! -z $RABBITMQ_MNESIA_BASE ] && export RABBITMQ_MNESIA_BASE
|
||||
[ ! -z $RABBITMQ_SERVER_START_ARGS ] && export RABBITMQ_SERVER_START_ARGS
|
||||
[ ! -z $RABBITMQ_PID_FILE ] && ensure_pid_dir && export RABBITMQ_PID_FILE
|
||||
}
|
||||
|
||||
set_limits() {
|
||||
[ ! -z $RABBITMQ_LIMIT_NOFILE ] && ulimit -n $RABBITMQ_LIMIT_NOFILE
|
||||
}
|
||||
|
||||
rabbit_validate_partial() {
|
||||
if [ ! -x $RABBITMQ_SERVER ]; then
|
||||
ocf_log err "rabbitmq-server server $RABBITMQ_SERVER does not exist or is not executable";
|
||||
exit $OCF_ERR_INSTALLED;
|
||||
fi
|
||||
|
||||
if [ ! -x $RABBITMQ_CTL ]; then
|
||||
ocf_log err "rabbitmq-server ctl $RABBITMQ_CTL does not exist or is not executable";
|
||||
exit $OCF_ERR_INSTALLED;
|
||||
fi
|
||||
}
|
||||
|
||||
rabbit_validate_full() {
|
||||
if [ ! -z $RABBITMQ_CONFIG_FILE ] && [ ! -e "${RABBITMQ_CONFIG_FILE}.config" ]; then
|
||||
ocf_log err "rabbitmq-server config_file ${RABBITMQ_CONFIG_FILE}.config does not exist or is not a file";
|
||||
exit $OCF_ERR_INSTALLED;
|
||||
fi
|
||||
|
||||
if [ ! -z $RABBITMQ_LOG_BASE ] && [ ! -d $RABBITMQ_LOG_BASE ]; then
|
||||
ocf_log err "rabbitmq-server log_base $RABBITMQ_LOG_BASE does not exist or is not a directory";
|
||||
exit $OCF_ERR_INSTALLED;
|
||||
fi
|
||||
|
||||
if [ ! -z $RABBITMQ_MNESIA_BASE ] && [ ! -d $RABBITMQ_MNESIA_BASE ]; then
|
||||
ocf_log err "rabbitmq-server mnesia_base $RABBITMQ_MNESIA_BASE does not exist or is not a directory";
|
||||
exit $OCF_ERR_INSTALLED;
|
||||
fi
|
||||
|
||||
rabbit_validate_partial
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
rabbit_status() {
|
||||
rabbitmqctl_action "status"
|
||||
}
|
||||
|
||||
rabbit_wait() {
|
||||
rabbitmqctl_action "wait" $1
|
||||
}
|
||||
|
||||
rabbitmqctl_action() {
|
||||
local rc
|
||||
local action
|
||||
action=$@
|
||||
$RABBITMQ_CTL $NODENAME_ARG $action > /dev/null 2> /dev/null
|
||||
rc=$?
|
||||
case "$rc" in
|
||||
0)
|
||||
ocf_log debug "RabbitMQ server is running normally"
|
||||
return $OCF_SUCCESS
|
||||
;;
|
||||
1|2)
|
||||
ocf_log debug "RabbitMQ server is not running"
|
||||
return $OCF_NOT_RUNNING
|
||||
;;
|
||||
*)
|
||||
ocf_log err "Unexpected return from rabbitmqctl $NODENAME_ARG $action: $rc"
|
||||
exit $OCF_ERR_GENERIC
|
||||
esac
|
||||
}
|
||||
|
||||
rabbit_start() {
|
||||
local rc
|
||||
|
||||
if rabbit_status; then
|
||||
ocf_log info "Resource already running."
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
export_vars
|
||||
|
||||
# RabbitMQ requires high soft and hard limits for NOFILE
|
||||
set_limits
|
||||
|
||||
setsid sh -c "$RABBITMQ_SERVER > ${RABBITMQ_LOG_BASE}/startup_log 2> ${RABBITMQ_LOG_BASE}/startup_err" &
|
||||
|
||||
# Wait for the server to come up.
|
||||
# Let the CRM/LRM time us out if required
|
||||
rabbit_wait $RABBITMQ_PID_FILE
|
||||
rc=$?
|
||||
if [ "$rc" != $OCF_SUCCESS ]; then
|
||||
remove_pid
|
||||
ocf_log info "rabbitmq-server start failed: $rc"
|
||||
exit $OCF_ERR_GENERIC
|
||||
fi
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
rabbit_stop() {
|
||||
local rc
|
||||
|
||||
if ! rabbit_status; then
|
||||
ocf_log info "Resource not running."
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
rabbitmqctl_action stop
|
||||
rc=$?
|
||||
|
||||
if [ "$rc" != 0 ]; then
|
||||
ocf_log err "rabbitmq-server stop command failed: $RABBITMQ_CTL stop, $rc"
|
||||
return $rc
|
||||
fi
|
||||
|
||||
# Spin waiting for the server to shut down.
|
||||
# Let the CRM/LRM time us out if required
|
||||
stop_wait=1
|
||||
while [ $stop_wait = 1 ]; do
|
||||
rabbit_status
|
||||
rc=$?
|
||||
if [ "$rc" = $OCF_NOT_RUNNING ]; then
|
||||
remove_pid
|
||||
stop_wait=0
|
||||
break
|
||||
elif [ "$rc" != $OCF_SUCCESS ]; then
|
||||
ocf_log info "rabbitmq-server stop failed: $rc"
|
||||
exit $OCF_ERR_GENERIC
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
rabbit_monitor() {
|
||||
rabbit_status
|
||||
return $?
|
||||
}
|
||||
|
||||
case $__OCF_ACTION in
|
||||
meta-data)
|
||||
meta_data
|
||||
exit $OCF_SUCCESS
|
||||
;;
|
||||
usage|help)
|
||||
rabbit_usage
|
||||
exit $OCF_SUCCESS
|
||||
;;
|
||||
esac
|
||||
|
||||
if ocf_is_probe; then
|
||||
rabbit_validate_partial
|
||||
else
|
||||
rabbit_validate_full
|
||||
fi
|
||||
|
||||
case $__OCF_ACTION in
|
||||
start)
|
||||
rabbit_start
|
||||
;;
|
||||
stop)
|
||||
rabbit_stop
|
||||
;;
|
||||
status|monitor)
|
||||
rabbit_monitor
|
||||
;;
|
||||
validate-all)
|
||||
exit $OCF_SUCCESS
|
||||
;;
|
||||
*)
|
||||
rabbit_usage
|
||||
exit $OCF_ERR_UNIMPLEMENTED
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $?
|
@ -15,6 +15,7 @@
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%bcond_without split_plugins
|
||||
|
||||
%define _rabbit_erllibdir %{_libdir}/rabbitmq/lib/rabbitmq_server-%{version}
|
||||
@ -38,12 +39,20 @@ Source1: rabbitmq-server.init
|
||||
# This comes from: http://hg.rabbitmq.com/rabbitmq-server/raw-file/2da625c0a436/packaging/common/rabbitmq-script-wrapper
|
||||
Source2: rabbitmq-script-wrapper
|
||||
Source3: rabbitmq-server.logrotate
|
||||
Source4: rabbitmq-server.ocf
|
||||
Source4: rabbitmq-env.conf
|
||||
Source5: rabbitmq-server.sysconfig
|
||||
Source6: rabbitmq-server.service
|
||||
Source7: rabbitmq-server.tmpfiles.d.conf
|
||||
Source8: README.SUSE
|
||||
Source9: rabbitmq.config.example
|
||||
# PATCH-FIX-UPSTREAM pull-request-20.patch https://github.com/rabbitmq/rabbitmq-server-release/pull/20 -- minor fixes to rabbitmq-server.ocf
|
||||
Patch0: pull-request-20.patch
|
||||
# PATCH-FIX-UPSTREAM pull-request-21.patch https://github.com/rabbitmq/rabbitmq-server-release/pull/21 -- ulimit improvements for ocf files
|
||||
Patch1: pull-request-21.patch
|
||||
# PATCH-FIX-UPSTREAM pull-request-24.patch https://github.com/rabbitmq/rabbitmq-server-release/pull/24 -- allow specifying vhost to use in rabbitmq-server-ha.ocf
|
||||
Patch2: pull-request-24.patch
|
||||
# PATCH-FIX-UPSTREAM pull-request-25.patch https://github.com/rabbitmq/rabbitmq-server-release/pull/25 -- fix rabbitmq-server-ha.ocf to not hardcode resource name
|
||||
Patch3: pull-request-25.patch
|
||||
BuildRequires: erlang
|
||||
BuildRequires: erlang-src
|
||||
BuildRequires: fdupes
|
||||
@ -108,10 +117,11 @@ This package includes the RabbitMQ AMQP language bindings for Erlang.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%define _rabbit_server_ocf `basename %{SOURCE4}`
|
||||
cp %{SOURCE4} %{_rabbit_server_ocf}
|
||||
cp %{SOURCE8} .
|
||||
#patch10 -p1
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
|
||||
%build
|
||||
make all %{_make_args} %{?_smp_mflags}
|
||||
@ -140,10 +150,12 @@ sed -i 's|@RABBITMQ_ROOT@|%{_rabbit_erllibdir}/|' %{_rabbit_wrapper}
|
||||
install -p -D -m 0755 %{_rabbit_wrapper} %{buildroot}%{_sbindir}/rabbitmqctl
|
||||
install -p -D -m 0755 %{_rabbit_wrapper} %{buildroot}%{_sbindir}/rabbitmq-server
|
||||
install -p -D -m 0755 %{_rabbit_wrapper} %{buildroot}%{_sbindir}/rabbitmq-plugins
|
||||
install -p -D -m 0755 %{_rabbit_server_ocf} %{buildroot}%{_exec_prefix}/lib/ocf/resource.d/rabbitmq/rabbitmq-server
|
||||
install -p -D -m 0755 scripts/rabbitmq-server.ocf %{buildroot}%{_exec_prefix}/lib/ocf/resource.d/rabbitmq/rabbitmq-server
|
||||
install -p -D -m 0755 scripts/rabbitmq-server-ha.ocf %{buildroot}%{_exec_prefix}/lib/ocf/resource.d/rabbitmq/rabbitmq-server-ha
|
||||
|
||||
# install config files
|
||||
install -p -D -m 0644 %{SOURCE9} %{buildroot}/%{_sysconfdir}/rabbitmq/rabbitmq.config
|
||||
install -p -D -m 0644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/rabbitmq/rabbitmq-env.conf
|
||||
|
||||
# Copy all necessary lib files etc.
|
||||
install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/rabbitmq-server
|
||||
|
Loading…
Reference in New Issue
Block a user