Commit Graph

99 Commits

Author SHA1 Message Date
Jean-Sébastien Pedron aa84ddcf36 Define shell explicitly for runuser command
Because the rabbitmq user shell defaults to /bin/false, we must
explicitly define a shell when using the runuser command

Issue: rabbitmq/rabbitmq-server-release#32
PR: rabbitmq/rabbitmq-server-release#40

[#150221349]

Signed-off-by: Gerhard Lazu <gerhard@rabbitmq.com>
2017-08-31 16:56:26 +01:00
Daniil Fedotov ab705f8359 Change runuser arguments to support more platforms 2017-08-22 11:13:47 +01:00
Luke Bakken 402aab2857
Error message change from review. 2017-08-17 06:05:28 -07:00
Luke Bakken c8b6b74a9c
Fixes for SELinux support
Use /sbin/runuser to execute script as the `rabbitmq` user as this command
does not cause issues with SELinux. See #32 for details.
2017-08-16 20:13:30 -07:00
Jean-Sébastien Pédron 7ec9512aa3
Merge branch 'stable' 2017-08-01 18:17:39 +02:00
Jean-Sébastien Pédron ad1984130e
scripts/rabbitmq-script-wrapper: Run rabbitmq-plugin as root only
The previous patch was meant to make it clear that an unprivileged user
(other than `rabbitmq`) shouldn't run rabbitmq-plugins.

Unfortunately, it broke the script when called by root, because the
real script was executed as `rabbitmq`. This user doesn't have write
permissions to `/etc/rabbitmq` by default.

Now, rabbitmq-plugins' wrapper must be executed as root and so is the
real script. This should fix the problem described above.

[#149840153]
2017-08-01 15:35:35 +02:00
Jean-Sébastien Pedron 9de5b86e00 Ensure we are in a readable dir when running RabbitMQ scripts
If the current working directory is not readable, Erlang will crash.
This ensures that we run RabbitMQ scripts from a readable directory.

[#149425921]

Signed-off-by: Gerhard Lazu <gerhard@rabbitmq.com>
2017-07-28 18:32:49 +01:00
Jean-Sébastien Pedron cf7baacd03 Refactor rabbitmq-script-wrapper
The logic is a bit crazy, and the whole purpose of this script is
questionable, but until we get rid of it, we've refactor it to make it
more obvious just how crazy it actually is.

[#149425921]

Signed-off-by: Gerhard Lazu <gerhard@rabbitmq.com>
2017-07-28 17:06:46 +01:00
Gerhard Lazu 0eb3736a63 Merge branch 'stable' 2017-07-28 17:06:01 +01:00
Daniil Fedotov 2c5f833d98 Require root or rabbitmq user for rabbitmq-plugins.
For some reason, the rabbitmq-plugins command could be run
from arbitrary user, which would result in errors unable to
access a cookie file or plugins configuration files.
Changed to work the same way as rabbitmqctl - require root
or rabbitmq user.

[Fixes #149425921]
2017-07-24 17:50:11 +01:00
Mate Lakat 32496d7228
Fix HA OCF script
Some parts of #21 have not been added to the stable branch. This change
fixes the issue by adding missing changes to rabbitmq-server-ha.ocf and
also fixing rabbitmq-server.ocf
2017-05-10 02:48:21 +03:00
Mate Lakat 707bb456b8
Enlist OCF_RESKEY_limit_nofile_default on comment
Minor change to be consistent with the rest of the file.
2017-05-10 02:48:20 +03:00
Mate Lakat 8efde0e212 Fix HA OCF script
Some parts of #21 have not been added to the stable branch. This change
fixes the issue by adding missing changes to rabbitmq-server-ha.ocf and
also fixing rabbitmq-server.ocf
2017-05-09 15:39:29 +02:00
Mate Lakat b675606fa2 Enlist OCF_RESKEY_limit_nofile_default on comment
Minor change to be consistent with the rest of the file.
2017-05-09 14:19:37 +02:00
Mate Lakat 16ca1ccf4e
Re-do #21
For some reason some changes were lost from #21, adding back those.

The original PR message:
This enables to change the limit of open files, as the default on
distributions is usually too low for rabbitmq. Default is 65535.
2017-05-09 13:51:12 +03:00
Mate Lakat 2bd5ea8f40 Re-do #21
For some reason some changes were lost from #21, adding back those.

The original PR message:
This enables to change the limit of open files, as the default on
distributions is usually too low for rabbitmq. Default is 65535.
2017-05-09 12:34:53 +02:00
Mate Lakat 04ddf74032
Log rabbitmqctl's output on failure
It would be helpful to see rabbit's output when it exits with non-zero
status code. The log level is left at info, as it might be business as
usual that a node is not running rabbit. The -q switch prevents the
output from being logged if the return value is zero.
2017-05-03 12:51:05 +02:00
Mate Lakat b43f6aa7db Log rabbitmqctl's output on failure
It would be helpful to see rabbit's output when it exits with non-zero
status code. The log level is left at info, as it might be business as
usual that a node is not running rabbit. The -q switch prevents the
output from being logged if the return value is zero.
2017-05-03 11:46:26 +02:00
Michael Klishin a81cc7f91b
Merge branch 'stable'
Conflicts:
	scripts/rabbitmq-server.ocf
2017-04-05 17:56:25 +03:00
Michael Klishin 054c72d6dd
Manually backport #20, #21, #24, #25 by @vuntz and @aplanas to stable 2017-04-05 17:54:43 +03:00
Alberto Planas d2d5d5e893
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.
2017-04-05 17:50:23 +03:00
Michael Klishin 0da346eb88 Merge pull request #21 from vuntz/ocf-limit_nofile
OCF RA: Add new limit_nofile parameter to both OCF resource agents
2017-04-05 17:49:34 +03:00
Vincent Untz 73080ac783 OCF RA: Only set limit for open files when higher than current value
This allows to set the limit via some other way.
2017-04-04 15:13:52 +02:00
Michael Klishin 91ffc30b66 Merge pull request #24 from vuntz/ocf-vhost
OCF RA: Add vhost parameter to rabbitmq-server-ha.ocf
2017-04-04 16:11:08 +03:00
Vincent Untz 89d65b51aa 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.
2017-04-04 15:08:51 +02:00
Vincent Untz 525eaba13a 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
2017-04-04 14:41:50 +02:00
Vincent Untz 564a54a168
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
2017-03-31 19:29:41 +03:00
Michael Klishin 9fb29aa60b Merge pull request #25 from vuntz/ocf-resource_name
OCF RA: Don't hardcode primitive name in rabbitmq-server-ha.ocf
2017-03-31 19:29:14 +03:00
Vincent Untz 49f4c4b566
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.
2017-03-31 14:28:09 +03:00
Vincent Untz 35bba6f8ad
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.
2017-03-31 14:28:01 +03:00
Vincent Untz 9bd1b0a5f3 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
2017-03-31 13:24:27 +02:00
Vincent Untz 3b9dcfc665 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.
2017-03-31 12:55:06 +02:00
Vincent Untz 6d9a00d544 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.
2017-03-31 12:55:05 +02:00
Alberto Planas 0a93dca147 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.
2017-03-30 16:08:48 +02:00
Daniil Fedotov cd804aeb4a Check for rabbitmqctl using `[ -x ]` and not `which` in autocompletion 2017-01-30 17:54:41 +00:00
Daniil Fedotov 994850fc45 Instruction to complete rabbtimq-plugins and rabbitmq-diagnostics 2017-01-27 13:37:38 +00:00
Daniil Fedotov 7835f4c9c9 Reworked ZSH completion. It's now a function that should explicitely loaded on startup 2017-01-25 12:26:34 +00:00
Daniil Fedotov 6d86d77213 Install separate autocomplete scripts for BASH and ZSH
. /etc/profile can be called from shells incompatible with
    autocomplete script syntax. To avoid that specific BASH and
    ZSH autocomplete scripts are called only if shell version is
    detected.
2017-01-24 17:00:13 +00:00
Daniil Fedotov 2c555fef49 Pass auto-completion arguments as argv, not a single argument 2017-01-24 14:44:45 +00:00
Daniil Fedotov fbe7b90ab3 Make sure completion call has locale var 2017-01-18 15:41:18 +00:00
Daniil Fedotov 31dac38fb7 Install auto-complete script 2017-01-18 15:40:21 +00:00
Bogdan Dobrelya c785c6f298 Add Travis tests for Pacemaker OCF RA cluster
Add a matrix of two test cases:
* Smoke test: just a check if rabbit cluster assembles.
* Jepsen test: allowed to fail, it's main value is to
  verify cluster auto-healing after consequent network
  partitions and to provide numbers for
  duplicated/lost/recovered/unexpected messages as well.
* Pin the cluster installer repo to the 1.2.0.

Backport from master branch

Make the gate always passing if there is no changes found
to the RabbitMQ OCF RA script in the patch under test.

Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
2016-11-25 13:31:39 +01:00
Bogdan Dobrelya c5ba6d0218 Add Travis tests for Pacemaker OCF RA cluster
Add a matrix of two test cases:
* Smoke test: just a check if rabbit cluster assembles.
* Jepsen test: allowed to fail, it's main value is to
  verify cluster auto-healing after consequent network
  partitions and to provide numbers for
  duplicated/lost/recovered/unexpected messages as well.

Make the gate always passing if there is no changes found
to the RabbitMQ OCF RA script in the patch under test.

Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
2016-11-25 12:56:14 +01:00
Jean-Sébastien Pédron e0cedc45c4
Merge branch 'rabbitmq-cli-integration' 2016-11-08 19:10:22 +01:00
Daniil Fedotov f0583e6621 Integrate rabbitmq-cli deps to release build 2016-10-28 17:59:59 +01:00
Dmitry Mescheryakov 67cdbe3067 Correctly return exit code from stop
Panicking and returning non-success on stop often leads to resource
becoming unmanaged on that node.

Before we called get_status to verify that RabbitMQ is dead. But
sometimes it returns error even though RabbitMQ is not running. There
is no reason to call it - we will just verify that there is no beam
process running.

Related fuel bug - https://bugs.launchpad.net/fuel/+bug/1626933
2016-10-17 19:43:46 +03:00
Alexey Lebedeff 1d564c8746 OCF RA: Check partitions on non-master nodes
Partitions reported by `rabbit_node_monitor:partitions/0` are not
commutative (i.e. node1 can report itself as partitioned with node2, but
not vice versa).

Given that we now have strong notion of master in OCF script, we can
check for those fishy situations during master health check, and order
damaged nodes to restart.

Fuel bug: https://bugs.launchpad.net/fuel/+bug/1628487
2016-09-29 16:13:18 +03:00
Jean-Sébastien Pédron e97ca28ac7
scripts: Take package-specific files from rabbitmq-server
[#130659985]
2016-09-21 16:25:24 +02:00
Jean-Sébastien Pédron 14d7902ae6
scripts/rabbitmq-script-wrapper: Moved from rabbitmq-server
[#130659985]
2016-09-21 12:32:15 +02:00