Commit Graph

69 Commits

Author SHA1 Message Date
Jean-Sébastien Pédron 1cf3af5a79
Update copyright (year 2020) 2020-03-10 16:49:26 +01:00
Michele Baldessari 6c33da543b Allow operator to disable iptables client blocking
Currently the resource agent hard-codes iptables calls to block off
client access before the resource becomes master. This was done
historically because many libraries were fairly buggy detecting a
not-yet functional rabbitmq, so they were being helped by getting
a tcp RST packet and they would go on trying their next configured
server.

It makes sense to be able to disable this behaviour because
most libraries by now have gotten better at detecting timeouts when
talking to rabbit and because when you run rabbitmq inside a bundle
(pacemaker term for a container with an OCF resource inside) you
normally do not have access to iptables.

Tested by creating a three-node bundle cluster inside a container:
 Container bundle set: rabbitmq-bundle [cluster.common.tag/rhosp16-openstack-rabbitmq:pcmklatest]
   Replica[0]
      rabbitmq-bundle-podman-0  (ocf:💓podman):        Started controller-0
      rabbitmq-bundle-0 (ocf::pacemaker:remote):        Started controller-0
      rabbitmq  (ocf::rabbitmq:rabbitmq-server-ha):     Master rabbitmq-bundle-0
   Replica[1]
      rabbitmq-bundle-podman-1  (ocf:💓podman):        Started controller-1
      rabbitmq-bundle-1 (ocf::pacemaker:remote):        Started controller-1
      rabbitmq  (ocf::rabbitmq:rabbitmq-server-ha):     Master rabbitmq-bundle-1
   Replica[2]
      rabbitmq-bundle-podman-2  (ocf:💓podman):        Started controller-2
      rabbitmq-bundle-2 (ocf::pacemaker:remote):        Started controller-2
      rabbitmq  (ocf::rabbitmq:rabbitmq-server-ha):     Master rabbitmq-bundle-2

The ocf resource was created inside a bundle with:
pcs resource create rabbitmq ocf:rabbitmq:rabbitmq-server-ha avoid_using_iptables="true" \
  meta notify=true container-attribute-target=host master-max=3 ordered=true \
  op start timeout=200s stop timeout=200s promote timeout=60s bundle rabbitmq-bundle

Signed-off-by: Michele Baldessari <michele@acksyn.org>
2020-01-31 08:26:39 +01:00
Michael Klishin b0f49e1517
(c) bump 2019-12-29 05:50:35 +03:00
Jean-Sébastien Pédron 4b7048205d
packaging: Don't load rabbitmq-env from init scripts
This was used to define `$RABBITMQ_LOG_BASE`, but this variable is no
longer define there.

rabbitmq-env would also load `rabbitmq-env.conf` which could redefine
`$RABBITMQ_LOG_BASE`, but this is a corner case and doesn't fit
packaging well: packages already prepare a location for log files and
will clean this location up on removal.

Now, we set `$RABBITMQ_LOG_BASE` value in those scripts and get rid of
rabbitmq-env load.
2019-12-16 10:37:41 +01:00
Michael Klishin 0a92665404
Merge pull request #99 from spring-operator/polish-urls-apache-license-master
URL Cleanup
2019-03-29 02:56:02 +03:00
Spring Operator 8bcebe2185 URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 1 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
2019-03-21 03:25:18 -05:00
Spring Operator 19b22db1f4 URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# HTTP URLs that Could Not Be Fixed
These URLs were unable to be fixed. Please review them to see if they can be manually resolved.

* http://blog.listincomprehension.com/search/label/procket (200) with 1 occurrences could not be migrated:
   ([https](https://blog.listincomprehension.com/search/label/procket) result ClosedChannelException).
* http://dozzie.jarowit.net/trac/wiki/TOML (200) with 1 occurrences could not be migrated:
   ([https](https://dozzie.jarowit.net/trac/wiki/TOML) result SSLHandshakeException).
* http://dozzie.jarowit.net/trac/wiki/subproc (200) with 1 occurrences could not be migrated:
   ([https](https://dozzie.jarowit.net/trac/wiki/subproc) result SSLHandshakeException).
* http://e2project.org (200) with 1 occurrences could not be migrated:
   ([https](https://e2project.org) result AnnotatedConnectException).
* http://nitrogenproject.com/ (200) with 2 occurrences could not be migrated:
   ([https](https://nitrogenproject.com/) result ConnectTimeoutException).
* http://proper.softlab.ntua.gr (200) with 1 occurrences could not be migrated:
   ([https](https://proper.softlab.ntua.gr) result SSLHandshakeException).
* http://yaws.hyber.org (200) with 1 occurrences could not be migrated:
   ([https](https://yaws.hyber.org) result AnnotatedConnectException).
* http://httpredir.debian.org/debian (302) with 1 occurrences could not be migrated:
   ([https](https://httpredir.debian.org/debian) result AnnotatedConnectException).
* http://choven.ca (503) with 1 occurrences could not be migrated:
   ([https](https://choven.ca) result ConnectTimeoutException).

# Fixed URLs

## Fixed But Review Recommended
These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended.

* http://fixprotocol.org/ (301) with 1 occurrences migrated to:
  https://fixtrading.org ([https](https://fixprotocol.org/) result SSLHandshakeException).
* http://nsis.sourceforge.net/Setting_Environment_Variables (301) with 1 occurrences migrated to:
  https://nsis.sourceforge.io/Setting_Environment_Variables ([https](https://nsis.sourceforge.net/Setting_Environment_Variables) result AnnotatedConnectException).
* http://erldb.org (UnknownHostException) with 1 occurrences migrated to:
  https://erldb.org ([https](https://erldb.org) result UnknownHostException).
* http://www.rabbitmq.com/releases/rabbitmq-server/v (404) with 1 occurrences migrated to:
  https://www.rabbitmq.com/releases/rabbitmq-server/v ([https](https://www.rabbitmq.com/releases/rabbitmq-server/v) result 404).
* http://www.rabbitmq.com/releases/rabbitmq-server/v% (404) with 1 occurrences migrated to:
  https://www.rabbitmq.com/releases/rabbitmq-server/v% ([https](https://www.rabbitmq.com/releases/rabbitmq-server/v%) result 404).

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://cloudi.org/ with 27 occurrences migrated to:
  https://cloudi.org/ ([https](https://cloudi.org/) result 200).
* http://erlware.org/ with 1 occurrences migrated to:
  https://erlware.org/ ([https](https://erlware.org/) result 200).
* http://inaka.github.io/cowboy-trails/ with 1 occurrences migrated to:
  https://inaka.github.io/cowboy-trails/ ([https](https://inaka.github.io/cowboy-trails/) result 200).
* http://ninenines.eu with 6 occurrences migrated to:
  https://ninenines.eu ([https](https://ninenines.eu) result 200).
* http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html with 1 occurrences migrated to:
  https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html ([https](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) result 200).
* http://www.actordb.com/ with 2 occurrences migrated to:
  https://www.actordb.com/ ([https](https://www.actordb.com/) result 200).
* http://www.cs.kent.ac.uk/projects/wrangler/Home.html with 1 occurrences migrated to:
  https://www.cs.kent.ac.uk/projects/wrangler/Home.html ([https](https://www.cs.kent.ac.uk/projects/wrangler/Home.html) result 200).
* http://www.debian.org/doc/debian-policy/ with 2 occurrences migrated to:
  https://www.debian.org/doc/debian-policy/ ([https](https://www.debian.org/doc/debian-policy/) result 200).
* http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ with 1 occurrences migrated to:
  https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ ([https](https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/) result 200).
* http://www.rabbitmq.com/ with 2 occurrences migrated to:
  https://www.rabbitmq.com/ ([https](https://www.rabbitmq.com/) result 200).
* http://www.rabbitmq.com/debian/ with 3 occurrences migrated to:
  https://www.rabbitmq.com/debian/ ([https](https://www.rabbitmq.com/debian/) result 200).
* http://www.rabbitmq.com/monitoring.html with 2 occurrences migrated to:
  https://www.rabbitmq.com/monitoring.html ([https](https://www.rabbitmq.com/monitoring.html) result 200).
* http://www.rebar3.org with 1 occurrences migrated to:
  https://www.rebar3.org ([https](https://www.rebar3.org) result 200).
* http://contributor-covenant.org with 1 occurrences migrated to:
  https://contributor-covenant.org ([https](https://contributor-covenant.org) result 301).
* http://contributor-covenant.org/version/1/3/0/ with 1 occurrences migrated to:
  https://contributor-covenant.org/version/1/3/0/ ([https](https://contributor-covenant.org/version/1/3/0/) result 301).
* http://inaka.github.com/apns4erl with 1 occurrences migrated to:
  https://inaka.github.com/apns4erl ([https](https://inaka.github.com/apns4erl) result 301).
* http://inaka.github.com/edis/ with 1 occurrences migrated to:
  https://inaka.github.com/edis/ ([https](https://inaka.github.com/edis/) result 301).
* http://lasp-lang.org/ with 1 occurrences migrated to:
  https://lasp-lang.org/ ([https](https://lasp-lang.org/) result 301).
* http://saleyn.github.com/erlexec with 1 occurrences migrated to:
  https://saleyn.github.com/erlexec ([https](https://saleyn.github.com/erlexec) result 301).
* http://www.debian-administration.org/articles/286 with 1 occurrences migrated to:
  https://www.debian-administration.org/articles/286 ([https](https://www.debian-administration.org/articles/286) result 301).
* http://www.erlang.org/download.html with 1 occurrences migrated to:
  https://www.erlang.org/download.html ([https](https://www.erlang.org/download.html) result 301).
* http://www.mozilla.org/MPL/ with 5 occurrences migrated to:
  https://www.mozilla.org/MPL/ ([https](https://www.mozilla.org/MPL/) result 301).
* http://zhongwencool.github.io/observer_cli with 1 occurrences migrated to:
  https://zhongwencool.github.io/observer_cli ([https](https://zhongwencool.github.io/observer_cli) result 301).
2019-03-20 03:22:38 -05:00
Michele Baldessari c587ba79eb Use ocf_attribute_target instead of crm_node
Instead of calling crm_node directly it is preferrable to use the
ocf_attribute_target function. This function will return crm_node -n
as usual, except when run inside a bundle (aka container in pcmk
language). Inside a bundle it will return the bundle name or, if the
meta attribute meta_container_attribute_target is set to 'host', it
will return the physical node name where the bundle is running.

Typically when running a rabbitmq cluster inside containers it is
desired to set 'meta_container_attribute_target=host' on the rabbit
cluster resource so that the RA is aware on which host it is running.

Tested both on baremetal (without containers):
 Master/Slave Set: rabbitmq-master [rabbitmq]
     Masters: [ controller-0 controller-1 controller-2 ]

And with bundles as well.

Co-Authored-By: Damien Ciabrini <dciabrin@redhat.com>
2018-11-19 22:06:23 +01:00
Luke Bakken ad99cb2524
Use template in rabbitmq-script-wrapper for RabbitMQ user and group 2018-09-13 11:13:42 -07:00
Luke Bakken 79d5841224
Ensure ~rabbitmq/.erlang.cookie is readable after running a command as root
Fixes #85
2018-09-12 15:26:42 -07:00
Jacek Tomasiak 100f137181 Use sysexists exit codes in OCF agent script
Exit codes from sysexits.h were introduced in rabbitmq CLI with
https://github.com/rabbitmq/rabbitmq-server/pull/412. The OCF
agent for non-clustered setup was not updated and some exit codes
were incorrectly reported as unexpected.
2018-06-11 10:23:08 +02:00
Vincent Untz 056f7ed2ec OCF RA: Do not consider local failures as remote node problems
In is_clustered_with(), commands that we run to check if the node is
clustered with us, or partitioned with us may fail. When they fail, it
actually doesn't tell us anything about the remote node.

Until now, we were considering such failures as hints that the remote
node is not in a sane state with us. But doing so has pretty negative
impact, as it can cause rabbitmq to get restarted on the remote node,
causing quite some disruption.

So instead of doing this, ignore the error (it's still logged).

There was a comment in the code wondering what is the best behavior;
based on experience, I think preferring stability is the slightly more
acceptable poison between the two options.
2017-12-20 10:24:21 +01:00
Vincent Untz ea745e62c4
OCF RA: Fix syntax error
(cherry picked from commit a9b4a4ff97a96e798de51933fc44f61aa6bc88a3)
2017-12-14 07:07:02 +03:00
Michael Klishin 7e93369f0c
Merge pull request #64 from vuntz/ocf-fix-notify-start
OCF RA: Fix various issues with start notification handler
2017-12-12 19:19:39 +03:00
Vincent Untz a6dc3f91b0 OCF RA: Fix logging in start notification handler
The "post-start end" log message was written too early (some things were
still done afterwards), and not in all cases (it was inside a if
statement).
2017-12-08 14:17:38 +01:00
Vincent Untz 2f284bf595 OCF RA: Do not start rabbitmq if notification of start is not about us
Right now, every time we get a start notification, all nodes will ensure
the rabbitmq app is started. This makes little sense, as nodes that are
already active don't need to do that.

On top of that, this had the sideeffect of updating the start time for
each of these nodes, which could result in the master moving to another
node.
2017-12-08 14:15:24 +01:00
Vincent Untz a8e7a62513 OCF RA: Fix test for no node in start notification handler
If there's nothing starting and nothing active, then we do a -z " ",
which doesn't have the same result as -z "". Instead, just test for
emptiness for each set of nodes.
2017-12-08 14:13:59 +01:00
Vincent Untz 62a4f75611 OCF RA: Avoid promoting nodes with same start time as master
It may happen that two nodes have the same start time, and one of these
is the master. When this happens, the node actually gets the same score
as the master and can get promoted. There's no reason to avoid being
stable here, so let's keep the same master in that scenario.
2017-12-08 13:32:45 +01:00
Luke Bakken f410369672
Detect util-linux version of runuser
Alternative is to always use runuser invocation in else clause.

Fixes #44.
[#150221349]
2017-09-20 11:31:59 +02:00
Luke Bakken 617d1603d6
Use runuser in non-su-compatible mode
Remove argument quoting which is not necessary as long as command is
passed to `/sbin/runuser` and `/bin/su` as arguments instead of a
string.

Fixes #44.
[#150221349]
2017-09-20 11:31:59 +02:00
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