Commit Graph

153 Commits

Author SHA1 Message Date
Loïc Hoguin c5d150a7ef
Use Erlang.mk's native Elixir support for CLI
This avoids using Mix while compiling which simplifies
a number of things and let us do further build improvements
later on.

Elixir is only enabled from within rabbitmq_cli currently.

Eunit is disabled since there are only Elixir tests.

Dialyzer will force-enable Elixir in order to process
Elixir-compiled beam files.

This commit also includes a few changes that are
related:

 * The Erlang distribution will now be started for parallel-ct

 * Many unnecessary PROJECT_MOD lines have been removed

 * `eunit_formatters` has been removed, it provides little value

 * The new `maybe_flock` Erlang.mk function is used where possible

 * Build test deps when testing rabbitmq_cli (Mix won't do it anymore)

 * rabbitmq_ct_helpers now use the early plugins to have Dialyzer
   properly set up
2025-03-18 10:02:49 +01:00
Péter Gömöri f9d3ed732b Remove observer_cli from CLI escritps
observer_cli (and its dependency recon) was declared as a dependency
of rabbitmq_cli and as a consequence included in all escritps. However
the major part of observer_cli runs in the broker. The cli side only
used `observer_cli:rpc_start/2` which is just an rpc call into the
target node.

By using common rpc call we can remove observer_cli and recon from the
escripts. This can be considered a minor improvement based on the
philosophy "simpler is better".

As an additional benefit auto-completing functions of the recon app
now works in `rabbitmq-diagnostics remote_shell`.
(eg. `recon:proc_c<TAB>`)
2025-03-12 00:07:04 +01:00
Michael Klishin 968eefa1bb
Bump (c) line year
There are no functional changes to this massive diff.
2025-01-01 17:54:10 -05:00
Volker Schlecht 5086e283bd
Allow building CLI with elixir 1.18.x
Tested with elixir 1.18.0-rc0
2024-12-12 19:30:04 +01:00
Michael Klishin 40903581ef Bump version to 4.0 in a few places 2024-07-19 01:21:30 -04:00
Volker Schlecht 732a75d71d
Allow elixir 1.17.x
RabbitMQ builds fine with elixir 1.17.1, tested with Release 3.13.3 on OTP26
2024-06-22 09:40:27 +02:00
Alex Valiushko 70ac0cf3c5 bump elixir to 1.17 2024-01-29 16:28:08 -08:00
Michael Klishin 1556fec127 Make 'rabbitmqctl rename_cluster_node' a no-op
This makes a command that renames cluster members
a no-op. This command is really complex under
the hood and is fundamentally incompatible
with a few key Raft-based features:

 * Khepri
 * Quorum queues
 * Streams

Because Khepri first ships in RabbitMQ 3.13,
now is the time to effectively eliminate this
command.

It will be permanently removed together with
other deprecated CLI commands in 4.0.

Per discussion with the team.

Closes #10367.
2024-01-19 11:22:16 -05:00
Luke Bakken 3f33dfa227
Add -noinput via `rabbitmq-env`
Follow-up to #10131
2023-12-30 16:27:02 -08:00
Luke Bakken cb28ffc05b
Ensure that elixir escript does not read from stdin
This change ensures that you do not have to redirect `stdin` from
`/dev/null` to use `rabbitmqctl` and related utilities in a `while` /
`read` shell loop.

References:
* https://github.com/lukebakken/vesc-1073/blob/main/delete.bash#L24-L32
* https://github.com/rabbitmq/support-tools/pull/38
2023-12-14 06:13:56 -08:00
Michael Klishin 1b642353ca
Update (c) according to [1]
1. https://investors.broadcom.com/news-releases/news-release-details/broadcom-and-vmware-intend-close-transaction-november-22-2023
2023-11-21 23:18:22 -05:00
Michal Kuratczyk 32eba980f0
CLI: prune_code_paths: false 2023-11-17 13:09:31 +01:00
Michal Kuratczyk 93bb847798
Revert "Drop JSON from mix.exs #9926 #9932"
This reverts commit 8de8e0c18a.
2023-11-17 13:08:10 +01:00
Michal Kuratczyk 5459975c5c
Revert "Use rabbit_json in the CLI"
This reverts commit 6c65715875.
2023-11-17 13:05:38 +01:00
Michael Klishin 8de8e0c18a
Drop JSON from mix.exs #9926 #9932 2023-11-16 10:05:30 -05:00
Michal Kuratczyk 6c65715875
Use rabbit_json in the CLI
dep_json doesn't seem to be maintained
and it's unnecessary anyway, since we can
use rabbit_json, which uses thoas
2023-11-16 00:01:14 +01:00
Michal Kuratczyk 1ffae77442
Bump CLI deps, remove dialyxir 2023-11-10 15:31:12 +01:00
Jean-Sébastien Pédron b8b4b5d187
rabbitmq_cli: Handle absence of the `rabbit_db*` modules in older versions 2023-09-04 21:09:11 +02:00
Rin Kuryloski d563992569 Do not force mix format check as part of build
It makes joint 1.14/1.15 elixir compatibility too impractical

the format check is still performed in ci by bazel
2023-07-17 08:25:01 +02:00
Rin Kuryloski 2c5e9a5775 Fix rabbitmq_cli test compilation under elixir 1.15 2023-07-04 17:45:32 +02:00
Rin Kuryloski 8efc71eb9f Fix rabbitmqctl compilation under elixir 1.15.x 2023-07-04 17:45:04 +02:00
Michael Klishin 98c85f367f Bump (c) year 2023-07-04 00:21:40 +04:00
Michael Klishin 7e3021ea50 Mix project: version bump 2023-06-21 03:06:17 +04:00
Michael Klishin d3e01675b1 CLI: allow for Elixir 1.15 2023-06-21 03:03:33 +04:00
Michal Kuratczyk fb3655610c
Update CSV to 3.0.5;; remove unused dep 2023-05-26 18:04:42 +02:00
Rin Kuryloski f09b31e8c5
Fetch all cli deps with bazel (#7875)
* Fetch all prod cli deps with bazel

This avoids issues with hex and OTP 26, and is needed for offline
bazel builds anyway

* Fetch test cli deps with bazel

* mix format
2023-04-12 16:27:32 +04:00
Rin Kuryloski eba1d531c9 Fetch cli prod deps via bazel or erlang.mk instead of mix
In preparation for offline bazel builds
2023-03-14 23:11:36 +01:00
Rin Kuryloski e66e5ed62d Pin rabbitmq_cli non-test deps
- Use the same stdout_formatter copy for both erlang and rabbitmq_cli
- Use the same observer_cli copy for both erlang and rabbitmq_cli
2023-03-01 09:54:35 +01:00
Rin Kuryloski 609171ec70 Rename the tanzu cli scope to vmware
And update other references to commercial editions
2023-02-16 13:49:54 +01:00
Ayanda Dube c4b42f6c50 add rabbitmq_cli format check on make/mix task aliases 2022-10-02 19:07:08 +01:00
Ayanda Dube 4cbbaad2df mix format rabbitmq_cli 2022-10-02 18:54:11 +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
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 f52efbb909 Fixup rabbitmqctl build for missing formatters & otp 25 2022-06-13 12:08:57 +02:00
Michael Klishin 2731a86751
Bump observer_cli to 1.7.3 2022-04-17 16:48:57 +04:00
David Ansari 1aac573cb3 Bump observer_cli to v1.7.2 2022-02-11 17:26:03 +01: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
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
Michael Klishin d01b01663b
CLI: introduce :tanzu as a new scope 2021-09-09 13:06:57 +03:00
Michal Kuratczyk e540761a2c
Declare support for elixir 1.12 2021-05-21 11:34:56 +02:00
Michael Klishin 43ab84a248
CLI tools: bump dependencies 2021-03-24 13:30:39 +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 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
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 fb8610ff44 Add/delete stream replica commands
New ctl utility for stream queues
[#171207068]
2020-09-30 16:34:50 +01:00