Commit Graph

575 Commits

Author SHA1 Message Date
Philip Kuryloski bcd565f2cb Use the +deterministic compiler flag when building with Make 2021-09-17 09:34:50 +02:00
Alexey Lebedeff 87532c4af4 Make test/development related makefile vars lazy
They were trying to run `hostname` and `which`, which produced a bunch
of error messages in a hermetic build environment.

And performance of those `shell` calls is not very important, as they
are caled just a few times during script runtime anyway (there is a
hack to make these lazy, but evaluating only once - but it's hardly
worth it).
2021-08-06 17:32:04 +02:00
Jean-Sébastien Pédron ac7df333b6
Revert "rabbitmq-dist.mk: Install CLI scripts as part of the build"
This has the unfortunate side effect of causing a rebuild of all
applications every time. I need to figure out another place to build and
install the CLI during build time (instead of as part of the dist
target).

This reverts commit 4322cca66e.
2021-07-23 10:46:56 +02:00
Philip Kuryloski ae955d44c6 Avoid building the cli scripts in rabbitmq_stream_common
This isn't an issue in the monorepo, but causes problems externally
projects using rabbitmq-components.mk
2021-07-23 10:40:20 +02:00
Jean-Sébastien Pédron 4322cca66e
rabbitmq-dist.mk: Install CLI scripts as part of the build
... instead of the `dist` target. This way, the Erlang release can use
them.
2021-07-22 10:21:33 +02:00
Pavel Heimlich 020b22f9ea fix hostname(1) calls on Solaris 2021-06-17 13:23:05 +02:00
Philip Kuryloski e02132ee0f Fix rabbitmq-components.mk path when publishing to hex pm 2021-05-25 10:29:51 +02:00
Arnaud Cogoluègnes c42930acb0
Set stream plugin default port to 5552 2021-05-19 15:38:52 +02:00
kjnilsson b576242952 Increase rabbit_stream_queue_SUITE timetrap
And set the default of make start-cluster to 3 nodes.
2021-04-06 15:50:22 +01:00
Philip Kuryloski 768a87980d Remove extra spaces in the RABBITMQ_PLUGINS_DIR during tests 2021-03-29 16:59:53 +02:00
Philip Kuryloski 0e7b537af7 Fix self-referencing recursive make variable
Introduced in 388654c542
2021-03-29 14:18:17 +02: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
Philip Kuryloski b62c5499ce Reinstate the `prepare-dist` tasks for rabbitmq components
The consolidation of `rabbitmq-components.mk` broke the previous
method by which rabbit components were detected. Now we check
$(RABBITMQ_COMPONENTS) directly.
2021-03-23 17:42:23 +01: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
kjnilsson 52f745dcde Update rabbitmq-components.mk
use v1.x branch of ra
2021-03-18 15:14:40 +00:00
Loïc Hoguin d5e3bdd623
Add ADDITIONAL_PLUGINS variable
This allows including additional applications or third party
plugins when creating a release, running the broker locally,
or just building from the top-level Makefile.

To include Looking Glass in a release, for example:

$ make package-generic-unix ADDITIONAL_PLUGINS="looking_glass"

A Docker image can then be built using this release and will
contain Looking Glass:

$ make docker-image

Beware macOS users! Applications such as Looking Glass include
NIFs. NIFs must be compiled in the right environment. If you
are building a Docker image then make sure to build the NIF
on Linux! In the two steps above, this corresponds to Step 1.

To run the broker with Looking Glass available:

$ make run-broker ADDITIONAL_PLUGINS="looking_glass"

This commit also moves Looking Glass dependency information
into rabbitmq-components.mk so it is available at all times.
2021-03-12 12:29:28 +01: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
Gerhard Lazu 5ac24dd2be
Make start-cluster work when run in the top-level
Subsequent nodes fail to start since ports are already in use. This
makes it possible to start multiple nodes locally with all plugins
enabled.

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2021-03-10 13:15:44 +00:00
dcorbacho 61f7b2a723 Update to ranch 2.0 2021-03-08 23:11:05 +01:00
Michael Klishin b6c4831e75
Bump Lager to 3.9.1 2021-03-04 04:36:39 +03:00
Loïc Hoguin 66ac1bf5e9
Bump observer_cli to 1.6.1
More responsive when the system is overloaded with file calls.
2021-03-01 21:55:27 +03:00
Arnaud Cogoluègnes f53c5dc998
Use port 5551 for streams when starting cluster 2021-03-01 21:55:24 +03:00
Michael Klishin 8fe3df9343
Upgrade Lager to 3.9.0 for OTP 24 compatibility
`lager_util:expand_path/1` use changes are
due to erlang-lager/lager#540
2021-02-26 00:52:15 +03:00
Jean-Sébastien Pédron a45e87e57b
mk/rabbitmq-run.mk: Compute rabbitmq_stream TCP port based on $(RABBITMQ_NODE_PORT)
We already do this for other TCP ports RabbitMQ listens on. This fixes
the use of `gmake start-cluster` with the rabbitmq_stream plugin
enabled.
2021-02-25 10:47:50 +01:00
Michael Klishin f73e851f9c
Bump observer_cli to 1.6.0 2021-02-24 12:53:55 +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 88bf1ba754
Don't filter out lz4 and looking_glass from dependency list
Now that dependencies are packaged as directories and not .ez
files, the fact that both LG and LZ4 are NIFs is no longer
an issue. And having it as regular dependencies simplifies
REPL-driven profiling.

Per discussion with @dumbbell.
2021-02-16 17:03:36 +03:00
Michael Klishin b7f01c102b
Use an up-to-date Looking Glass repo name 2021-02-16 16:21:49 +03:00
Arnaud Cogoluègnes bf72683eb2
Add stream prometheus plugin 2021-01-11 16:49:56 +01:00
Arnaud Cogoluègnes 23d7e8114c
Introduce stream management plugin 2020-11-19 14:48:25 +01:00
Jean-Sébastien Pédron 778e8dad5c
rabbit_common: Remove the rabbitmq-github-actions Erlang.mk plugin
This is unused after the switch to the "monorepository".
2020-11-17 15:29:05 +01:00
Arnaud Cogoluègnes 722dda6eaf Update rabbitmq-components.mk to include stream plugin 2020-11-03 14:26:45 +01:00
Loïc Hoguin 44be0b1114 Update Cowboy to 2.8.0
This will enable stacktraces in the logs again.
2020-10-20 17:07:45 +02:00
Jean-Sébastien Pédron 3a65b3c624 rabbitmq-github-actions.mk: Use Elixir 1.10.4
This is the minimum requirement now, because that's the oldest version
we test against.
2020-10-05 15:46:07 +02:00
Jean-Sébastien Pédron 8bd3bede55 rabbitmq-github-actions.mk: Test with Erlang 23.1
... instead of 23.0.

Erlang 23.1 is the version the Concourse pipelines use. We expect the
Concourse pipelines and the GitHub Actions workflow to be on the same
page.
2020-10-05 15:44:49 +02:00
Arnaud Cogoluègnes 749faa85fa Add stream plugin port in start-cluster target 2020-09-30 14:41:59 +01:00
kjnilsson 28b6b812b1 Add osiris logger sink 2020-09-30 14:41:59 +01:00
dcorbacho 0cec212896 Stream queue data dir 2020-09-30 14:41:59 +01:00
Luke Bakken 6ed6573cef Update mix_task_archive_deps version
https://github.com/rabbitmq/mix_task_archive_deps/releases/tag/0.5.0

See this as well:

https://github.com/rabbitmq/mix_task_archive_deps/pull/2

https://groups.google.com/d/topic/rabbitmq-users/0d8TBs_qmGE/discussion
2020-09-28 15:36:02 -07:00
Philip Kuryloski c1a4790c7b Erlang 21.3 -> 22.3 for `make github-actions`
This has no direct effect until GitHub Actions workflows are
regenerated using make
2020-09-02 10:21:20 +02:00
Jean-Sébastien Pédron ebd88bc7e8 rabbitmq-dist.mk: Exclude `ebin/dep_built` from plugin packaging
This is a state file for Erlang.mk only.
2020-08-11 16:19:19 +02:00
Jean-Sébastien Pédron 9d62a6df30 rabbitmq-dist.mk: Package plugins as directories by default
... instead of .ez archives.

The benefits for doing this:

* We can use native code, as is the case for lz4 and zstd bindings in
  the Tanzu RabbitMQ version for instance. Indeed, Erlang does not
  support loading native code (NIF or port drivers) from .ez archives.

* We can remove custom code to handle .ez archives. We have special
  cases in Erlang.mk plugins as well as the `rabbit_plugins` module, in
  particular the code to extract .ez archives (even though Erlang knows
  how to use them directly).

* Prevent hard to debug situations when the .ez archive name does not
  match the top-level directory inside the archive. In this case, Erlang
  says it can't load the application but doesn't tell much more.

* Debugging and "hot-patching" plugins become easier: we just have to
  copy the recompiled .beam file in place of the existing one. There
  is no need to unpack the plugin, replace the file and recreate the
  archive.

* Release packages can be smaller. gzip, bzip2 and xz, common
  compression algorithm for Unix packages, give much better result if
  they compress the .beam files directly instead of "compressing" zip
  files (the .ez archives are plain zip archives). For instance, the
  generic-unix package goes from 15 MiB when using .ez archives to just
  12 MiB when using directory.

I would also like to experiment with Erlang releases in the future.
Using directories for Erlang applications instead of .ez archives is
mandatory for this to work according to my latest tests.

Of course, this change doesn't break support for .ez archives (and we
will keep support for this). End users can still download third-party
plugins as .ez archives and drop them in the plugins directory.
2020-08-07 17:22:47 +02:00
Luke Bakken a127b7fada rabbitmq-components.mk: Improve top-level DEPS_DIR detection for rabbit_prelaunch 2020-08-04 08:55:08 -07:00
Jean-Sébastien Pédron 4934e2b01e rabbitmq-components.mk: Improve top-level DEPS_DIR detection
In addition to the `rabbitmq-components.mk` existence check, we now
verfy that the directory is named `deps`.

This is to increase the chance that, if we find a
`rabbitmq-componentS.mk` file in the upper directories, this project is
indeed inside a DEPS_DIR.

For instance, in our GitHub Actions workflows, when we prepared the
secondary umbrellas for mixed-version testing, it happened that the
secondary umbrellas were under a clone of rabbitmq-server. Therefore
the first (and only) condition was met and the Makefile erroneously
considered it was inside a DEPS_DIR. As a consequence, dependencies of
the umbrellas were fetched in the wrong place.
2020-07-30 12:01:44 +02:00
Luke Bakken 8f4f0c9618 Update method to determine dependency directories
This new method by @dumbbell will work with any sub-component, not just the umbrella
2020-07-29 10:01:42 -07:00
Jean-Sébastien Pédron 782bead4c0 GitHub Actions: Default to Erlang 21.3 and 23.0 2020-07-24 16:03:04 +02:00
Michael Klishin 1b89b2203d Bump stdout_formatter to 0.2.4 2020-07-21 13:12:36 +03:00
Michael Klishin a27969c2f2 Bump sysmon_handler to 1.3.0 2020-07-21 03:42:37 +03:00
Michael Klishin 3e668819e3 Bump JSX to 2.11.0 2020-07-21 03:42:37 +03:00
Michael Klishin a5923705f7 Bump Recon to 2.5.1
for Erlang 23 compatibility of 'rabbitmq-diagnostics observer'

References zhongwencool/observer_cli#68.
2020-06-09 08:22:15 +03:00