Commit Graph

2199 Commits

Author SHA1 Message Date
Jean-Sébastien Pédron d65637190a
rabbit_nodes: Add list functions to clarify which nodes we are interested in
So far, we had the following functions to list nodes in a RabbitMQ
cluster:
* `rabbit_mnesia:cluster_nodes/1` to get members of the Mnesia cluster;
  the argument was used to select members (all members or only those
  running Mnesia and participating in the cluster)
* `rabbit_nodes:all/0` to get all members of the Mnesia cluster
* `rabbit_nodes:all_running/0` to get all members who currently run
  Mnesia

Basically:
* `rabbit_nodes:all/0` calls `rabbit_mnesia:cluster_nodes(all)`
* `rabbit_nodes:all_running/0` calls `rabbit_mnesia:cluster_nodes(running)`

We also have:
* `rabbit_node_monitor:alive_nodes/1` which filters the given list of
  nodes to only select those currently running Mnesia
* `rabbit_node_monitor:alive_rabbit_nodes/1` which filters the given
  list of nodes to only select those currently running RabbitMQ

Most of the code uses `rabbit_mnesia:cluster_nodes/1` or the
`rabbit_nodes:all*/0` functions. `rabbit_mnesia:cluster_nodes(running)`
or `rabbit_nodes:all_running/0` is often used as a close approximation
of "all cluster members running RabbitMQ". This list might be incorrect
in times where a node is joining the clustered or is being worked on
(i.e. Mnesia is running but not RabbitMQ).

With Khepri, there won't be the same possible approximation because we
will try to keep Khepri/Ra running even if RabbitMQ is stopped to
expand/shrink the cluster.

So in order to clarify what we want when we query a list of nodes, this
patch introduces the following functions:
* `rabbit_nodes:list_members/0` to get all cluster members, regardless
  of their state
* `rabbit_nodes:list_reachable/0` to get all cluster members we can
  reach using Erlang distribution, regardless of the state of RabbitMQ
* `rabbit_nodes:list_running/0` to get all cluster members who run
  RabbitMQ, regardless of the maintenance state
* `rabbit_nodes:list_serving/0` to get all cluster members who run
  RabbitMQ and are accepting clients

In addition to the list functions, there are the corresponding
`rabbit_nodes:is_*(Node)` checks and `rabbit_nodes:filter_*(Nodes)`
filtering functions.

The code is modified to use these new functions. One possible
significant change is that the new list functions will perform RPC calls
to query the nodes' state, unlike `rabbit_mnesia:cluster_nodes(running)`.
2023-02-13 12:58:40 +01:00
Michael Klishin 7b5e8a9955
ctl add_vhost: minor improvements to help output 2023-02-09 15:12:51 -05:00
Jean-Sébastien Pédron 78e8c595b1
set_permissions_globally_command_test: Fix "invalid_regex patterns" test expectations
Testcases are executed in a random order. Unfortunately, this testcase
depended on side effects of other testcases. If this testcase was
executed first, then there were no permissions set and the testcase
would fail.

It now lists permissions before and after the actual test and compare
both.
2023-02-08 10:21:10 +01:00
Jean-Sébastien Pédron 271a7babdf
set_permissions_globally_command_test: Always set @user
Otherwise the command causes a `function_clause` exception in the broker
because a `nil` atom is passed as the username instead of a binary.
2023-02-08 10:18:24 +01:00
Michael Klishin 69add44ce3
CLI: mix format 2023-02-06 15:54:09 -05:00
Michael Klishin ab99ccfa45
Introduce a CLI command that grants permissions to all virtual hosts
Closes #1000
2023-02-06 13:07:09 -05:00
Rin Kuryloski 0ac62a4a3b Forward-port dialyzer related rabbitmq_cli fixes from #7122 2023-02-01 23:21:10 +01:00
Michael Klishin 6fd7b983d8
Merge pull request #7135 from rabbitmq/mk-report-total-core-count-cluster-status
List CPU core count in 'rabbitmq-diagnostics cluster_status'
2023-02-01 06:45:41 -05:00
Michael Klishin 1f902fd016
mix format 2023-01-31 20:57:11 -05:00
Michael Klishin cee705b99f
List CPU core count in 'rabbitmq-diagnostics cluster_status'
Both to simplify troubleshooting in some cases and to make it
easier to spot licensing irregularities.
2023-01-31 20:37:44 -05:00
Michael Klishin 2cf2133a44
Fix one more issue reported by CLI tools Dialyzer
(cherry picked from commit 5d8ba2f32a)
2023-01-31 17:47:24 -05:00
Rin Kuryloski bdb2046185
Add rabbitmq_cli dialyze to bazel (#7066)
* Add rabbitmq_cli dialyze to bazel

and fix a number of warnings

Because we stop mix from recompiling rabbit_common in bazel, many
unknown functions are reported, so this dialyzer analysis is somewhat
incomplete.

* Use erlang dialyzer for rabbitmq_cli rather than mix dialyzer

Since this resolves all of the rabbit functions, there are far fewer
unknown functions.

Requires yet to be released rules_erlang 3.9.2

* Temporarily use pre-release rules_erlang

So that checks can run on this PR without a release

* Fix additional dialyzer warnings in rabbitmq_cli

* rabbitmq_cli: mix format

* Additional fixes for ignored return values

* Revert "Temporarily use pre-release rules_erlang"

This reverts commit c16b5b6815.

* Use rules_erlang 3.9.2
2023-01-31 15:05:52 +01:00
Simon Unge 03617f681c See #5957. Accept empty arg and prompt for password 2023-01-26 11:46:24 -08:00
Alexey Lebedeff a9b44f017c Fix all dialyzer warnings in `rabbitmq_stomp` 2023-01-25 16:13:10 +01:00
Simon Unge 67bc94ed16 See #5957. CLI command to generate hashed password from cleartext password 2023-01-23 14:47:29 -08:00
Michael Klishin 3bfba02281
Merge pull request #6919 from rabbitmq/rin/rework-elixir-dialyze
Rework elixir dialyze
2023-01-21 12:11:02 -06:00
Rin Kuryloski 3b2513eb93 Quote vars in shell in deps/rabbitmq_cli/rabbitmqctl.bzl 2023-01-20 15:50:17 +01:00
Rin Kuryloski dd9a8c96f1 Change `alias` to `test_suite` in deps/rabbitmq_cli/BUILD.bazel
bazel test won't work correctly on an alias, apparently:
https://docs.bazel.build/versions/2.2.0/be/general.html#alias

the recommended workaround is to use a test_suite instead
2023-01-19 22:06:56 +01:00
Rin Kuryloski 057f776c8a Fixup docstring 2023-01-19 17:29:29 +01:00
Rin Kuryloski 08d641a1a9 Fix dialyzer warnings revealed from previous commit 2023-01-19 17:29:29 +01:00
Rin Kuryloski b84e746ee9 Rework plt/dialyze for rabbitmqctl and plugins that depend on it
This allows us to stop ignorning undefined callback warnings

When mix compiles rabbitmqctl, it produces a 'consolidated' directory
alongside the 'ebin' dir. Some of the modules in consolidated are
intended to be used instead of those provided by elixir. We now handle
the conflicts properly in the bazel build.
2023-01-19 17:29:23 +01:00
Michael Klishin c3c4665970
Update tests 2023-01-16 09:24:37 -08:00
Michael Klishin 9d69a4b325
CLI: mix format 2023-01-16 09:24:37 -08:00
Michael Klishin 226a7603e8
diagnostics check_port_connectivity: support --address
For scenarios where node hostname resolution on the invoking
host is not a suitable option and a particular address
should be tried instead.

Closes #6853.
2023-01-16 09:24:37 -08:00
Alexey Lebedeff 2c4e4fb691 Fix all dialyzer warnings in rabbitmq_stream
There are some elixir-related messages about undefined functions, but
they don't produce warnings (yet).
2023-01-16 17:11:24 +01:00
Jean-Sébastien Pédron 4840ca9f2f
Merge pull request #6866 from rabbitmq/init-db-from-rabbit_db
rabbit_db: Add `init/0`, `is_virgin_node/0`, `dir/0` and `ensure_dir_exists/0` functions
2023-01-13 16:26:06 +01:00
Jean-Sébastien Pédron 950c4ef7eb
Use `rabbit:data_dir/0` instead of `rabbit_mnesia:dir/0` where it makes sense
Some testcases are interested in RabbitMQ data directory, not Mnesia
directory per se. In this case, call `rabbit:data_dir/0` instead.
2023-01-13 11:56:21 +01:00
Rin Kuryloski d3794cf2c0 Conform vhost tags to a list when set with the cli in all cases
`rabbitmqctl add_vhost myvhost --tags "my_tag"` would not previously
conform "my_tag" to a list before setting vhost metadata, which could
cause crashes when the list was read.
2023-01-13 10:06:11 +01:00
Jean-Sébastien Pédron 8bad27b16d
rabbitmq_cli: Fix typo where we set `rabbit`'s `data_dir` environment variable
The application name was incorrect, leading to errors when trying to use
this data dir as part of the `forget_cluster_node` command.
2023-01-12 15:33:31 +01:00
Michael Klishin ec4f1dba7d
(c) year bump: 2022 => 2023 2023-01-01 23:17:36 -05:00
Michal Kuratczyk 4160dac33e
Check if stream coordinator is quorum critial 2022-12-22 10:02:13 +01:00
Arnaud Cogoluègnes d3caa1cdaa
Merge pull request #6440 from rabbitmq/stream-balancing
Streams rebalancing
2022-12-14 16:51:30 +01:00
Jean-Sébastien Pédron 46b71e8994
rabbitmq-cli: Deleting a non-existing user or vhost is fine
This patch adapts several testcases to this behavior change. The goal is
to avoid transactions where there is no need for one.
2022-12-14 10:06:45 +01:00
Jean-Sébastien Pédron b25175563c
rabbitmq-cli: Fix several testcases which didn't test anything
RabbitMQ lacks argument verifications in many places unfortunately.
Several testcases were passing bad arguments to the command but were
also comparing the result to bad data. This happened to "work"...
2022-12-13 14:55:46 +01:00
Arnaud Cogoluègnes 41c6e55c2a
Fix typos 2022-12-13 11:01:35 +01:00
Michael Klishin d339027850
Merge pull request #6598 from rabbitmq/rin/rabbitmqctl-usage-lists-plugin-commands
Make rabbitmqctl with no command (implicit "help") behave more like with "help"
2022-12-09 13:45:17 +04:00
Péter Gömöri 88877c654c Fix error filtering and printing in queue grow/shrink commands 2022-12-08 18:02:31 +01:00
Rin Kuryloski e2d26953b6 mix format 2022-12-08 17:24:50 +01:00
Rin Kuryloski 8696531d8d Apply node name normalization in cli when loading available commands 2022-12-08 17:07:11 +01:00
Rin Kuryloski 27bb51bb1e Also pass remote node info for regular help commands 2022-12-08 17:05:55 +01:00
Rin Kuryloski 1c5f577c19 Make rabbitmqctl with no command behave more like with "help"
For instance, if '-n ...' has been used to specify a node, it will be
used to discover plugins and print additional commands made available
by plugins, as the "help" command does
2022-12-08 15:26:09 +01:00
Alexey Lebedeff 398f072a03 Expose effective policy definition via CLI
Now it's only visible in the management UI.

One can craft a series of calls to `rabbitmqctl list_queues` and
`rabbitmqctl list_policies` to achieve similiar result. But it's more
difficult, and also doesn't take operator policy (if any) into account.
2022-12-02 17:06:17 +01:00
Jean-Sébastien Pédron ae06f79c10
rabbit: Introduce `rabbit:data_dir/0`
This function returns the data directory where all subsystems should
store their files.

Historically, this was the Mnesia directory. But semantically, this
should be the reverse: RabbitMQ owns the data directory and Mnesia is
configured to put its files there too.

`rabbit_mnesia:dir/0` now calls `rabbit:data_dir/0`.

Other subsystems will be modified in a follow-up commit to call
`rabbit:data_dir/0` instead of `rabbit_mnesia:dir/0`.
2022-11-30 14:41:28 +01:00
Jean-Sébastien Pédron 99b14fd0fa
rabbit_env: Rename `mnesia_*dir` to `data_*dir`
The location and name of this directory remains the same for
compatibility reasons. Therefore, it sill contains "mnesia" in its name.
However, semantically, we want this directory to be unrelated to Mnesia.

In the end, many subsystems write files and directories there, including
Mnesia, all Ra systems and in the future, Khepri.
2022-11-30 13:00:49 +01:00
Michal Kuratczyk feff12cbe2
Stream rebalancing support 2022-11-29 18:59:50 +01:00
Karl Nilsson 97c2bb15c6 Stream coordiantor restart stream preferred leader flag
Allow the restart_stream command / API to provide a preferrred leader
hint. If this leader replies to the coordinator stop phase as one of the
first n/2+1 members and has a sufficientl up-to-date stream tail it will be
selected as the leader, else it will fall back and use the modulus logic to
select the next leader.

sufficiently up to
2022-11-29 16:30:44 +00:00
Karl Nilsson 9736425fa5 Add restart_stream command to rabbitmq-streams
Also add epoch to stream_status output which requires osiris 1.4.1
2022-11-29 16:30:41 +00:00
Michal Kuratczyk d8ff99180b
Consider streams when quorum critical check (#6448)
Extended the quorum critical check to also consider streams and their
potential unavailability if the nodes is stopped.
2022-11-23 15:24:26 +01:00
Alex Valiushko d70660dac7 Add inclusive aliases to ctl info keys
Includes generic ability to provide aliases in other commands.
2022-11-11 14:44:05 -08:00
Michael Klishin 1b1fdfbed5
Merge pull request #6316 from rabbitmq/rabbitmq-server-6289
CLI tools: discover commands in plugins that are enabled indirectly as dependencies; rework plugin state assertions
2022-11-03 17:19:27 +04:00
Michael Klishin 0c821ded1a
CLI: do not fail if plugin directory does not exist
As of #6316/#6020 all plugin directories are scanned earlier and
unconditionally. In some environments, the path won't be set or
will be set incorrectly. Make sure that 'rabbitmqctl help'
and friends work in such environments, even if no commands from
plugins would be available.

Per discussion with @pjk25.
2022-11-03 15:44:08 +04:00
Philip Kuryloski 6c3664d871 Filter the rabbitmq_cli format check out on windows
When I ran it manually, all files were reported as mis-formatted. I
didn't investigate further, may line endings or encoding is an issue?
It seems worth it to skip the check for now since we don't run
integration test on windows with bazel yet anyway.
2022-11-02 14:24:44 +01:00
Rin Kuryloski bff69d325c Fixup format check on windows 2022-11-02 11:50:42 +01:00
Michael Klishin 6ebbfaa0a4
Adopt new helpers that assert on plugin presence and state
In many tests, we do not care what is the complete set of plugins
running on a node (or present, or in a specific state). We only
care that a few select ones are running, are of the expected version,
in a certain state, and so on.

So list comparison assertions are counterproductive and lead to
test interference that is difficult to track down. In many cases
we can do more fine grained assertions and ignore the rest of
the plugins present on the node.

References #6289, #6020.
2022-11-02 14:07:10 +04:00
Rin Kuryloski cb935a034e Reduce unnecessary setup in rabbitmq_cli formatting check 2022-11-02 10:41:30 +01:00
Rin Kuryloski d15599940d Split rabbitmq_cli format check into a separate test target in bazel
`bazel test //deps/rabbitmq_cli:all` runs tests and format check
`bazel test //deps/rabbitmq_cli:tests` runs just the tests
`bazel test //deps/rabbitmq_cli:check_formatted` runs just the format
check
2022-11-02 10:17:08 +01:00
Michael Klishin 8c6b3bfbc6
CLI: continue reworking assertions on plugin state 2022-11-02 13:08:44 +04:00
Michael Klishin e1d14bac2d
Reset enabled plugins after each test that enables any 2022-11-02 13:08:44 +04:00
Simon Unge cd1ac5b66c
See Issue 6020. Add rabbitmq_stream_management plugin to test suite 2022-11-02 13:08:44 +04:00
Simon Unge 917bf55e19
See Issue 6020. Take plugin dependency into account 2022-11-02 13:08:44 +04:00
Rin Kuryloski 278025f514 Copy rather than symlink files in rabbitmqctl_test.bzl
Bazel seems to be cleaning up files after following directory symlinks
after the test. Not what I would have expected, and maybe a
consequence of lighter sandboxing used on macos with rabbitmq. In any
case copying seems to be a reasonable workaround.
2022-11-02 09:49:38 +01:00
Michael Klishin e7e88d4dc4
Explain that 'bazel clean' helps with this odd condition 2022-11-02 09:50:08 +04:00
Rin Kuryloski 55a9245493 Fail fast in the rabbitmq_cli tests if test_helper.exs is missing
For reasons which are not yet fully understood, this file can go
missing and require a `bazel clean` to get the suite working
again. Having this check in place should make future flakes easier to
diagnose, and help determine if subsequent symlinking in the
underlying bazel rule should be replaced with copying, or if something
else altogether is happening.
2022-11-01 17:05:53 +01:00
Michael Klishin 7dcacf5f52
Merge pull request #6294 from rabbitmq/mk-status-format-when-free-disk-space-cannot-be-computed
ctl status: handle cases when free disk space cannot be computed
2022-11-01 17:16:15 +04:00
Michael Klishin 0cd8dff415
CLI: improve isolation of set_disk_free_limit tests 2022-11-01 16:39:35 +04:00
Michael Klishin ca518b846b
ctl status: handle cases when free disk space cannot be computed 2022-11-01 15:25:05 +04:00
Jean-Sébastien Pédron 4b132daaba
Remove upgrade-specific log file
This category should be unused with the decommissioning of the old
upgrade subsystem (in favor of the feature flags subsystem). It means:
1. The upgrade log file will not be created by default anymore.
2. The `$RABBITMQ_UPGRADE_LOG` environment variable is now unsupported.

The configuration variables remain to avoid breaking an existing and
working configuration.
2022-10-06 21:28:50 +02:00
Rin Kuryloski a71ff1341e Add 'mix format --check-formatted' to the rabbitmqctl_tests in bazel
to match the check on the Makefile side that was recently introduced
2022-10-04 14:59:45 +02:00
Ayanda Dube c4b42f6c50 add rabbitmq_cli format check on make/mix task aliases 2022-10-02 19:07:08 +01:00
Ayanda Dube 345a580f6d remove deprecated and replace with import Config module 2022-10-02 18:56:48 +01:00
Ayanda Dube 4cbbaad2df mix format rabbitmq_cli 2022-10-02 18:54:11 +01:00
Ayanda Dube 56ca86a48e initial .formatter.exs configuration file 2022-10-02 18:52:43 +01:00
Michael Klishin 7780c594eb Require Elixir 1.13.4 or 1.14.x 2022-09-18 22:25:42 +04:00
Michael Klishin 8db79fadda
Merge branch 'main' into rabbitmq-server-5708-whitelist-elixir-1.14 2022-09-03 01:15:30 +04:00
Michael Klishin e40a121c80 Make CLI tools version reflect that of RabbitMQ itself on this branch 2022-09-03 00:32:13 +04:00
Michael Klishin 7914e60d6a CLI tools: whitelist Elixir 1.14
As suggested by @VlkrS in #5708
2022-09-03 00:30:23 +04:00
Michael Klishin 53c7ea0661
Merge pull request #5579 from rabbitmq/mk-release-eol-date-warnings
Introduce a concept of release series EOL date
2022-08-28 18:18:46 +04:00
Michael Klishin ead5acc7d6 Squash a few compiler warnings
one revealed a real issue in a CLI command
2022-08-28 18:16:01 +04:00
Michael Klishin fc0de65393 Release series support: wording
"maintenance" is already used by node maintenance mode,
"supported" is also closer to the language used in the docs
2022-08-27 22:12:43 +04:00
Michael Klishin 33b4e6f799 Report version series maintenance status via CLI
as part of 'rabbitmq-diagnostics status'
2022-08-27 21:49:35 +04:00
Rin Kuryloski 165f946ffd Remove .travis.yml.patch files 2022-08-16 09:48:46 +02:00
Rin Kuryloski 575c5f9975 Remove all of the .travis.yml files
since we no longer use them
2022-08-16 09:46:31 +02:00
Michael Klishin 83676fa74b
Validate the feature flag behind user-provided queue type on the server end 2022-08-01 19:04:10 +04:00
Michael Klishin 2c4c51d62d
ctl add_vhost: check if relevant feature flags are enabled 2022-08-01 15:56:35 +04:00
Jean-Sébastien Pédron 5b98d7d2a2
Remove test code which depended on the `maintenance_mode_status` feature flags
These checks are now irrelevant as the feature flag is required.
2022-07-29 11:51:52 +02:00
Rin Kuryloski e9c1e6b680 Bump the rabbitmq version on this branch to 3.12.0 (bazel)
To reduce cache misses, the bazel build uses a hard coded version. A
correct value is injected in releases.
2022-07-28 09:45:26 +02:00
Rin Kuryloski 59b858de54 Revert "Fixup an accidental backport side-effect"
This reverts commit 5053d48bce.
2022-07-27 14:03:01 +02:00
Rin Kuryloski 5053d48bce
Fixup an accidental backport side-effect 2022-07-27 14:02:35 +02:00
Rin Kuryloski f67eaaae68 Use code compiled with -DTEST in mixed version testing
Also introduces an actions workflow to provide the necessary archives
referenced in secondary_umbrella.bzl
2022-07-26 20:29:33 +02:00
Michael Klishin 1b62cfcca2
add_vhost: help wording 2022-07-26 01:16:36 +04:00
Karl Nilsson 65ca0b4dfd Add default_queue_type to list_vhosts command 2022-07-25 12:34:52 +01:00
Karl Nilsson 51fe7c72af Add a --default-queue-type argument to rabbitmqctl add_vhost 2022-07-25 12:34:51 +01:00
Jean-Sébastien Pédron bcb8733880
rabbit_feature_flags: Add a feature flags controller process
This gen_statem-based process is responsible for handling concurrency
when feature flags are enabled and synchronized when a cluster is
expanded.

This clarifies and stabilizes the behavior of the feature flag subsystem
w.r.t. situations where e.g. a feature flag migration function takes
time to update data and a new node joins a cluster and synchronizes its
feature flag states with the cluster. There was a chance that the
feature flag was marked as enabled on the joining node, even though the
migration function didn't take care of that node.

With this new feature flags controller, enabling or synchronizing
feature flags blocks and delays any concurrent operations which try to
modify feature flags states too.

This change also clarifies where and when the migration function is
called: it is called at least once on each node who knows the feature
flag and when the state goes from "disabled" to "enabled" on that node.

Note that even if the feature flag is being enabled on a subset of the
nodes (because other nodes already have it enabled), it is marked as
"state_changing" everywhere during the migration. This is to prevent
that a node where it is enabled assumes it is enabled on all nodes who
know the feature flag.

There is a new feature as well: just after a feature flag is enabled,
the migration function is called a second time for any post-enable
actions. The feature flag is marked as enabled between these "enable"
and "post-enable" steps. The success or failure of this "post-enable"
run does not affect the state of the feature flag (i.e. it is ignored).

A new migration function API is introduced to allow more advanced
things. The new API is:

    my_migration_function(
      #ffcommand{name = ...,
                 props = ...,
		 command = enable | post_enable,
		 extra = #{...}})

The record is defined in `include/feature_flags.hrl`. Here is the
meaning of each field:

* `name` and `props` are the equivalent of the `FeatureName` and
  `FeatureProps` arguments of the previous migration function API.

* `command` is basically the same as the previous `Arg` arguments.

* `extra` is map containing context-specific information. For instance, it
  contains the list of nodes where the feature flag state changes.

This whole new behavior is behind a new feature flag called
`feature_flags_v2`. If a feature flag uses the new migration function
API, `feature_flags_v2` will be automatically enabled.

If many feature flags are enabled at once (like when a fresh RabbitMQ
node is started for the first time), `feature_flags_v2` will be enabled
first if it is in the list.
2022-06-28 10:13:19 +02:00
Jean-Sébastien Pédron 3eb6374e4e
rabbitmq_cli: Take "make" command from $MAKE env. variable
This unbreaks the build of rabbitmq_cli on platforms where GNU Make is
installed under another name than `make`. This is the case on Mac OSX
and *BSD for instance where GNU Make is available as `gmake`.
2022-06-20 11:36:02 +02:00
Philip Kuryloski 09fa85e570 Remove extra tar options not supported on macos
They would have improved the reproducibility of the :source_archive
rule, but are not essential. Fixes the macos breakage introduced by
5027.
2022-06-14 17:53:49 +02:00
Philip Kuryloski 34db1a3c38 Add a rule for building a source archive
that includes the external dependencies
2022-06-14 10:44:09 +02:00
Philip Kuryloski f52efbb909 Fixup rabbitmqctl build for missing formatters & otp 25 2022-06-13 12:08:57 +02:00
Philip Kuryloski 0b676e925f Again bump rules_erlang 2022-06-08 14:04:59 +02:00
Philip Kuryloski 327f075d57 Make rabbitmq-server work with rules_erlang 3
Also rework elixir dependency handling, so we no longer rely on mix to
fetch the rabbitmq_cli deps

Also:

- Specify ra version with a commit rather than a branch
- Fixup compilation options for erlang 23
- Add missing ra reference in MODULE.bazel
- Add missing flag in oci.yaml
- Reduce bazel rbe jobs to try to save memory
- Use bazel built erlang for erlang git master tests
- Use the same cache for all the workflows but windows
- Avoid using `mix local.hex --force` in elixir rules
  - Fetching seems blocked in CI, and this should reduce hex api usage in
    all builds, which is always nice
- Remove xref and dialyze tags since rules_erlang 3 includes them in
  the defaults
2022-06-08 14:04:53 +02:00
Michael Klishin 727fe6ca4e
Update CLI build requirements to match our pipelines 2022-06-05 16:36:53 +04:00
Loïc Hoguin dc70cbf281
Update Erlang.mk and switch to new xref code 2022-05-31 13:51:12 +02:00
Philip Kuryloski 9dc9b92a94 Fix `rabbitmqctl status` when the disk_free cannot be determined
By adjusting RabbitMQ.CLI.InformationUnit to no longer attempt to
convert non-numeric values
2022-05-25 15:46:33 +02:00
Michael Klishin 2b80ed5c5e
Report crypto library version in 'rabbitmq-diagnostics status'
Just like we do in the node startup banner.

Closes #4799.
2022-05-12 16:19:41 +04:00
Péter Gömöri 542ffeebb5 Clarify documented/allowed log_level arg of rabbitmqctl set_log_level
The `critical` log level is already documented on the website/logging section.
2022-05-11 19:22:28 +02:00
Michael Klishin f76e31ca50
ctl clear_user_limits: add a missing argument back to help 2022-04-28 22:46:39 +04:00
Michael Klishin 2731a86751
Bump observer_cli to 1.7.3 2022-04-17 16:48:57 +04:00
Luke Bakken dba25f6462
Replace files with symlinks
This prevents duplicated and out-of-date instructions.
2022-04-15 06:04:29 -07:00
Michal Kuratczyk eecdb54292 Make await_online_synchronized_mirror no-op in single-node clusters
Similar to: https://github.com/rabbitmq/rabbitmq-server/pull/2890/
2022-04-14 11:47:40 +02:00
Philip Kuryloski a22234f6eb Updates for rules_erlang 2.5.0
rabbitmq_cli uses some private rules_erlang apis that have changed in
the upcoming release

Additionally:
- Avoid including both standard and test versions of amqp_client in
integration test suites
- Eliminate most of the compilation order hints (explicit first_srcs)
in the bazel build
- Fix an include statement - in bazel, an app is not available to
itself as a library at compilation time
2022-04-07 14:54:37 +02:00
Philip Kuryloski 46221c689a Allow selective cli test runs with --test_env TEST_FILE
i.e. `bazel test //deps/rabbitmq_cli:all --test_env
TEST_FILE=test/ctl/add_user_command_test.exs`
2022-03-21 23:40:41 +01:00
Michael Klishin c38a3d697d
Bump (c) year 2022-03-21 01:21:56 +04:00
Michael Klishin 4b88b269ce
Cosmetics 2022-03-10 18:57:59 +04:00
Michael Klishin 5e38602f6d
Cosmetics 2022-03-10 18:57:23 +04:00
Michael Klishin 16bdcee5f4
rabbitmqct {encode, decode}: accept more values via standard input
Per discussion with @lhoguin.

References #4216.
2022-03-10 18:55:12 +04:00
Karl Nilsson 4b193608bb
Merge pull request #3121 from rabbitmq/quorum-queues-v2
QQ: introduce new machine version (2)
2022-03-08 16:19:04 +00:00
David Ansari 56e05af6e3 Fix 'rabbitmqctl list_queues --help' output
Before this commit, the help output showed:

```
...
Arguments and Options

<column>
	must be one of #, aliases, are, arguments, auto_delete,
    consumer_capacity, consumer_utilisation, consumers, disk_reads,
    disk_writes, durable, exclusive, exclusive_consumer_pid,
    exclusive_consumer_tag, head_message_timestamp, leader, members,
    memory, message_bytes, message_bytes_persistent, message_bytes_ram,
    message_bytes_ready, message_bytes_unacknowledged, messages,
    messages_persistent, messages_ram, messages_ready,
    messages_ready_ram, messages_unacknowledged,
    messages_unacknowledged_ram, name, online, owner_pid, pid, policy,
    slave_pids, state, synchronised_slave_pids, these, type
...
```
2022-03-02 19:47:49 +01:00
David Ansari 13a30898cf Delete queue returns number of ready messages
AMQP 0.9.1 spec:

1.7.2.10.1. Parameter queue.delete­ok.message­count (message­count)
Ordinal: 1
Domain: message­coun
Reports the number of messages deleted.

For classic and quorum queues, deleting a queue returns the number of
ready messages.

This does not include unacked (or dead lettered messages).
Make it clear in the CLI output.
2022-02-28 16:28:05 +01:00
Michael Klishin 1c4d07aadc
Make these list order-independent
(cherry picked from commit ac0f5d2c14)
2022-02-18 00:41:46 +03:00
Michael Klishin 866c652f9d
Update this test for new mock .ez files
(cherry picked from commit 83e2946317)
2022-02-18 00:41:37 +03:00
Michael Klishin d51a83197b
Correct .app file of mock plugin 02
(cherry picked from commit 4bf2ef1b4b)
2022-02-18 00:41:29 +03:00
Michael Klishin ccb8f1e045
Update mock_rabbitmq_plugins_03 and mock_rabbitmq_plugins_04
Now compiled on Erlang 23 for Erlang 25 module loading compatibility.

(cherry picked from commit 532d555260)
2022-02-18 00:41:20 +03:00
Michael Klishin ee4114b54e
Update mock_rabbitmq_plugins_01 and mock_rabbitmq_plugins_02
Now compiled on Erlang 23 for Erlang 25 module loading compatibility.

(cherry picked from commit 26d526771a)
2022-02-18 00:41:13 +03:00
David Ansari 1aac573cb3 Bump observer_cli to v1.7.2 2022-02-11 17:26:03 +01:00
Michael Klishin d2b7b8a402
Elixir 1.13 OptionParser no longer supports :atom values
so coerce e.g. node names in our own code.
2022-02-04 19:03:14 +03:00
Luke Bakken 59e211d97e
Support Elixir 1.13
This is the build error prior to these changes:

```
* rabbit_common (/home/bakkenl/development/rabbitmq/rabbitmq-server/deps/rabbit_common)
  could not find an app file at "_build/dev/lib/rabbit_common/ebin/rabbit_common.app". This may happen if the dependency was not yet compiled or the dependency indeed has no app file (then you can pass app: false as option)
** (Mix) Can't continue due to errors on dependencies
```

Telling `mix` to compile `rabbit_common` ensures that the following
links are created:

```
$ ll deps/rabbitmq_cli/_build/dev/lib/rabbit_common/
total 8
drwxr-xr-x  2 bakkenl bakkenl 4096 Jan 20 09:46 .
drwxr-xr-x 10 bakkenl bakkenl 4096 Jan 20 09:46 ..
lrwxrwxrwx  1 bakkenl bakkenl   33 Jan 20 09:46 ebin -> ../../../../../rabbit_common/ebin
lrwxrwxrwx  1 bakkenl bakkenl   36 Jan 20 09:46 include -> ../../../../../rabbit_common/include
```
2022-02-04 19:02:23 +03:00
Michael Klishin e18b75e9a1
Safely fetch skip_if_unchanged from options 2022-01-30 00:12:16 +03:00
Michael Klishin 8d9515c017
Support --skip-if-unchanged for global imports via CLI tools 2022-01-29 00:34:56 +03:00
Michael Klishin 057e033431
Introduce definition hashing during import
as an opt-in feature. The goal is to avoid re-importing the definition
from the definition file/directory/source if we know the content
has not changed. Since this feature won't be appropriate for
every environment (sometimes unconditional reimporting is expected),
the feature is opt-in.

This is still a WIP.
2022-01-28 22:52:00 +03:00
Philip Kuryloski 936a9e785a Workaround mix error on windows
Also avoid long path issues in windows/bazel

https://docs.bazel.build/versions/main/windows.html#avoid-long-path-issues
2022-01-25 16:18:47 +00:00
Philip Kuryloski efcd881658 Use rules_erlang v2
bazel-erlang has been renamed rules_erlang. v2 is a substantial
refactor that brings Windows support. While this alone isn't enough to
run all rabbitmq-server suites on windows, one can at least now start
the broker (bazel run broker) and run the tests that do not start a
background broker process
2022-01-18 13:43:46 +01:00
Michael Klishin f7d32d69f8 Introduce a new CLI tool (scope), rabbitmq-tanzu
For Tanzu (commercial) plugins to attach their commands to instead of
polluting rabbitmqctl.

Pair: @pjk25
(cherry picked from commit 6e0f2436fa)
2021-11-30 14:54:09 +00:00
Philip Kuryloski 8c0eece3cd Adjustments for the latest bazel-erlang 2021-11-02 16:24:26 +01:00
Loïc Hoguin 43d40231b9
Upgrade to Observer CLI 1.7.1
Previous version was not working on Windows due to a crash.
2021-09-21 13:49:58 +02:00
Philip Kuryloski bcd565f2cb Use the +deterministic compiler flag when building with Make 2021-09-17 09:34:50 +02:00
Philip Kuryloski 6a161475fc Use the deterministic compiler flag for elixir/rabbitmq_cli 2021-09-16 16:45:11 +02:00
Michael Klishin d01b01663b
CLI: introduce :tanzu as a new scope 2021-09-09 13:06:57 +03:00
Jean-Sébastien Pédron b95d540669
rabbitmq_cli: Fix `maintenance_mode_status` feature flag name
... in testsuite.

This didn't really affect the testsuite because all feature flags are
enabled earlier if I understand correctly.
2021-09-01 11:30:48 +02:00
David Ansari 38a6ce9601 Fix link of stream docs 2021-07-26 12:03:06 +02:00
Michael Klishin ef14bf067e
ctl add_vhost: propagate tags if no description is given 2021-07-18 08:28:53 +03:00
Philip Kuryloski 3eac3cf8a8 Remove unused load statements from bazel files 2021-07-12 12:10:26 +02:00
Michael Klishin 1d3d8623de
CLI tests: make mock plugin declare compatibility with 3.8 through 3.10 2021-06-28 18:39:40 +03:00
Philip Kuryloski 7e17a47557 Update rabbitmq_cli mock test plugin for 3.10.x 2021-06-15 11:29:57 +02:00
Arnaud Cogoluègnes 49a70a0f9f
Handle last_stream_member more gently in CLI 2021-06-04 16:35:46 +02:00
Karl Nilsson 9bcd51c2a5 Correct help text for rabbitmq-queue grow command 2021-05-26 14:20:04 +01:00
Gerhard Lazu f8b4e1e298
Add consumer offset_lag to rabbitmq-stream CLI command & Management
This is an important metric to keep track of and be aware (maybe even
alert on) when consumers fall behind consuming stream messages. While
they should be able to catch up, if they fall behind too much and the
stream gets truncated, they may miss on messages.

This is something that we want to expose via Prometheus metrics as well,
but we've started closer to the core, CLI & Management.

This should be merged as soon as it passes CI, we shouldn't wait on the
Prometheus changes - they can come later.

Pair: @kjnilsson

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2021-05-21 13:02:48 +01:00
Michal Kuratczyk e540761a2c
Declare support for elixir 1.12 2021-05-21 11:34:56 +02:00
Michael Klishin 040f8cc912
Replace a few more leftover MPLv1.1 license headers
Most files have been using the MPLv2 headers for months now.
These were detected by the OSL process.
2021-05-19 21:20:47 +03:00
Philip Kuryloski c5eb1ab725 Mark the rabbitmq_cli suite flaky in bazel
It fails occassionally due to elixir compiler flakiness
2021-05-03 10:27:36 +02:00
Michael Klishin 09cae9252f
Update status command module name, references #3014 2021-05-02 04:34:50 +03:00
Michael Klishin 36020f1036
Merge pull request #3017 from rabbitmq/mk-vhost-update-tags
Make it possible to update virtual host metadata (specifically tags)
2021-05-01 22:04:38 +03:00
Michael Klishin a5373d71d6
Make it possible to update virtual host tags
Currently they can only be specified at creation time
2021-05-01 21:48:50 +03:00
dcorbacho 2998234f48 Move stream_status command to streams
Keeps the alias to diagnostics and queues
2021-04-30 11:33:05 +02:00
dcorbacho 310a483221 CLI command to for stream details
rabbitmq-queues stream_status [--tracking] <queue>
If the --tracking option is enabled, it returns a table with all offset tracking
for that queue.
2021-04-13 15:29:40 +01:00
Michael Klishin 7aa0fd6215
CLI: format infinity high VM memory watermark in status
High VM memory watermark cannot actually be set to 'infinity' (and beyond :P)
but it can be returned as a fallback value. See #2733 for some additional
context.

We format 'infinity' as "100% of available memory". This seems to be
a reasonable way to do it because the status command will try to
present a final interpreted limit value.
Generally a limit of infinity won't be returned except very early in node
boot when the monitor(s) haven't yet started.

Per discussion with @evaskova.
2021-04-10 17:33:29 +03:00
Michael Klishin 8566524d3c
CLI: handle {:relative, val} cases when formatting memory watermark
It can be exposed to CLI tools when relative watermark value is
configured via advanced.config.

Closes #2964.
2021-04-10 16:54:12 +03:00
Philip Kuryloski 388654c542
Add a partial Bazel build (#2938)
Adds WORKSPACE.bazel, BUILD.bazel & *.bzl files for partial build & test with Bazel. Introduces a build-time dependency on https://github.com/rabbitmq/bazel-erlang
2021-03-29 11:01:43 +02:00
Michael Klishin 6ad235cc64
Update rabbitmq-diagnostics {drain, revive} tests
to enable the feature flag they depend for
their functionality.
2021-03-24 21:22:40 +03:00
Michael Klishin 43ab84a248
CLI tools: bump dependencies 2021-03-24 13:30:39 +03:00
Michael Klishin 6843bb681e
CLI tools: gitignore ./sbin 2021-03-24 13:30:39 +03:00
Philip Kuryloski a63f169fcb Remove duplicate rabbitmq-components.mk and erlang.mk files
Also adjust the references in rabbitmq-components.mk to account for
post monorepo locations
2021-03-22 15:40:19 +01:00
Michael Klishin 4bceae0c21
Use the standard domain for quorum queue doc guides 2021-03-22 13:40:42 +03:00
kjnilsson d6e96c238c fix missing Ra deps updates 2021-03-19 13:54:43 +00:00
Michael Klishin 2fcb282633
Make 'rabbitmq-queues await_online_quorum_plus_one' a no-op for single node clusters
since it does not make sense in that case
2021-03-13 00:47:23 +03:00
Jean-Sébastien Pédron cdcf602749
Switch from Lager to the new Erlang Logger API for logging
The configuration remains the same for the end-user. The only exception
is the log root directory: it is now set through the `log_root`
application env. variable in `rabbit`. People using the Cuttlefish-based
configuration file are not affected by this exception.

The main change is how the logging facility is configured. It now
happens in `rabbit_prelaunch_logging`. The `rabbit_lager` module is
removed.

The supported outputs remain the same: the console, text files, the
`amq.rabbitmq.log` exchange and syslog.

The message text format slightly changed: the timestamp is more precise
(now to the microsecond) and the level can be abbreviated to always be
4-character long to align all messages and improve readability. Here is
an example:

    2021-03-03 10:22:30.377392+01:00 [dbug] <0.229.0> == Prelaunch DONE ==
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>  Starting RabbitMQ 3.8.10+115.g071f3fb on Erlang 23.2.5
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>  Licensed under the MPL 2.0. Website: https://rabbitmq.com

The example above also shows that multiline messages are supported and
each line is prepended with the same prefix (the timestamp, the level
and the Erlang process PID).

JSON is also supported as a message format and now for any outputs.
Indeed, it is possible to use it with e.g. syslog or the exchange. Here
is an example of a JSON-formatted message sent to syslog:

    Mar  3 11:23:06 localhost rabbitmq-server[27908] <0.229.0> - {"time":"2021-03-03T11:23:06.998466+01:00","level":"notice","msg":"Logging: configured log handlers are now ACTIVE","meta":{"domain":"rabbitmq.prelaunch","file":"src/rabbit_prelaunch_logging.erl","gl":"<0.228.0>","line":311,"mfa":["rabbit_prelaunch_logging","configure_logger",1],"pid":"<0.229.0>"}}

For quick testing, the values accepted by the `$RABBITMQ_LOGS`
environment variables were extended:
  * `-` still means stdout
  * `-stderr` means stderr
  * `syslog:` means syslog on localhost
  * `exchange:` means logging to `amq.rabbitmq.log`

`$RABBITMQ_LOG` was also extended. It now accepts a `+json` modifier (in
addition to the existing `+color` one). With that modifier, messages are
formatted as JSON intead of plain text.

The `rabbitmqctl rotate_logs` command is deprecated. The reason is
Logger does not expose a function to force log rotation. However, it
will detect when a file was rotated by an external tool.

From a developer point of view, the old `rabbit_log*` API remains
supported, though it is now deprecated. It is implemented as regular
modules: there is no `parse_transform` involved anymore.

In the code, it is recommended to use the new Logger macros. For
instance, `?LOG_INFO(Format, Args)`. If possible, messages should be
augmented with some metadata. For instance (note the map after the
message):

    ?LOG_NOTICE("Logging: switching to configured handler(s); following "
                "messages may not be visible in this log output",
                #{domain => ?RMQLOG_DOMAIN_PRELAUNCH}),

Domains in Erlang Logger parlance are the way to categorize messages.
Some predefined domains, matching previous categories, are currently
defined in `rabbit_common/include/logging.hrl` or headers in the
relevant plugins for plugin-specific categories.

At this point, very few messages have been converted from the old
`rabbit_log*` API to the new macros. It can be done gradually when
working on a particular module or logging.

The Erlang builtin console/file handler, `logger_std_h`, has been forked
because it lacks date-based file rotation. The configuration of
date-based rotation is identical to Lager. Once the dust has settled for
this feature, the goal is to submit it upstream for inclusion in Erlang.
The forked module is calld `rabbit_logger_std_h` and is based
`logger_std_h` in Erlang 23.0.
2021-03-11 15:17:36 +01:00
Michael Klishin d7e1336741
rabbitmq-diagnostics remote_shell: squash a compiler warning 2021-03-11 04:12:23 +03:00
Michael Klishin af50305d5d
Merge pull request #2860 from rabbitmq/cli-remote_shell
Add rabbitmq-diagnostics remote_shell
2021-03-05 05:59:31 +03:00
Michael Klishin a310687478
Sync rabbitmq-components.mk 2021-03-05 02:52:23 +03:00
Michael Klishin 0d29cbb116
Cosmetics 2021-03-03 17:17:59 +03:00
Loïc Hoguin 5c829ff599
Add rabbitmq-diagnostics remote_shell 2021-03-03 11:28:54 +01:00
Michael Klishin 17b082abeb
Merge pull request #2843 from rabbitmq/consumer-capacity
Rename consumer_utilisation to consumer_capacity
2021-02-25 16:17:09 +03:00
Michael Klishin 93721bfa2d
Whitelist consumer_capacity in 'rabbitmqctl list_queues' 2021-02-24 21:26:46 +03:00
Michael Klishin a5098b28a7
Bump Lager to 3.8.2 for OTP 24 compatibility 2021-02-24 12:53:30 +03:00
Michael Klishin 17526987c6
Bump (c) year 2021-02-14 00:54:01 +03:00
Michael Klishin 68c04358a5
Drive-by change: improve wording used by 'rabbitmq-queues rebalance' 2021-02-09 21:02:52 +03:00
Michael Klishin 83ae131dea
Refactor this test in attempt to help a scoping issue on Concourse 2021-02-01 23:09:07 +03:00
Michael Klishin e735025b2c
Use await_condition/2 in these tests 2021-02-01 20:19:39 +03:00
Michael Klishin 3f6a42e82b
Wording 2021-02-01 20:19:22 +03:00
Michal Kuratczyk ea1f4a355a New command: `rabbitmqctl close_all_user_connections` 2021-02-01 16:04:16 +01:00
Michal Kuratczyk 5a967affdd WIP: close_all_user_connections command 2021-01-28 12:57:18 +01:00
Jean-Sébastien Pédron 47686ee1f0
Remove unused .github directories
They were valid until the switch to the "monorepository" when everything
was merged into a single Git repository.
2020-11-17 13:33:16 +01:00
Michael Klishin 400f6f1188
Wording and additional usage docs
(cherry picked from commit 3e3ef927b2)
2020-11-17 14:17:43 +03:00
Michal Kuratczyk ce65586405
Allow "all" as a feature flag name
`rabbitmqctl enable_feature_flag all` enables all currently disabled feature flags.
While https://github.com/rabbitmq/rabbitmq-cli/issues/455 asked for
`--all`, I decided to just use "all" for consistency with
`rabbitmq-queues rebalance all`.

Closes rabbitmq/rabbitmq-cli#455

(cherry picked from commit af9e877848)
2020-11-17 14:17:35 +03:00
Philip Kuryloski 44b77e8b1e Monorepo GitHub Actions
Add GitHub Actions workflows for Erlang/OTP 22.3 & 23.0.

The workflows run tests for each component that is now part of this
repo, with test suite parallelization specifically for the rabbit
erlang application.
2020-11-13 14:41:22 +01:00
Arnaud Cogoluègnes 6c24522651 Update rabbitmq-components.mk 2020-11-03 14:27:36 +01:00
Michael Klishin 4f7db32452 Provide an extra hint in 'rabbitmqctl add_user' output
to give the user an idea that she would have to
grant permissions to the newly added user.
2020-10-25 16:43:37 +03:00
Arnaud Cogoluègnes 82e7cb95a1 Merge pull request #460 from rabbitmq/queue-type-info-keys
Add relevant info keys for stream and quorum queues
2020-10-22 13:52:47 +02:00
Michael Klishin 57a013e2b3 Update rabbitmq-components.mk 2020-10-21 12:55:33 +03:00
Michael Klishin 864bc3ab26 Avoid Elixir compiler warnings about unknown modules
Note that JSON and CSV are listed under deps/0 but the compiler
seemingly fails to discover them.
2020-10-20 13:48:01 +03:00
Michael Klishin d7824289f4 List Elixir 1.11 as supported 2020-10-20 13:28:58 +03:00
Michael Klishin 053104258c Simplify node ID generation to just a random number [0, 1024] 2020-10-20 09:18:49 +03:00
Luke Bakken 1a7df254c3 mix format 2020-10-19 17:31:03 -07:00
Luke Bakken 02e234c2de Use the current epoch seconds to generate CLI name
This will limit the number of CLI node names to 1024 by taking the
current epoch seconds modulo a random number between 1 and 1024.

Follow-up to the following:

rabbitmq/rabbitmq-server#552

https://groups.google.com/d/msg/rabbitmq-users/aSnlC5hSvMk/sIWtv5fxCgAJ
2020-10-19 17:27:43 -07:00
dcorbacho d7aaf7bccb Add relevant info keys for stream and quorum queues 2020-10-19 15:57:08 +01:00
Michael Klishin b5bdfe701b Don't consider nodes in maintenance mode to be quorum critical
they should have transferred their QQ replicas to its peers
and won't be considered for new replica placement
or Raft leader elections.

Closes #2469.
2020-10-19 17:29:12 +03:00
Michael Klishin 5a95b3b847 Merge pull request #450 from rabbitmq/auth-attempt-metrics
Add enable/disable and list auth attempt metrics
2020-10-14 23:56:47 +03:00
Michael Klishin c43db9d4d9 Auth attempt command naming, add JSON --formatter support 2020-10-14 23:32:16 +03:00
Luke Bakken 6232f18eed mix format 2020-10-12 10:07:04 -07:00
Jean-Sébastien Pédron fcd487f93f Travis CI: Update config from rabbitmq-common 2020-10-12 18:10:32 +02:00
Jean-Sébastien Pédron d8dd6c190a Travis CI: Update config from rabbitmq-common 2020-10-12 17:42:54 +02:00
Jean-Sébastien Pédron 15eef0b52a test: Remove assertions around `mnesia_dir_not_found`
... when no Mnesia directory is specified. The reason is that the
default behavior changed: if the node is unavailable and no Mnesia
directory is configured, we use the default directory.
2020-10-12 17:42:50 +02:00
Luke Bakken 69a51a9c89 mix format 2020-10-12 07:29:00 -07:00
Luke Bakken a9a2164026 Handle offline remote node in rename_cluster_node
If the remote node is unavailable, we use the default values of
`mnesia_dir` and `feature_flags_file`
2020-10-12 07:27:53 -07:00
Michael Klishin 12ec3716e6 Squash a compiler warning 2020-10-05 17:48:55 +03:00
Jean-Sébastien Pédron 1925e2970f mix.exs: Bump requirement to 1.10.4
We only test against 1.10.4, so there is no way we can claim
compatibility with older versions.
2020-10-05 15:43:35 +02:00
Luke Bakken 95170e037f Update minimum required Elixir version
See https://github.com/rabbitmq/rabbitmq-ci/pull/33

Part of an effort to use Elixir 1.9 as the minimum.

cc @dumbbell
2020-10-01 08:34:01 -07:00
dcorbacho a40f08fbc4 Fix stream commands 2020-09-30 16:34:53 +01:00
dcorbacho eaacd594f5 Move set stream retention policy to rabbitm-streams
Add forgotten tests
2020-09-30 16:34:53 +01:00
dcorbacho fb8610ff44 Add/delete stream replica commands
New ctl utility for stream queues
[#171207068]
2020-09-30 16:34:50 +01:00
dcorbacho b2698901d3 Set stream retention policy command
[#171207092]
2020-09-30 16:34:13 +01:00
dcorbacho ece0aa7609 Shrink quorum queues on forget cluster node command
When the node is offline we can only offer a warning - operator
must use the shrink command once the node is restarted
2020-09-25 15:06:39 +01:00
dcorbacho 49616a709a Add --by-source option to list auth attempts command 2020-09-24 12:29:52 +01:00
dcorbacho 156df91ae2 Rename auth attempt commands 2020-09-23 11:49:13 +01:00
Michael Klishin c691658476 Squash a couple of compiler warnings 2020-09-22 05:55:56 +03:00
Michael Klishin 664db6c28f Handle cases when there's no message to peek at 2020-09-21 12:33:45 +03:00
Michael Klishin 446e164f27 'rabbitmq-queues peek': tighter position validation, basic JSON formatter support 2020-09-21 12:00:45 +03:00
Michael Klishin 09f60618db 'rabbitmq-queues peek': use MergesDefaultVirtualHost 2020-09-20 20:14:49 +03:00
Michael Klishin e9919a9651 peek command: limit to rabbitmq-queues 2020-09-20 20:13:31 +03:00
Michael Klishin aa2b985461 Merge branch 'master' into qq-peek-command 2020-09-20 20:02:53 +03:00
Michael Klishin 28a5f4fc45 Improve error handling, including with --formatter=json 2020-09-18 11:58:15 +03:00
Michael Klishin f16166d29b rabbitmq-queues reclaim_quorum_memory: restore --vhost mention in usage
apparently quite a few commands have it, even though it's
documented in the general/global parameters section.
2020-09-18 10:18:11 +03:00
Michael Klishin a6e17863fb Introduce RabbitMQ.CLI.Core.MergesDefaultVirtualHost
Despite being the implicit default, the "/" virtual host
may be required in function assertions, so an explicit
merge can still be necessary.

Lets introduce a reusable macro module for this.
2020-09-18 10:00:52 +03:00
Michael Klishin 9ba1f594f7 Wording 2020-09-18 08:15:42 +03:00
dcorbacho dd5bed6308 Reclaim quorum memory command 2020-09-16 12:38:55 +01:00
kjnilsson 53a5839ae7 Quorum queue peek command 2020-09-14 12:05:46 +01:00
dcorbacho bb005b1ce6 Add enable/disable and list auth attempt metrics 2020-08-28 15:22:19 +01:00
Michael Klishin bf12dc98fa set_user_limits: mention <username> in parameter docs 2020-08-25 20:24:18 +03:00
Michael Klishin 9b8b7436e8 Wording 2020-08-25 19:09:00 +03:00
Michael Klishin 185b6d5352 Avoid double spacing between command lines
when no arguments are provided. This makes the output
consistent with that of `help' and `--help'.
2020-08-20 14:27:31 +03:00
Luke Bakken b3a139fbfe Update rabbitmq-components.mk 2020-08-20 14:27:31 +03:00
Michael Klishin 3d621a5984 Include total amount of memory used into 'rabbitmq-diagnostics status' output
--formatter=json already reports that value.

Spotted by Jon P on rabbitmq-users and @lukebakken.
2020-08-20 14:27:31 +03:00
Jean-Sébastien Pédron c7dc8a2958 Update rabbitmq-components.mk 2020-08-20 14:27:31 +03:00
Luke Bakken 3fb7a9f689 Update rabbitmq-components.mk 2020-08-20 14:27:31 +03:00
dcorbacho 8ae539f3f8 Update erlang.mk 2020-08-20 14:27:30 +03:00
Michael Klishin 812e6dee38 Update rabbitmq-components.mk 2020-08-20 14:27:30 +03:00
Michael Klishin d0972006b2 Update rabbitmq-components.mk 2020-08-20 14:27:30 +03:00
Michael Klishin 6f17c6cbd0 More reliable drain and revive command assertions 2020-08-20 14:27:30 +03:00
dcorbacho 7e9d0b87df Revert drop of Exhibit B on MPL 2.0 2020-08-20 14:27:30 +03:00
dcorbacho fb051224b1 Update LICENSE 2020-08-20 14:27:30 +03:00
Michael Klishin 15ea3d3de0 Avoid double spacing between command lines
when no arguments are provided. This makes the output
consistent with that of `help' and `--help'.
2020-08-05 19:36:32 +03:00
Luke Bakken b483db91c3 Update rabbitmq-components.mk 2020-08-04 08:41:46 -07:00
Michael Klishin 4445a3267e Include total amount of memory used into 'rabbitmq-diagnostics status' output
--formatter=json already reports that value.

Spotted by Jon P on rabbitmq-users and @lukebakken.
2020-07-31 03:29:15 +03:00
Jean-Sébastien Pédron e644c5241a Update rabbitmq-components.mk 2020-07-30 12:06:51 +02:00
Luke Bakken 389586bc5a Update rabbitmq-components.mk 2020-07-29 10:02:02 -07:00
dcorbacho d2c5d02cfd Update erlang.mk 2020-07-21 14:32:06 +01:00
Michael Klishin a20aff9de5 Update rabbitmq-components.mk 2020-07-21 13:12:45 +03:00
Michael Klishin c69f24d4df Update rabbitmq-components.mk 2020-07-21 03:42:48 +03:00
Michael Klishin 51b60e3ac3 More reliable drain and revive command assertions 2020-07-21 03:42:48 +03:00
dcorbacho 5b6bbc039b Revert drop of Exhibit B on MPL 2.0 2020-07-20 16:57:52 +01:00
dcorbacho a806216533 Update LICENSE 2020-07-20 10:51:27 +01:00
Ayanda-D 74c183e69e Update list_user_limits command defaults 2020-07-17 15:59:20 +01:00
Ayanda-D 30160430b2 Update license, ref: #447 2020-07-17 15:59:20 +01:00
Ayanda-D afcae06cd9 Include acting-user in user-limit operations & doc-guides 2020-07-17 15:59:20 +01:00
Anupama Singh 128201baa6 New command added to list user limits 2020-07-17 15:59:20 +01:00
Ayanda-D dbbe62e8a4 Test case added for command to set both max-connections and max-channels
Clearing all user limits
Testcase to test clearing all limits for user
2020-07-17 15:59:20 +01:00
Anupama Singh d1301e5ce5 Test cases for setting and clearing user connection/channel limits 2020-07-17 15:59:20 +01:00
Anupama Singh 57b95856d8 Clearing user connection/channel limits 2020-07-17 15:56:48 +01:00
Anupama Singh e02fdb63c8 Setting user connection/channel limits 2020-07-17 15:56:48 +01:00
Michael Klishin f05a7c5f09 Update MPL2 license file, drop Exhibit B
and add a VMware copyright notice.

We did not mean to make this code Incompatible with Secondary Licenses
as defined in [1].

1. https://www.mozilla.org/en-US/MPL/2.0/FAQ/
2020-07-17 14:53:10 +03:00
Michael Klishin 5553a24545 Sync license headers with MPL2 in master 2020-07-14 03:54:19 +03:00
Michael Klishin 21abbe1fc8 rabbitmq-upgrade {drain,revive}: produce a sensible error when target node does not support maintenance mode 2020-07-14 03:52:02 +03:00
Michael Klishin c9d984eb4c Report node maintenance status in 'rabbitmq-diagnostics cluster_status'
Part of rabbitmq/rabbitmq-server#2321
2020-07-14 03:52:02 +03:00
Michael Klishin c9ed8be1bc Report node maintenance status in 'rabbitmq-diagnostics status'
Part of rabbitmq/rabbitmq-server#2321
2020-07-14 03:52:02 +03:00
Michael Klishin 998701eb05 Introduce 'rabbitmq-upgrade drain' and 'rabbitmq-upgrade revive'
A part of rabbitmq/rabbitmq-server#2321
2020-07-14 03:52:02 +03:00
Michael Klishin 30ee526b2a Add doc guide links to {suspend,resume}_listeners 2020-07-14 03:52:02 +03:00
Michael Klishin a8b5408992 Follow our standard file naming convention for commands 2020-07-14 03:52:02 +03:00
Michael Klishin 35103fe7da Introduce 'rabbitmqctl {suspend,resume}_listeners'
Not directly related to rabbitmq/rabbitmq-server#2321
but useful on its own. We've had requests for and discussions
about such commands in the past and now that Ranch supports
listener suspension, there aren't many reasons not to do it.
2020-07-14 03:52:01 +03:00
dcorbacho 679ca254f3 Switch to Mozilla Public License 2.0 (MPL 2.0) 2020-07-11 19:23:07 +01:00
Michael Klishin db662cfa59 Re-categorize some rabbitmq-diagnostics commands
For a couple of reasons:

 * The Observability, Monitoring and Health Checks group has grown too large
 * Some commands in it clearly have to do with exploring effective node
   or CLI tool configuration, not its dynamically changing operational state
2020-07-05 15:35:32 +07:00
Michael Klishin 9ac54057f2 Wording 2020-07-05 03:50:48 +07:00
Michael Klishin 7bf2f6b4ef erlang_cookie_sources: support Windows-specific HOMEDRIVE and HOMEPATH 2020-07-05 03:49:48 +07:00
Michael Klishin db299967e0 Introduce 'rabbitmq-diagnostics erlang_cookie_sources'
to help troubleshoot authentication issues.

Inspired by an idea from @gerhard.
2020-07-05 03:19:50 +07:00
Michael Klishin 31550672da Squash a compiler warning 2020-07-03 10:57:23 +07:00
Michael Klishin 4f80dd1369 Make RABBITMQ_ERLANG_COOKIE deprecation message pop [as in colors] 2020-07-03 09:05:35 +07:00
Michael Klishin d7ca0e9446 Deprecate RABBITMQ_ERLANG_COOKIE env variable support
It's not worth the confusion it causes in practice since
the server does not support it.

Per discussion with @gerhard @dumbbell.

Closes #443.
2020-07-02 08:25:49 +03:00
Michael Klishin f8c9b3db33 More end-to-end integration tests for #439 2020-07-02 07:32:26 +03:00
Michael Klishin 2101043257 Introduce a first class autocomplete command
Currently we have a --auto-complete magic argument which
does not show up in `help` and requires its argument to be
explcitly -- separated from the actual flag, which is
counter-intuitive.

This introduces a new autocomplete command which is delegated
to by --auto-complete, much like --help is simply a special
way of invoking the `help` command.

Closes #439
2020-07-02 07:29:40 +03:00
Michael Klishin 9f031d3f0b Special case single node clusters for 'rabbitmq-queues check_if_node_is_quorum_critical'
References rabbitmq/rabbitmq-cli#432
2020-07-01 18:25:06 +03:00
Michael Klishin 18a3daf9be rabbitmqctl eval: consume multiple lines from standard input
Part of #438
2020-07-01 16:55:33 +03:00
Michael Klishin a98e38dd80 Introduce 'rabbitmqctl eval_file [file path]'
for evaluation of scripts in environments where standard input
redirection is not an option or problematic, e.g.
certain Windows environments.

Closes #438
2020-07-01 03:11:13 +03:00
Michael Klishin 0f1f6d2be7 'rabbitmqctl eval': accept expression to evaluate from stdin
References #438
2020-07-01 02:29:22 +03:00
Michael Klishin 24947666b9 if a node is the only cluster member, pass on the mirror sync critical check
Per discussion with @harshac, @ansd

Closes rabbitmq/rabbitmq-cli#432
2020-07-01 01:46:31 +03:00
Michael Klishin 921d349e37 Make --help, help usage help messages consistent
* `help` printed an "Error:" at the top for no reason
 * `help [command]` with a non-existent command did not offer a suggestion
   like an attempt to invoke a non-existent command would
 * Exit codes were not consistent
 * `help --list-commands` had line break issues

With this change,

  * `help` is consistent with --help
  * `help [command]` is consistent with `[command] --help`
  * If a command is not found, either during the execution flow
    or `help [commnad]`, we consistently attempt a Jaro distance suggestion
  * Successful or effectively successful exits from the `help`
    command do not produce any error messages at the top
2020-06-29 03:57:52 +03:00
Michael Klishin ca815978dd Drop a low importance test that only fails in one environment 2020-06-26 06:35:55 +03:00
Michael Klishin 37c9a5cb75 An attempt to fix a test failing only on Concourse 2020-06-26 06:26:25 +03:00
Michael Klishin ef329b88b1 rabbitmqctl export_definitions: ensure that parameter value is a map
otherwise it would be serialised as a list of pairs, which is
not the format the import path (or an operator) expects

Closes #435
2020-06-26 05:55:57 +03:00
Michael Klishin 209acc6396 Rename Rabbitmq.Atom.Coerce to RabbitMQ.CLI.Core.DataCoercion
to follow the existing core (library, utility) module
naming convention.
2020-06-26 01:34:03 +03:00
Michael Klishin 82d62726b5 Bump listed version requirements
Technically we support Elixir 1.9 but let's recommend
the latest and greatest.
2020-06-26 01:31:58 +03:00
Michael Klishin d11bd12a97 Make 'rabbitmqctl hipe_compile' a no-op
HiPE has been deprecated/only partially supported in Erlang 22
and will be removed completely in Erlang 24 next year.

Part of rabbitmq/rabbitmq-server#2392
2020-06-25 18:39:12 +03:00
Jean-Sébastien Pédron bda56ef30f Update erlang.mk 2020-06-23 17:13:36 +02:00
Michael Klishin e1e92408db Move these helpers to Core.Networking 2020-06-21 15:41:45 +03:00
Michael Klishin f11384fe86 Introduce 'rabbitmq-diagnostics resolver_info'
To inspect effective inetrc [1] settings used
by a node or CLI tools.

1. https://erlang.org/doc/apps/erts/inet_cfg.html
2020-06-21 15:09:21 +03:00
Michael Klishin b17fda724b Introduce 'rabbitmq-diagnostics resolve_hostname'
Helps with troubleshooting hostname resolution behavior
on nodes and locally for CLI tools. This is obviously not meant
to be a replacement for existing tools such as dig, only
a way to quickly spot obvious irregularities, e.g. those
in environments that use custom Erlang inetrc files.

Per discussion @harshac.
2020-06-20 16:55:21 +03:00
Michael Klishin c72f0aea41 ctl add_user: use a more suitable exit code when no password is provided
EX_DATAERR from [1] makes more sense than EX_SOFTWARE.

1. https://www.freebsd.org/cgi/man.cgi?query=sysexits&apropos=0&sektion=0&manpath=FreeBSD+12.0-RELEASE&arch=default&format=html
2020-06-13 13:04:47 +03:00
Jean-Sébastien Pédron e170057456 GitHub Actions: Only dispatch from the master branch
The reason is that currently, the repository dispatch event only
triggers the workflow of the target repository's default branch (i.e.
master in our case).

This is ok for now, but this prevents us from using GitHub Actions with
release branches unfortunately.
2020-06-09 16:47:50 +02:00
Michael Klishin 696ccb18b4 Bump Recon to 2.5.1
for Erlang 23 compatibility of 'rabbitmq-diagnostics observer'

References zhongwencool/observer_cli#68.
2020-06-09 08:22:16 +03:00
Michael Klishin 6986086b88 User and permission management command: adopt a more suitable exit code
Apparently [1], which is the most standardized set of exit codes
we could find, includes a dedicated exit code for cases where
a user does not exist.

References #425, rabbitmq/rabbitmq-server#2363, bda0cbfdc3.

1. https://www.freebsd.org/cgi/man.cgi?query=sysexits&apropos=0&sektion=0&manpath=FreeBSD+12.0-RELEASE&arch=default&format=html
2020-06-08 05:35:33 +03:00
Michael Klishin bda0cbfdc3 Update test expectation
References #425, rabbitmq/rabbitmq-server#2363
2020-06-08 05:03:55 +03:00
Michael Klishin 01e974c5dc Merge pull request #428 from rabbitmq/rabbitmq-cli-424
Introduce 'rabbitmq-diagnostics list_network_interfaces'
2020-06-05 18:57:46 +03:00
Luke Bakken 9f9cb644c9 Remove unused variable 2020-06-05 08:12:20 -07:00
Michael Klishin 9fbec752b3 rabbitmq-diagnostics list_network_interfaces: support --offline mode
Operators likely would want to inspect available interfaces when
the node is not yet running.

Part of rabbitmq/rabbitmq-cli#424
2020-06-05 17:47:38 +03:00