Commit Graph

2244 Commits

Author SHA1 Message Date
Philip Kuryloski f9d114ad75 dialyze rabbit 2021-05-28 13:27:21 +02:00
Philip Kuryloski fe2e2cfe78 Use dialyzer on rabbit_common
Only dialyze errors will cause a build failure, similar to Erlang.mk
2021-05-28 13:03:55 +02:00
Michael Klishin 6acee761e0
Handle cases where virtual host config file does not yet exist
This happens during queue migration from a pre-3.7 version.

References #2954.
2021-05-27 17:38:53 +03:00
Philip Kuryloski e02132ee0f Fix rabbitmq-components.mk path when publishing to hex pm 2021-05-25 10:29:51 +02:00
Philip Kuryloski 98e71c45d8 Perform xref checks on many tier-1 plugins 2021-05-21 12:03:22 +02:00
Arnaud Cogoluègnes c42930acb0
Set stream plugin default port to 5552 2021-05-19 15:38:52 +02:00
Philip Kuryloski 9053d96ca0 Fix call to deprecated function
https://erlang.org/doc/general_info/deprecations.html#otp-22
2021-05-19 13:38:17 +02:00
Michael Klishin fc7501c309
Convert policy event keys to atoms
so that they are easier to match on
2021-04-28 12:57:06 +03:00
Michael Klishin 60a9a89940
Allow for more ASN.1 string (sub)types 2021-04-20 01:19:38 +03:00
Michael Klishin 73eb9b56ec
Decode other name using 'OTP-PUB-KEY':decode/2
and assume it is a string-like value ("directory string")
because other values would not make much sense in the
username extraction context.

References #2983.
2021-04-20 01:16:29 +03:00
Michael Klishin e15f2b46f3
SAN of type otherName: strip two leading characters
instead of specific ones since they will vary with the payload
(one of them likely indicates UTF string length).

This is still not perfect because we limit the maximum
allowed length but it works fine with identifiers up to 100
characters long, which should be good enough for this
best effort handling of an abscure SAN type.

References ##2983.
2021-04-20 00:20:44 +03:00
Michael Klishin 1587501733
Pass Dialyzer
x.509 certificate extensions do not really have types in
OTP's public_key, so our hands are tied.
2021-04-19 13:56:39 +03:00
Michael Klishin 81f3005b95
rabbit_common: pass Dialyzer 2021-04-19 13:41:29 +03:00
Jean-Sébastien Pédron 6936f2d8a9 rabbit_env: Fix Bourne shell concatenated literal parsing
The parser didn't handle literals of the form:
    'single-quoted'unquoted'single-quoted-again'"or-even-double-quoted"

In particular, the unquoted parsing assumed that nothing else could
follow it. The testsuite is extended with the issue reporter's case.

While here, improve escaped characters handling. They used to be not
parsed specifically at all.

Fixes #2969.
2021-04-19 12:32:53 +02:00
Michael Klishin 21a6b1ba05
x.509 certificate auth mechanism: support (some) SANS of type otherName
Note that the type by definition contains arbitrary values. According
to the OTP types, they are triplets that represent effectively
a key/value pair. So we assume the pair is a string that needs a bit
massaging, namely stripping the UTF encoding prefix OTP AnotherName
decoder leaves in.

Kudos to @Thibi2000 for providing an example value.

Closes #2983.
2021-04-19 02:33:26 +03:00
Jean-Sébastien Pédron 3d1db4b676 rabbit_env: Fix arguments to the ?LOG_DEBUG format string
Format string arguments must be in a list.
2021-04-13 14:20:19 +02:00
Michael Klishin 7f98bc3d1c
Add more VM memory monitor tests, pass Dialyzer
(cherry picked from commit 57ec1f8768)
2021-04-11 11:36:30 +03:00
Michael Klishin 19b104a22f
Update vm_memory_high_watermark/0 type 2021-04-11 10:43:38 +03:00
Michael Klishin 30cbbba167
High VM watermark: support {relative, N} values set via advanced.config
for usability. It is not any different from when a float value
is used and only exists as a counterpart to '{absolute, N}'.

Also nothing changes for rabbitmq.conf users as that format performs
validation and correct value translation.

See #2694, #2965 for background.
2021-04-11 10:28:35 +03: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
Carl Hörberg aac99700e7 get destination address from PROXY protocol 2021-03-30 12:58:49 +02: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
David Ansari dc589856f2 Wait between retries if nxdomain
In kind version 0.10.0, when creating a 5-node RabbitMQ cluster
with the new parallel PodManagementPolicy, we observed that some
pods were restarted. Their logs included:

```
10:10:03.794 [error]
10:10:03.804 [error] BOOT FAILED
10:10:03.805 [error] ===========
BOOT FAILED
10:10:03.805 [error] ERROR: epmd error for host r1-server-0.r1-nodes.rabbitmq-system: nxdomain (non-existing domain)
10:10:03.805 [error]
===========
ERROR: epmd error for host r1-server-0.r1-nodes.rabbitmq-system: nxdomain (non-existing domain)
10:10:04.806 [error] Supervisor rabbit_prelaunch_sup had child prelaunch started with rabbit_prelaunch:run_prelaunch_first_phase() at undefined exit with reason {epmd_error,"r1-server-0.r1-nodes.rabbitmq-system",nxdomain} in context start_error
10:10:04.806 [error] CRASH REPORT Process <0.152.0> with 0 neighbours exited with reason: {{shutdown,{failed_to_start_child,prelaunch,{epmd_error,"r1-server-0.r1-nodes.rabbitmq-system",nxdomain}}},{rabbit_prelaunch_app,start,[normal,[]]}} in application_master:init/4 line 138
```

Eventually, after some pods restarted up to 2 times, all pods were running and ready.

In kind, we observed that during the first couple of seconds, nslookup was failing as well for that domain
with nxdomain.
It took up to 30 seconds until nslookup succeeded.

With this commit, pods don't need to be restarted when creating a fresh
RabbitMQ cluster.
2021-03-18 18:21:02 +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
Michael Klishin 97ff62d3b2
Drop trailing newlines from logged messages where possible
Lager strips trailing newline characters but OTP logger with the default
formatter adds a newline at the end. To avoid unintentional multi-line log
messages we have to revisit most messages logged.

Some log entries are intentionally multiline, others
are printed to stdout directly: newlines are required there
for sensible formatting.
2021-03-11 15:17:37 +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 fd86959429
Revert "Make rabbit_log:log/2 return 'ok' unconditionally"
This reverts commit 01c4ca2aa9.
2021-03-04 13:13:00 +03:00
Michael Klishin 01c4ca2aa9
Make rabbit_log:log/2 return 'ok' unconditionally
instead of relying on a Lager transform-driven return value.

This should avoid erlang/otp#4576 on Erlang 24.

Per discussion with @lhoguin.
2021-03-04 13:09:29 +03:00
Michael Klishin 8920f05a15
Revert "Squash one more Erlang 24 warning"
This reverts commit fb4f88e7dd.

See erlang/otp#4576
2021-03-04 06:10:23 +03:00
Michael Klishin fb4f88e7dd
Squash one more Erlang 24 warning 2021-03-04 05:38:38 +03:00
Michael Klishin 3a169cc9df
Drive-by: squash an Erlang 24-specific warning 2021-03-04 04:41:20 +03:00
Michael Klishin b6c4831e75
Bump Lager to 3.9.1 2021-03-04 04:36:39 +03:00
Michael Klishin ad47eba2fa
pg2 => pg for OTP 24 compatibility
there is still one failing queue federation test.
2021-03-04 04:06:40 +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 561d2e660d
rabbit_env: Use consistent style 2021-02-25 11:13:23 +01: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 98b46b2ffb
rabbit_env: pass Dialyzer again 2021-02-25 06:22:36 +03:00
Michael Klishin 7e93cc8d3b
rabbit_env: remove one more direct call to os:list_env_vars/0 2021-02-25 06:13:41 +03:00
Michael Klishin 26b676f021
Try ignore_xref 2021-02-25 06:11:18 +03:00
Michael Klishin cdd0c1662c
Pass xref on OTP 22 and 23 2021-02-25 06:08:16 +03:00
Michael Klishin 752f16abf7
os:list_env_vars/0 was renamed to os:env/0 in OTP 24 2021-02-25 01:10:40 +03:00
Michael Klishin 00b7a84191
Limit direct reply-to identifier length growth
as node names grow.

Prior to this change, direct reply-to consumer channels
were encoded using term_to_binary/1, which means the result
would grow together with node name (since node name
is one of the components of an Erlang pid type).

This means that with long enough hostnames, reply-to
identifiers could overflow the 255 character limit of
message property field type, longstr.

With this change, the encoded value uses a hash of the node name
and then locates the actual node name from a map of
hashes to current cluster members.

In addition, instead of generating non-predictable "secure"
GUIDs the feature now generates "regular" predictable GUIDs
which compensates some of the additional PID pre- and post-processing
outlined above.
2021-02-24 18:21:26 +03: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
Michael Klishin caddfd3791
Skip aes_ige256 in config value encryption/decryption tests
it is not supported by some libcrypto versions, including CI.

See [1][2].

1. https://github.com/rabbitmq/credentials-obfuscation/pull/10/files
2. https://bugs.erlang.org/browse/ERL-1478
2021-02-07 23:05:27 +03:00
Michael Klishin e5def7f612
Use credentials_obfuscation master in RabbitMQ master 2021-02-07 20:58:07 +03:00
Michael Klishin b11a79cccf
Bump (c) year in header files 2021-02-04 07:04:58 +03:00
Michael Klishin 394d36ab76
Use a record here
accessing record/tuple elements by index is
increases the risk of code breakage when
the record changes.
2021-02-01 20:19:12 +03:00
Arnaud Cogoluègnes b921ac11a8
Merge pull request #2712 from rabbitmq/rabbitmq-stream-prometheus
Add stream prometheus plugin
2021-01-27 16:46:37 +01:00
Michael Klishin 52479099ec
Bump (c) year 2021-01-22 09:00:14 +03:00
Michael Klishin f9e2996b51
Refactor #2733 a bit more 2021-01-21 15:09:20 +03:00
Michael Klishin 9176944c95
Use slightly more idiomatic Erlang 2021-01-21 11:56:30 +03:00
tomyouyou ae173f11bb
'get_memory_use(ratio)' will have an exception when MemoryLimit is 'infinity' 2021-01-21 16:14:56 +08:00
Arnaud Cogoluègnes b5315c0166
Merge branch 'master' into rabbitmq-stream-prometheus 2021-01-18 11:26:06 +01:00
Michael Klishin a087621257
Handle a 'noport' clause here
Follow-up to #2722
2021-01-16 18:56:13 +05:00
Michael Klishin 075ee09996
Naming, wording 2021-01-16 01:45:12 +05:00
Gabriele Santomaggio 19d28f260a Add log 2021-01-15 13:04:24 +01:00
Gabriele Santomaggio 9ec5b4bf86 Add spec 2021-01-15 11:17:43 +01:00
Gabriele Santomaggio ce5550b974 Add retry for epdm name (hostname)
fixes https://github.com/rabbitmq/rabbitmq-server/issues/2718
2021-01-15 09:09:19 +01:00
Arnaud Cogoluègnes bf72683eb2
Add stream prometheus plugin 2021-01-11 16:49:56 +01:00
Michael Klishin ccfd6627eb
Remove Ranch dependency from rabbit_common
It is not actually used there and may complicate dependency resolution
for RabbitMQ Erlang client users.

Per discussion with @dumbbell
2021-01-07 17:53:47 +03:00
Arnaud Cogoluègnes cbd3c8dfdd
Merge branch 'master' into rabbitmq-stream-management 2021-01-04 09:50:47 +01:00
Michael Klishin e8cb671633
Bump credentials_obfuscation version 2020-12-21 03:42:42 +03:00
Arnaud Cogoluègnes 41160210ab
Start stream consumer REST endpoint 2020-12-01 18:23:22 +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
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
Arnaud Cogoluègnes 722dda6eaf Update rabbitmq-components.mk to include stream plugin 2020-11-03 14:26:45 +01:00
Luke Bakken fd73767051 Revert "Handle potential undefined value returned from process dictionary"
This reverts commit 04627ef2ef.
2020-11-02 10:02:46 -08:00
Michael Klishin e6972966bb Part of rabbitmq/rabbitmq-auth-mechanism-ssl#12 2020-10-30 18:46:09 +03:00
Michael Klishin 0284c222e5 Merge branch 'master' into update-cowboy-dep 2020-10-21 09:44:22 +03:00
Michael Klishin 4dfffd312f Remove a (now) unused delegate 2020-10-20 21:14:42 +03:00
Luke Bakken f0c1d17e3a Remove code to guess thread pool size
Part of rabbitmq/rabbitmq-server#2473
2020-10-20 10:23:54 -07: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
Luke Bakken 04627ef2ef Handle potential undefined value returned from process dictionary
CI failures such as this suggest that file handle values can be deleted
mid-operation:

https://github.com/rabbitmq/rabbitmq-server/actions/runs/304216635
2020-10-15 05:49:16 -07:00
Michael Klishin 45158f49ac Merge pull request #409 from rabbitmq/auth-attempt-metrics
Add auth attempt metrics
2020-10-14 23:56:02 +03:00
Jean-Sébastien Pédron 6d1c7dc6d7 Travis CI: Test against Erlang 22.3+23.0 and Elixir 1.10 2020-10-13 11:39:43 +02:00
Jean-Sébastien Pédron b9defc1bff rabbit_env: Fix parsing of $CONF_ENV_FILE output
The `set` command in the implementation of `/bin/sh` included in the
official RabbitMQ Docker image returns multi-line variable values
differently than the tested Bourne shell implementation (GNU Bash, dash
and FreeBSD sh).

I don't know what implementation is used by that Docker image, but here
is the output of `set`, for a variable set to "\n'test'":

    TEST_VAR='
    '"'"'test'"'"

The problem was reported in the following discussion:
https://github.com/rabbitmq/rabbitmq-server/discussions/2458

While here, add a small testcase to check a couple outputs.
2020-10-07 15:33:49 +02:00
kjnilsson db59327963 Move rabbit_mics:confirm_to_sender/3 to server
As it is only used by the server and does not need to be a shared
function.
2020-10-07 13:05:07 +01:00
Nicolas Caille 6f3681210e remove TLSv1.3 from BAD_SSL_PROTOCOL_VERSIONS 2020-10-06 21:27:53 +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
Jean-Sébastien Pédron e5127eaea3 rabbit_log: Restore alphabetical order in the defintion of category() 2020-10-05 14:21:52 +02:00
kjnilsson e0a210cc67 Dialyzer fixes 2020-10-02 10:22:10 +01:00
kjnilsson b87898185b Take stream queue dir into account
For rabbit_env suite.
2020-09-30 14:41:59 +01: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
kjnilsson bbd0cc8198 Add osiris logging shim 2020-09-30 14:41:59 +01:00
kjnilsson f7dcd081fa change return message format 2020-09-30 14:41:59 +01:00
dcorbacho 0cec212896 Stream queue data dir 2020-09-30 14:41:59 +01:00
Michael Klishin 5a215e0f03 Merge branch 'master' into lrb-update-supervisor 2020-09-30 11:22:15 +03:00
Michael Klishin 8f7ecf363f Migrate a supervisor2 suite by @lukebakken from rabbitmq-server
References rabbitmq/rabbitmq-server#2457.
2020-09-30 11:00:32 +03:00
Luke Bakken 39ec461331 Fix transient type handling 2020-09-29 13:49:34 -07:00
Luke Bakken a0bd637558 Fix function ordering to restart correctly. Reduce log spam. 2020-09-29 11:52:35 -07: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
Michael Klishin 2c14e1dd3f Merge branch 'master' into lrb-update-supervisor 2020-09-26 10:00:57 +03:00
Michael Klishin 160742ea8a rpc module calls can return a {badrpc, term()} 2020-09-24 23:15:32 +03:00
dcorbacho 9c56b0cffc Add get_auth_attempts_by_source api 2020-09-23 15:52:50 +01:00
Luke Bakken c1d59f600c Remove tabs 2020-09-22 12:13:44 -07:00
Luke Bakken 111124bc05 Several bug fixes found when running tests
Validate delay value
2020-09-22 12:08:32 -07:00
dcorbacho 8bb1fbdf3d Merge remote-tracking branch 'origin/master' into auth-attempt-metrics 2020-09-22 17:11:08 +01:00
dcorbacho 0d09fb0a85 Split auth attempt metrics into global and detailed
GC collection can then be done by deleting all entries on the ETS table
and total counters per protocol can be kept without individually scanning
all entries
2020-09-22 16:47:10 +01:00
dcorbacho 4c6251d3fb Include protocol in auth metrics 2020-09-22 16:46:52 +01:00
Luke Bakken db7dfdf0cf Remove old supervisor2 module 2020-09-21 15:15:11 -07:00
Luke Bakken 0a87aeace5 Begin migration of code from supervisor2 to the 22.3.4.10 version
Moved a lot of code from old supervisor to new one

All compilation errors fixed

Use the macro, Luke
2020-09-21 15:14:49 -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
Luke Bakken 4c9d67bb9d Do not change the behavior of rpc_call 2020-09-02 03:42:58 +03:00
Luke Bakken bf199aa36c Set RPC_TIMEOUT to 15 seconds 2020-09-02 03:42:58 +03:00
Luke Bakken 3f1c26d951 Add function to allow setting timeout on multicall
A timeout will be handled as an empty result.

@michaelklishin - should that be logged?
2020-09-02 03:42:58 +03:00
dcorbacho 4ad6396475 Add auth attempt metrics 2020-08-28 13:21:13 +01:00
Michael Klishin 8f2df3bad0 Bump credentials_obfuscation to 2.2.0 2020-08-20 14:27:01 +03:00
Jean-Sébastien Pédron 94de4c07ba rabbit_nodes_common: Disable Dialyzer warning for diagnostics_node/1
net_adm:name/1 returns a new value, 'noport', in Erlang 24. This value
being absent in the function spec in previous versions of Erlang, we get
a warning from Dialyzer until we start to the yet-to-be-release Erlang
24 in CI. Therefore we disable this specific warning.
2020-08-20 14:27:01 +03:00
Jean-Sébastien Pédron 2f779e8668 rabbit_nodes_common: Handle `noport` return value from net_adm:names/1
This is a new return value in Erlang 24 when the hostname passed to
net_adm:names/1 couldn't be resolved.
2020-08-20 14:27:01 +03:00
Jean-Sébastien Pédron 32be18d42a rabbitmq-dist.mk: Exclude `ebin/dep_built` from plugin packaging
This is a state file for Erlang.mk only.
2020-08-20 14:27:01 +03:00
Jean-Sébastien Pédron f59db9f8a6 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-20 14:27:01 +03:00
Luke Bakken d9b352a8ff Avoid using os:find_executable to find erl
On Windows, the current working directory is also searched, which can
lead to problems. Instead, use `init:get_argument(root)` to get the root
of the Erlang release, then we know `bin/erl` will always be present.
2020-08-20 14:27:01 +03:00
Luke Bakken 866b810d0e rabbitmq-components.mk: Improve top-level DEPS_DIR detection for rabbit_prelaunch 2020-08-20 14:27:00 +03:00
Jean-Sébastien Pédron efda8c587e 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-08-20 14:27:00 +03:00
Luke Bakken 700fbd7873 Update method to determine dependency directories
This new method by @dumbbell will work with any sub-component, not just the umbrella
2020-08-20 14:27:00 +03:00
Michael Klishin 2aa5d04a9f Bump credentials_obfuscation to 2.1.1 2020-08-20 14:27:00 +03:00
Jean-Sébastien Pédron 9bec817372 GitHub Actions: Default to Erlang 21.3 and 23.0 2020-08-20 14:27:00 +03:00
dcorbacho cbd99c9b4c Update erlang.mk 2020-08-20 14:27:00 +03:00
Michael Klishin bd6c8932a9 Bump stdout_formatter to 0.2.4 2020-08-20 14:27:00 +03:00
Michael Klishin 839f7ca7d1 Bump sysmon_handler to 1.3.0 2020-08-20 14:26:59 +03:00
Michael Klishin 362f0edc06 Bump JSX to 2.11.0 2020-08-20 14:26:59 +03:00
dcorbacho 09c2760bb4 Revert drop of Exhibit B on MPL 2.0 2020-08-20 14:26:59 +03:00
Michael Klishin 4deee618ab Bump credentials_obfuscation to 2.2.0 2020-08-14 08:02:13 +03:00
Jean-Sébastien Pédron d82cf55e3e rabbit_nodes_common: Disable Dialyzer warning for diagnostics_node/1
net_adm:name/1 returns a new value, 'noport', in Erlang 24. This value
being absent in the function spec in previous versions of Erlang, we get
a warning from Dialyzer until we start to the yet-to-be-release Erlang
24 in CI. Therefore we disable this specific warning.
2020-08-13 15:02:51 +02:00
Jean-Sébastien Pédron 9c2f7ee01f rabbit_nodes_common: Handle `noport` return value from net_adm:names/1
This is a new return value in Erlang 24 when the hostname passed to
net_adm:names/1 couldn't be resolved.
2020-08-13 14:36:04 +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
Michael Klishin 406fe48fce Merge branch 'master' into lrb-find-erl-safely 2020-08-09 04:12:43 +03: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 b499da835e Avoid using os:find_executable to find erl
On Windows, the current working directory is also searched, which can
lead to problems. Instead, use `init:get_argument(root)` to get the root
of the Erlang release, then we know `bin/erl` will always be present.
2020-08-07 08:06:43 -07: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
Michael Klishin 2473d9e62c Bump credentials_obfuscation to 2.1.1 2020-07-29 04:42:02 +03: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
dcorbacho f9228fb071 Update erlang.mk 2020-07-21 14:31:38 +01: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
dcorbacho 749e5c9ee1 Revert drop of Exhibit B on MPL 2.0 2020-07-20 16:55:58 +01:00
Anupama Singh 9495a5f8cb user_limits feature flag implementation 2020-07-17 15:55:47 +01:00
Ayanda-D acb586e0a9 Per-user connection and channel tracking records, definitions, types 2020-07-17 15:55:47 +01:00
Anupama Singh 3ce3b9d995 New field limits in #internal_user to store the user limits 2020-07-17 15:54:18 +01:00
Michael Klishin 8780e4eee0 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:09 +03:00
Michael Klishin d1f27b08b8 Drive by change: squash a compiler warning 2020-07-14 03:50:09 +03:00
Michael Klishin 2b80223ed6 Initial API bits for marking a node as being drained (or not)
Part of #2321.
2020-07-14 03:50:09 +03:00
Michael Klishin 58dc58d846 Introduce node maintenance state record 2020-07-14 03:50:08 +03:00
Michael Klishin 62c08ca4c6 Merge branch 'master' into switch-to-MPL-2.0 2020-07-10 13:01:20 +03:00
Jean-Sébastien Pédron 368586ec1b Switch to Mozilla Public License 2.0 (MPL 2.0) 2020-07-07 18:06:39 +02:00
Jean-Sébastien Pédron 33acee94cc rabbit_env: Give precedence to $RABBITMQ_* prefixed variables in the output of $CONF_ENV_FILE
When we source the $CONF_ENV_FILE script, we set a few variables which
this script expects. Those variables are given without their prefix. For
instance, $MNESIA_BASE.

The $CONF_ENV_FILE script can set $RABBITMQ_MNESIA_BASE. Unfortunately
before this patch, the variable would be ignored, in favor of the
default value which was passed to the script ($MNESIA_BASE).

The reason is that variables set by the script are handled in the
alphabetical order. Thus $MNESIA_BASE is handled first, then
$RABBITMQ_MNESIA_BASE.

Because the code didn't give any precedence, the first variable set
would "win". This explains why users who set $RABBITMQ_MNESIA_BASE in
$CONF_ENV_FILE, but using RabbitMQ 3.8.4+ (which introduced
`rabbit_env`), unexpectedly had their node use the default Mnesia base
directory.

The patch is rather simple: when we check if a variable is already set,
we give precedence to the $RABBITMQ_* prefixed variables. Therefore, if
the $CONF_ENV_FILE script sets $RABBITMQ_MNESIA_BASE, this value will be
used, regardless of the value of $MNESIA_BASE.

This didn't happen with variables set in the environment (i.e. the
environment of rabbitmq-server(8)) because the prefixed variables
already had precedence.

Fixes rabbitmq/rabbitmq-common#401.
2020-07-07 16:28:18 +02:00
Jean-Sébastien Pédron 9ab7942d83 rabbit_log: Add Logger handler's log/2 API
This allows RabbitMQ to configure `rabbit_log` as a Logger handler.

See a related commit in rabbit_prelaunch_early_logging in
rabbitmq-server, where `rabbit_log` is being configured as a Logger
handler. The commit message explains the reason behind this.
2020-07-06 14:18:05 +02:00
Jean-Sébastien Pédron 878c5e23cd Update erlang.mk 2020-06-23 17:12:59 +02:00
Jean-Sébastien Pédron 061f306ced GitHub Actions: Fix mentions of "rabbitmq-cli" 2020-06-10 17:47:33 +02:00
Jean-Sébastien Pédron 78585ad70a GitHub Actions: Trigger rabbitmq-server workflows after a commit
... to this repository's `master` branch.

The idea is to make sure rabbitmq-server is tested against this new
version of rabbitmq-common.
2020-06-10 16:35:15 +02: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
Michael Klishin 0e577ee358 Merge branch 'master' into rabbitmq-cli-424 2020-06-05 17:22:08 +03:00
Michael Klishin 5a74a54dd4 Introduce a way to list available NICs in a more presentable format
Part of rabbitmq/rabbitmq-cli#424
2020-06-05 17:21:39 +03:00
Jean-Sébastien Pédron 76a789fbac rabbit_env_SUITE: Prevent load of `$CONF_ENV_FILE` for the entire testsuite
It avoids any pollution from the environment.
2020-06-05 11:43:22 +02:00
Jean-Sébastien Pédron 1ca5c3e72e rabbit_env_SUITE: Test context_to_code_path() for Windows as well 2020-06-05 11:43:14 +02:00
Jean-Sébastien Pédron 474ab2204c rabbit_env: Use the context's OS type in get_user_lib_dirs() 2020-06-05 10:21:06 +02:00
Jean-Sébastien Pédron b002ad6eed rabbit_env: Organize Unix' do_load_conf_env_file as the Window version 2020-06-05 10:21:06 +02:00
Luke Bakken d6a16caa9b rabbit_env: Add support for RABBITMQ_CONF_ENV_FILE on Windows
Fixes #392

Fixes from ERL-1269

match the map

deal with line endings
2020-06-05 10:21:00 +02:00
Michael Klishin 9f6087acc6 Message store settings we already have use the "msg_store" prefix 2020-06-03 20:36:17 +03:00
Philip Kuryloski c40c2628a9 Add a specific shutdown timeout macro and property for message stores
The default timeout of 30 seconds was not sufficient to allow graceful shutdown of a message store with millions of persistent messages. Rather than increase the timeout in general, introduce a new macro with a default of 600 seconds
2020-06-02 14:37:13 +02:00
Michael Klishin c3db0a1beb Introduce rabbit_types:error/2
Part of #2356.
2020-05-30 04:41:29 +03:00
Jean-Sébastien Pédron e6f383dd94 GitHub Actions: Pass files between jobs using artefacts
... instead of the cache action.

The cache action is quite unstable (failing to download the cached
files). In this commit, we try to use the artefacts instead. At this
point, we don't know if it is more reliable, but we'll see with time.

As an added bonus, we can download the archives passed between jobs for
inspection if we need.
2020-05-25 10:18:16 +02:00
Michael Klishin e629102397 Update type specs in rabbit_pbe
In follow-up to rabbitmq/rabbitmq-server#2351, #389.
2020-05-22 16:05:35 +03:00
Luke Bakken fe6312f0ca Add function heads to rabbit_pbe to take credentials-obfuscation 2.0 into account 2020-05-20 19:04:28 -07:00
Luke Bakken 846ac6e957 Update to credentials_obfuscation 2.0
Part of the following:
https://github.com/rabbitmq/credentials-obfuscation/pull/5
2020-05-20 16:08:26 -07:00
Jean-Sébastien Pédron 8d5ddda02a rabbitmq-build.mk: Don't add rabbitmq_cli to compiler path in amqp_client
Otherwise, for instance, running Dialyzer in the Erlang client fails with the
following error if it was cloned directly (i.e. outside of the Umbrella):

dialyzer: Bad directory for -pa: .../amqp_client/deps/rabbitmq_cli/_build/dev/lib/rabbitmqctl/ebin
2020-05-20 17:37:12 +02:00
Jean-Sébastien Pédron 64975ffe47 Revert switch to sys:get_log/1
It  does not exist in Erlang 21.
2020-05-19 17:06:50 +02:00
Jean-Sébastien Pédron 148a40a095 Address deprecation of erlang:get_stacktrace/0 and sys:get_debug/3 2020-05-19 16:48:59 +02:00
Jean-Sébastien Pédron 228aaf5885 GitHub Actions: Run Dialyzer with the latest Erlang version 2020-05-11 12:59:50 +02:00
Jean-Sébastien Pédron fae348f0ed GitHub Actions: Recreate secondary umbrellas in case of cache failure
We don't want the job to fail just because GitHub Actions failed to
restore the cache of the secondary umbrellas. We can just recreate them.
2020-05-11 12:58:41 +02:00
Jean-Sébastien Pédron 681bd126e0 GitHub Actions: Improve caching of secondary umbrellas
The cache key is based on the list of umbrellas included and the version
of Erlang because we now run `make test-dist` in the relevant project.
2020-05-07 12:57:34 +02:00
Jean-Sébastien Pédron 29856aad84 rabbit_env: Add get_used_env_vars/0 to fetch variables used by rabbit_env
... and their value.

Both prefixed and non-prefixed variables are returned by this function.

While here, fix a conflict between $RABBITMQ_HOME and $HOME in
var_is_used/1: the latter shouldn't be considered as used.
2020-05-06 18:32:21 +02:00
Gerhard Lazu eb29dd4dd2 Trigger test workflows on new-commit-to-dep-release-branch events
Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-05-01 13:00:45 +01:00
Jean-Sébastien Pédron 0d27b9ad20 GitHub Actions: Add mixed-version cluster testing
When we generate the workflows, we pick the latest tag of each release
branch. That list of tags is used to clone secondary umbrellas in the
workflows and run the testsuites against each of them.

When generating workflows for `master`, we take the latest tag of each
release branch.

When generating workflows for a release branch, we take the latest tag
of each older release branch, plus the first tag of the same release
branch.

Some examples:
* `master` is tested with 3.8.3 and 3.7.25
* `v3.8.x` is tested with 3.8.0 and 3.7.25
2020-04-30 17:12:34 +02:00
Jean-Sébastien Pédron a6297a6589 GitHub Actions: Move `make bats` to rabbitmq-server
This is specific to rabbitmq-server and won't work in any other
repository.
2020-04-30 17:12:09 +02:00
Jean-Sébastien Pédron d409fd268a GitHub Actions: Rename template chunks to leave room 2020-04-30 16:59:10 +02:00
Jean-Sébastien Pédron 287fdefd15 GitHub Actions: Remove '/' from workflow names 2020-04-30 16:59:10 +02:00
Jean-Sébastien Pédron 7987702cdb GitHub Actions: Pass FAIL_FAST=1 and SKIP_AS_ERROR=1 to `make ct`
With this variable passed, testing will stop at the first failure
(instead of trying all testcases) and a skipped testcase is considered a
failure.
2020-04-30 16:59:10 +02:00
Jean-Sébastien Pédron a442dc597c GitHub Actions: Set vim shiftwidth & expandtab in headers 2020-04-30 15:48:25 +02:00
Jean-Sébastien Pédron 876552c95e rabbitmq-plugin.mk: Fix copy-paste error 2020-04-30 12:35:24 +02:00
Jean-Sébastien Pédron a8a47a42e3 GitHub Actions: Upload rabbitmq-deps.mk to S3 only for `master` & release branches 2020-04-28 13:19:38 +02:00
Jean-Sébastien Pédron 8006d36c04 rabbitmq-github-actions.mk: Set `DO_COMMIT=yes` to automatically commit
... the generated workflows.
2020-04-28 13:16:37 +02:00
Jean-Sébastien Pédron cf7041421a rabbitmq-github-actions.mk: Use $(base_rmq_ref) from rabbitmq-components.mk
..in templates.
2020-04-28 13:16:17 +02:00
Jean-Sébastien Pédron 1f623b1c07 GitHub Actions: Replace a hard-coded "21.3" by $(ERLANG_VERSION) 2020-04-27 17:56:10 +02:00
Jean-Sébastien Pédron 3c6a4c1f15 GitHub Actions: Use GitHub Actions "run_id" when uploading rabbitmq-deps.mk to S3
We need a monotonically increasing number for the version used by the
Concourse S3 resource. A Git commit hash does not work because they do
not have this property.
2020-04-27 14:46:13 +02:00
Jean-Sébastien Pédron 2b1e0f4bfc GitHub Actions: Don't cache `ebin` for now
It messes with Erlang.mk when a workflow is restarted, leading to a
failure in `make xref`.
2020-04-27 14:45:59 +02:00
Jean-Sébastien Pédron 7bf6f736a3 rabbitmq-github-actions.mk: New Erlang.mk plugin to help manage GitHub Actions workflows
The main entry point is `make github-actions` which generates the
workflows.

Currently, it handles workflows to test the project with different
versions of Erlang.
2020-04-27 13:22:34 +02:00
Jean-Sébastien Pédron 2d4b898b23 rabbitmq-tools.mk: Add project name & commit hash as a comment in rabbitmq-deps.mk
The comment is on the first line of the `$(PROJECT)-rabbitmq-deps.mk`
file.
2020-04-27 12:52:54 +02:00
Michael Klishin a8017e8675 rabbit_event:notify/{2,3}: support map events 2020-04-25 21:48:47 +03:00
Jean-Sébastien Pédron 509a218013 rabbitmq-tools.mk: New `rabbitmq-deps.mk` target
It generates a file called `$(PROJECT)-rabbitmq-deps.mk` which has a
dependency definition line of the form expected by Erlang.mk, for each
RabbitMQ component the project depends on.

Therefore the line indicates:
* `git` as the fetch method
* the repository URL
* the Git commit hash the dependency is on

Here is an example for rabbitmq-server:

    dep_rabbit_common := git https://github.com/rabbitmq/rabbitmq-common.git d9ccd8d9cdd58310901f318fed676aff59be5afb
    dep_rabbitmq_cli := git https://github.com/rabbitmq/rabbitmq-cli.git f6eaae292d27da4ded92b7c1b51a8ddcfefa69c2
    dep_rabbitmq_codegen := git https://github.com/rabbitmq/rabbitmq-codegen.git 65da2e86bd65c6b6ecd48478ab092721696bc709
2020-04-22 11:57:38 +02:00
Jean-Sébastien Pédron 2e06989877 Update erlang.mk 2020-04-21 15:52:57 +02:00
Luke Bakken af7466c1c8 Use PLATFORM to determine hostname command 2020-04-20 07:50:57 -07:00
Luke Bakken 30dbad3214 Use "hostname -s" only on Darwin
Fixes #374
2020-04-17 12:31:08 -07:00
Jean-Sébastien Pédron f818953072 rabbitmq-dist.mk: Fix incorrect quoting in install-cli-scripts
The double-quoting was requited in the flock(1)/lockf(1) blocks because
of the use of `sh -c`. However it's incorrect in the `else` block.

Follow-up to commit 3f32a36e50.
2020-04-15 13:56:05 +02:00
Jean-Sébastien Pédron e3cd5fad8d rabbitmq-run.mk: Replace two CLI calls with fast equivalents
The CLI has a high startup time. To speed up the
`start-background-broker` and `stop-node` recipes, two CLI calls are
replaced by two more basic commands which achieve the same goal.
2020-04-14 14:20:04 +02:00
Jean-Sébastien Pédron 3f32a36e50 rabbitmq-dist.mk: Defer computation of `$rabbit_scripts_dir` to install-cli-scripts recipe
The problem with the previous approach was that the `$(wildcard ...)`
directives might be evaluated too early: `deps/rabbit` might not be
available yet.

Moving the computation to the body of the recipe fixes the problem
because dependencies are available at this point.
2020-04-14 14:18:07 +02:00
Jean-Sébastien Pédron b93b89187b rabbitmq-dist.mk: Fix `install-cli-scripts` when rabbit is top-level
In other words, if instead of cloning the Umbrella, one cloned
rabbitmq-server directly, the `install-cli-scripts` recipe would fail to
copy the scripts because it assumed `rabbit` was under `$(DEPS_DIR)`.

Now expected places are checked and an error is emitted if the recipe
can't find the right one.
2020-04-06 13:07:58 +02:00
Philip Kuryloski 7ef99b8e25 Avoid the dependency on rabbit_ct_helpers in worker_pool_SUITE
This breaks the cyclic dependency between rabbitmq_ct_helpers and
rabbit_common.
2020-03-25 10:33:06 +01:00
Michael Klishin 435e493491 Add rabbitmq_ct_helpers to test dependencies
Requried as of #368.
2020-03-25 01:15:49 +03:00
Philip Kuryloski 4c73437a33 Move over worker_pool_SUITE from rabbitmq-server
to consolidate worker pool tests in a single location
2020-03-23 15:26:31 +01:00
Philip Kuryloski 3c0617eef0 use is_process_alive for a cleaner test
according to Michael's suggestion
2020-03-23 15:26:31 +01:00
Philip Kuryloski 16151baba3 Add worker_pool:dispatch_sync funtion
dispatch_sync sits inbetween the behavior of submit and submit_async,
blocking the caller until a worker begins the task, as opposed
to not blocking at all, or blocking util the task has finished.
This is useful when you want to throttle submissions to the pool
from a single process, such that all workers are busy, but there
exists no backlog of work for the pool.
2020-03-20 15:22:19 +01:00
Jean-Sébastien Pédron c6b0d1a767 rabbitmq-run.mk: Remove uses of $RABBITMQ_SCHEMA_DIR
This is unused by RabbitMQ after the completion of
rabbitmq/rabbitmq-server#2180.
2020-03-19 10:36:39 +01:00
Gerhard Lazu c96f6153b3 Default TAR to tar, use gtar on FreeBSD & Darwin
On Darwin, the default tar fails with unkown --transform flag.

FAILS:          bsdtar 2.8.3 - libarchive 2.8.3
SUCCEEDS:       tar (GNU tar) 1.32

re https://github.com/rabbitmq/rabbitmq-common/pull/364

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-18 15:19:49 +01:00
Jean-Sébastien Pédron 95013577ce rabbitmq-tools.mk: Exclude nodes' `mnesia` directory form archive
Those directories can be large and don't carry much value in the context
of the common_test logs.

While here, rename the target to `ct-logs-archive`.
2020-03-18 13:59:50 +01:00
Jean-Sébastien Pédron a070290864 rabbitmq-tools.mk: Add compress-ct-logs target
If there are common_test logs (i.e. `logs` exists), it creates an archive
(compressed with xz(1)) in the top-level directory.

The archive is named `$(PROJECT)-ct-logs-$timestamp.tar.xz` by default.
The name can be changed by setting `$(CT_LOGS_ARCHIVE)`. The file
extension must be `.tar.xz`.
2020-03-17 19:30:48 +01:00
Jean-Sébastien Pédron bb3f355b37 rabbitmq-run.mk: Build RabbitMQ once when using start-{brokers,cluster}
... instead of once per started nodes.
2020-03-17 18:42:12 +01:00
Jean-Sébastien Pédron 13bbfa0dfd rabbitmq-run.mk: Use := instead of ?= in target-specific var. assignment
The documentation says we should be able to use ?=, but apparently it
affects the way variables are passed to sub-make.

The issue we had is that using: `make start-cluster RABBITMQ_CONFIG_FILE=...`
didn't work as expected: `$(RABBITMQ_CONFIG_FILE)` made it to the
sub-make but not to the sub-make's recipe.

Using := fixes the problem.

Doing that is ok because assigning `$(RABBITMQ_CONFIG_FILE)` in the
environment or on make(1)'s command line will override the
target-specific variable anyway.
2020-03-17 18:38:20 +01:00
Jean-Sébastien Pédron b175b2e667 rabbitmq-run.mk: Re-use $(comma) from Erlang.mk 2020-03-17 18:34:54 +01:00
Luke Bakken d59d332bd1 Fix leading tabs 2020-03-16 07:52:23 -07:00
Michael Klishin 47e8053a41 (c) updates for 2020
Pair: @dumbbell.
2020-03-16 15:00:48 +03:00
Michael Klishin 982df58b0f rabbit_nodes_common:make/1: support node parts that are not strings
Such as atoms and binaries.

Pair: @dumbbell.
2020-03-16 15:00:48 +03:00
Gerhard Lazu 382565c507 Double-escape \ so that the config file is generated correctly
Thanks @lukebakken!

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-16 10:52:39 +00:00
Gerhard Lazu 7bfbdba2df Use a better colour for all debug logs
They were plain by default & are now blue which works really well with
Gruvbox Dark. I couldn't change just the debug color, had to redefine
them all.

cc @dumbbell @lukebakken

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-13 23:21:03 +00:00
Gerhard Lazu 1da5f922fe Keep test_rabbitmq_config_with_tls in sync with the default one
Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-13 23:19:39 +00:00
Gerhard Lazu f54691f4b9 Enable colourful debug logging by default
When running the broker locally, in dev, this is what most of us want.
To change this, use e.g. RABBITMQ_LOG=info (previous default).

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-11 12:02:04 +00:00
Jean-Sébastien Pédron fa4b552a9b Update copyright (year 2020) 2020-03-10 15:26:49 +01:00
Jean-Sébastien Pédron 6d48b5f7d3 rabbitmq-run.mk: Set Ra's wal_sync_method to `sync`
This turns off WAL preallocation and saves 400+ MiB per node directory.

This setting only applies to nodes started with `make run-broker` or
from our testsuites. RabbitMQ default configuration remains unaffected.
2020-03-09 13:03:12 +01:00
Jean-Sébastien Pédron 979b6f6972 rabbitmq-dist.mk: Change the condition again to match $(PORJECT) instead
Using dependencies seemed sensible in the first place, but they are also
special cases like `rabbit` itself. In the end, it looks simpler to just
list rabbitmq-common and rabbitmq-amqp1.0-common in a blacklist and
install CLI for everything else.
2020-03-06 14:04:22 +01:00
Jean-Sébastien Pédron 7a8c74f617 rabbitmq-dist.mk: Consider $TEST_DEPS when installing CLI (or not)
Follow-up to commit 0e5e25d961.
2020-03-06 12:41:08 +01:00
Jean-Sébastien Pédron 0e5e25d961 rabbitmq-dist.mk: Don't install CLI if the project dost not depend on `rabbit`
This is the case of rabbitmq-common and rabbitmq-amqp1.0-common for
instance.
2020-03-06 12:25:12 +01:00
Gerhard Lazu 46ef666075 Use dev prometheus.erl in RabbitMQ master (3.9.x)
We want to test PRs such as
https://github.com/deadtrickster/prometheus.erl/pull/102
in RabbitMQ master (3.9.x) so that we can test fixes against other
master components, like OTP 23 (erlang-git).

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-06 09:04:07 +00:00
Gerhard Lazu 8fb9ce1450 Merge pull request #359 from rabbitmq/erlang-mk-query-deps
Add erlang.mk query-deps
2020-03-06 09:01:13 +00:00
Gerhard Lazu 24eb242135 Add erlang.mk query-deps* family of targets
After checking out this branch, run the following command in the
umbrella:

    make update-erlang-mk

This will enable the following command across all RabbitMQ deps:

    make query-deps

And this is what the output for one such dependency looks like:

    pwd
    /Users/gerhard/github.com/rabbitmq/3.9.x/deps/rabbitmq_management

    make query-deps
    rabbitmq_management: ranch hex https://hex.pm/packages/ranch 1.7.1
    rabbitmq_management: rabbit_common git_rmq https://github.com/rabbitmq/rabbitmq-common master
    rabbitmq_management: rabbit git_rmq https://github.com/rabbitmq/rabbitmq-server master
    rabbitmq_management: amqp_client git_rmq https://github.com/rabbitmq/rabbitmq-erlang-client master
    rabbitmq_management: cowboy hex https://hex.pm/packages/cowboy 2.6.1
    rabbitmq_management: cowlib hex https://hex.pm/packages/cowlib 2.7.0
    rabbitmq_management: rabbitmq_web_dispatch git_rmq https://github.com/rabbitmq/rabbitmq-web-dispatch master
    rabbitmq_management: rabbitmq_management_agent git_rmq https://github.com/rabbitmq/rabbitmq-management-agent master
    rabbit_common: rabbitmq_codegen git_rmq https://github.com/rabbitmq/rabbitmq-codegen master
    rabbit_common: lager hex https://hex.pm/packages/lager 3.8.0
    rabbit_common: jsx hex https://hex.pm/packages/jsx 2.9.0
    rabbit_common: ranch hex https://hex.pm/packages/ranch 1.7.1
    rabbit_common: recon hex https://hex.pm/packages/recon 2.5.0
    rabbit_common: credentials_obfuscation hex https://hex.pm/packages/credentials_obfuscation 1.1.0
    lager: goldrush git https://github.com/DeadZen/goldrush.git 0.1.9
    rabbit: rabbitmq_cli git_rmq https://github.com/rabbitmq/rabbitmq-cli master
    rabbit: syslog git https://github.com/schlagert/syslog 3.4.5
    rabbit: cuttlefish hex https://hex.pm/packages/cuttlefish 2.2.0
    rabbit: ranch hex https://hex.pm/packages/ranch 1.7.1
    rabbit: lager hex https://hex.pm/packages/lager 3.8.0
    rabbit: rabbit_common git_rmq https://github.com/rabbitmq/rabbitmq-common master
    rabbit: ra git https://github.com/rabbitmq/ra.git master
    rabbit: sysmon_handler hex https://hex.pm/packages/sysmon_handler 1.2.0
    rabbit: stdout_formatter hex https://hex.pm/packages/stdout_formatter 0.2.2
    rabbit: recon hex https://hex.pm/packages/recon 2.5.0
    rabbit: observer_cli hex https://hex.pm/packages/observer_cli 1.5.3
    rabbitmq_cli: rabbit_common git_rmq https://github.com/rabbitmq/rabbitmq-common master
    rabbitmq_cli: observer_cli hex https://hex.pm/packages/observer_cli 1.5.3
    observer_cli: recon hex https://hex.pm/packages/recon 2.5.0
    cuttlefish: getopt hex https://hex.pm/packages/getopt 1.0.1
    cuttlefish: lager hex https://hex.pm/packages/lager 3.7.0
    ra: elvis_mk git https://github.com/inaka/elvis.mk.git master
    ra: aten hex https://hex.pm/packages/aten 0.5.3
    ra: gen_batch_server hex https://hex.pm/packages/gen_batch_server 0.8.2
    amqp_client: rabbit_common git_rmq https://github.com/rabbitmq/rabbitmq-common master
    cowboy: cowlib git https://github.com/ninenines/cowlib 2.7.0
    cowboy: ranch git https://github.com/ninenines/ranch 1.7.1
    rabbitmq_web_dispatch: rabbit_common git_rmq https://github.com/rabbitmq/rabbitmq-common master
    rabbitmq_web_dispatch: rabbit git_rmq https://github.com/rabbitmq/rabbitmq-server master
    rabbitmq_web_dispatch: cowboy hex https://hex.pm/packages/cowboy 2.6.1
    rabbitmq_management_agent: rabbit_common git_rmq https://github.com/rabbitmq/rabbitmq-common master
    rabbitmq_management_agent: rabbit git_rmq https://github.com/rabbitmq/rabbitmq-server master

re https://github.com/ninenines/erlang.mk/pull/875

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-05 15:10:37 +00:00
Jean-Sébastien Pédron cb432fd664 rabbitmq-tools.mk: Only update `.travis.yml` if branches match
... between the current project and rabbitmq-common.

Like with `rabbitmq-components.mk`, this avoids to use an incorrect copy
if the current project uses a different branch or does not have e.g. a
`v3.8.x` branch (unlike rabbitmq-common).
2020-03-04 16:15:48 +01:00
Jean-Sébastien Pédron 54e290683d Travis CI: Set $current_rmq_ref based on Travis variables
We need to communicate this information to rabbitmq-components.mk so it
selects the right branch for each dependency.

By default, it would query git(1), but after Travis clones and possibly
merges branches, it does not have access to the information anymore.
Forunately, the Travis environment has everything we need.

$base_rmq_ref was already set properly in a previous commit.

If Travis is building a tag, $TRAVIS_BRANCH will contain the appropriate
value, so this works in this case as well.

We now also check if `rabbitmq-components.mk` is up-to-date.
2020-03-04 13:32:57 +01:00
Jean-Sébastien Pédron ec93c7dce3 Travis CI: Ensure Elixir is installed
To do so, we set the language to Elixir, even though almost all our
projects are written in Erlang. But we need Elixir for the RabbitMQ CLI.

Specifying Elixir as the language in Travis allows us to:
1. make sure Elixir is installed by Travis
2. specify the versions of both Erlang/OTP and Elixir

We also set an explicit install step. Not that we care about `mix
local.hex`, but we need to override the default Travis install step
which assumes this is an Elixir (mix) based project.

We take this opportunity to add Erlang/OTP 22.2 to the build matrix.

While here, we bring two fixes:
* Warnings reported by Travis are solved: the OS is set explicitly and
  `sudo` is removed.
* The "git checkout" gymnastic is replaced by simply setting
  `$base_rmq_ref`. This is a better solution to make sure the
  appropriate dependencies' branch is selected.
2020-03-04 10:51:21 +01:00
Jean-Sébastien Pédron 5dc227a6eb rabbitmq-run.mk: Skip builds in `make run-broker NOBUILD=1`
This can allow for faster RabbitMQ startup time when we know there is
nothing to compile.
2020-03-03 18:33:46 +01:00
Jean-Sébastien Pédron 15c47804ec rabbitmq-tools.mk: Don't add .travis.yml is there none in the first place
One has to manually add it the first it is used in a project.
2020-03-03 18:32:48 +01:00
Michael Klishin 2305b23cd9 Avoid using erlang:get_stacktrace/0 for improved OTP 23/24 compat 2020-02-27 22:25:46 +03:00
Jean-Sébastien Pédron dea423ad36 rabbit_env: Add `$RABBITMQ_CONFIG_FILES`
It is used to specify additional configuration files when using the
Cuttlefish format.

[#171491267]
2020-02-26 15:35:57 +01:00
Jean-Sébastien Pédron 3aa7dd1adb rabbit_env: Add $RABBITMQ_{PRODUCT_NAME,PRODUCT_VERSION,MOTD_FILE}
They are used to override the product name and version, and expand the
banners which are printed and logged on startup.

[#170054940]
2020-02-20 17:48:54 +01:00
Jean-Sébastien Pédron 7638a5439f rabbitmq-run.mk: Set console log level to debug
Exactly as we previously set the file log level to debug.

Note that it does not enable logging on the console, it only changes the
default log level if the user of `make run-broker` enables console
logging (using `make run-broker RABBITMQ_LOGS=-`).

[#171131596]
2020-02-13 09:54:45 +01:00
Gerhard Lazu f80c456370 Bump prometheus.erl & observer_cli to latest
Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-02-11 15:57:23 +00:00
Jean-Sébastien Pédron ca844d994b Merge pull request #354 from rabbitmq/extract_sd_notify
Remove systemd_notify_socket
2020-02-10 15:24:33 +01:00
Michael Klishin cf52b22f37 Transitonal step for OTP 23 [master] compat 2020-02-09 23:47:46 +03:00
Michael Klishin 4be3ff3f14 rabbit_misc:sort_field_table/1: support map arguments
This is convenient when working with objects deserialised
from JSON definitions.
2020-02-08 01:22:10 +03:00
Philip Kuryloski bc7e8e19f2 Remove systemd_notify_socket
The env var is now handled directly by rabbitmq_prelaunch rabbit_boot_state_systemd
2020-02-07 10:46:17 +01:00
Jean-Sébastien Pédron 994d0d4116 rabbit_env_SUITE: Check if $RABBITMQ_FEATURE_FLAGS is overridden
This happens when testing mixed-versions cluster in CI. This fixes the
test after commit 23a0a07e3a.

[#170149339]
2020-02-04 15:19:37 +01:00
Jean-Sébastien Pédron 780dd0de40 rabbit_env: Set $RABBITMQ_ENABLED_PLUGINS to an empty string to disable all plugins
The previous value accepted for this behavior was "NONE". But it's more
intuitive to set it to nothing.

`rabbitmq-run.mk` is also updated to allow `$RABBITMQ_ENABLED_PLUGINS`
to be overriden e.g. on the command line.
2020-01-24 12:54:43 +01:00
Jean-Sébastien Pédron ad8dbdaed6 rabbit_nodes_common: New name_type/1 function
It guesses the node name type, based on the host part of a node name.
I.e., if it contains at least a `.` character, it's a longname.

This matches the verification `net_kernel` does to make sure the node
name corresponds to the shortnames/longnames option.
2020-01-22 12:05:15 +01:00
Jean-Sébastien Pédron 82192ad881 rabbit_env: Improve how we locate the plugins directory
There are two changes in this patch:

1. In `get_default_plugins_path_from_node(), we base the search on
   `rabbit_common.app` instead of `code:lib_dir(rabbit_common)`.
   The latter only works if the application directory is named
   `rabbit_common` or `rabbit_common-$version`. This is not the case
   with a default Git clone of the repository because the directory will
   be named `rabbitmq-common`.

   Using `rabbit_common.app` is fine because it is inside the `ebin`
   directory, as all modules. It also brings another benefit: it is not
   subject to cover-compilation or preloading (which both get rid of the
   original module location).

2. The code to determine the plugins directory based on the directory
   containing the module (or `rabbit_common.app`) now takes into account
   plugin directories (as opposed to .ez archives). In this case, there
   is one less path component compared to an .ez archive.
2020-01-21 14:50:07 +01:00
Jean-Sébastien Pédron 23a0a07e3a rabbit_env: Record variables' origin
I.e. we record the fact that a particular value:
  * is the default value, or
  * comes from an environment variable, or
  * comes from querying a remote node

This required a significant refactoring of the module, which explains
the large diff.

At the same time, the testsuite was extended to cover more code and
situations.

This work permits us to move remaining environment variables checked by
`rabbit` to this module. They include:
  * $RABBITMQ_LOG_FF_REGISTRY
  * $RABBITMQ_FEATURE_FLAGS
  * $NOTIFY_SOCKET

[#170149339]
2020-01-21 12:46:06 +01:00
Jean-Sébastien Pédron 972643a99d rabbit_env: Fix an error reported by Dialyzer
value_is_yes() is always called with a string as argument.
2020-01-21 12:02:54 +01:00
Jean-Sébastien Pédron 006c4f3895 rabbitmq-dist.mk: Don't install CLI when testing rabbitmq-common
We don't need the CLI in this case and this would be a dependency
circle: rabbitmq-common <- rabbitmq-cli <- rabbitmq-common.
2020-01-21 12:02:54 +01:00
Jean-Sébastien Pédron 6331123a54 include/rabbit.hrl: Plugins' dependencies are a list of atom()
... not a list of tuples.
2020-01-16 11:48:37 +01:00
Jean-Sébastien Pédron 96ffc4bc3b Sort feature_flags/federation log categories alphabetically 2020-01-13 18:37:07 +01:00
Jean-Sébastien Pédron 39064b3d64 Add `rabbit_log_feature_flags` log category 2020-01-13 17:01:27 +01:00
Jean-Sébastien Pédron 5e4d4af150 rabbit_misc: Add `rabbitmq_related_module_attributes/0`
Compared to `all_module_attributes/0`, it only scans applications which
are related to RabbitMQ: either a RabbitMQ core application or a plugin
(i.e. an application which depends on `rabbit`).

On my laptop, this significantly reduce the time to query module
attributes in the case of feature flags: it goes from 830 ms to 235 ms
just by skipping all Erlang/OTP applications are third-party
dependencies.

This makes a small improvement to RabbitMQ startup time, which is
visible for developers mainly, not for a production instance.
2020-01-13 16:59:07 +01:00
Michael Klishin 818362766d (c) bump
(cherry picked from commit 013ba83abcce06c52c12e2a41e728c1e2399be60)
2019-12-29 05:55:51 +03:00
Michael Klishin 4e5123c1de rabbit_writer state: gc_threshold => writer_gc_threshold, references #343 2019-12-24 23:40:42 +03:00
Michael Klishin d64dcc0a29 Bump default GC threshold to the same 1GB 2019-12-20 08:03:28 +03:00
Michael Klishin d5f67e1f9f Merge branch 'configurable_gc_threshold' of https://github.com/nyczol/rabbitmq-common into nyczol-configurable_gc_threshold 2019-12-20 03:34:11 +03:00
Jean-Sébastien Pédron 6ba6dd63f5 Merge pull request #344 from rabbitmq/lrb-mqtt-stomp-start-cluster
Add MQTT and STOMP port calc to start-cluster
2019-12-18 11:41:34 +01:00
Luke Bakken 101371778a Remove RABBITMQ_GENERATED_CONFIG_DIR
No longer applies after merge of rabbitmq/rabbitmq-server#2180
2019-12-16 11:00:12 -08:00
Jean-Sébastien Pédron e0ea1432ca rabbitmq-tools.mk: Add `sync-gitignore-from-master` helper
To be used in branches other than `master`. It will take `.gitignore`
from master and replace the current copy with it.

Like a few other targets, it supports `DO_COMMIT=yes` to commit the
change as well.
2019-12-13 14:40:59 +01:00
Luke Bakken edf8f892d4 Add MQTT and STOMP port calc to start-cluster 2019-12-12 07:35:38 -08:00
Jean-Sébastien Pédron 179d1657a8 rabbitmq-components.mk: Locate Umbrella relative to $(APPS_DIR)/my_app as well
When we are running Makefile recipes from an application under
`$(APPS_DIR)`, we want to locate the Umbrella correctly to:
- set `$(DEPS_DIR)` accordingly
- prevent `make distclean` from removing `$(DEPS_DIR)`

Before this change and after `rabbit/apps/rabbitmq_prelaunch` was added,
running `make distclean` in `rabbit` removed everything under
`$(DEPS_DIR)`.
2019-12-12 13:04:23 +01:00
Jean-Sébastien Pédron 0fb6f466e4 rabbit_env: Fix typo in comment about Dialyzer 2019-12-12 13:01:09 +01:00
Jean-Sébastien Pédron e5b3d45726 rabbit_env: Fix Dialyzer warnings
There was one legitimate warning in `get_enabled_plugins()`:
`get_prefixed_env_var()` already takes care of converting an empty
string to false.

The other warning is because `loading_conf_env_file_enabled()` returns a
boolean when compiled for tests, but always true when compiled for
production. Dialyzer only sees the second case and thinks the cases
where the function returns false will never happen.
2019-12-12 12:18:41 +01:00
ANycz e31131dca1 make garbage collector threshold configurable 2019-12-11 21:35:53 +01:00
Jean-Sébastien Pédron a7a305dca2 include/rabbit.hrl: Move Erlang/OTP required versions to `rabbitmq_prelaunch` 2019-12-11 14:45:39 +01:00
Jean-Sébastien Pédron 90d5c28445 rabbitmq-dist.mk: Empty `$(DIST_AS_EZS)` to distribute plugins as dirs
... instead of `.ez` archives.

The default is still to create `.ez` archives for all RabbitMQ
components & plugins.

However if `$(USE_RABBIT_BOOT_SCRIPT)` is set (experimental and
undocumented for now), they are distributed as directories.
2019-12-11 14:45:39 +01:00
Jean-Sébastien Pédron e2f4fc3e04 rabbitmq-run.mk: Don't run rabbitmq-plugins(8) to enable plugins
This is handled by the `rabbitmq_prelaunch` application now, based on
the value of `$RABBITMQ_ENABLED_PLUGINS`.

`$(RABBITMQ_ENABLED_PLUGINS_FILE)` depended on `dist`. This dependency
was moved to individual `run-*` and `start-*` targets.

While here, re-use `test-dist` instead of `dist` if the build was
already done for tests.

The testsuites default to run `make test-dist` as a first step.
Therefore later, when it starts a node, it should re-use that instead of
depending on `make dist` which will rebuild the tested project and
remove test dependencies from plugins.

This is useful (and mandatory in fact) now that `rabbit` is packaged
like plugins because, in the case of rabbitmq-erlang-client for
instance, the broker is a `$(TEST_DEPS)`: if starting a node runs `make
dist`, the broker will be removed.
2019-12-11 14:45:39 +01:00
Jean-Sébastien Pédron 12d48ff717 rabbitmq-dist.mk: Fix concurrent runs of `make {,test-}dist` and `make install-cli`
The fix depends on the presence of lockf(1) or flock(1).
2019-12-11 14:45:39 +01:00
Jean-Sébastien Pédron 5840834fa8 rabbitmq-dist.mk, rabbitmq-run.mk: Copy scripts & escripts
... to the plugin being worked on, instead of locating `rabbit` and
taking the scripts there.

It greatly simplifies the use of RabbitMQ and plugins inside a
development working copy because the layout is closer to what we would
have in a package. I.e. there are far less special cases.
2019-12-11 14:45:39 +01:00
Jean-Sébastien Pédron 405f86f39b rabbitmq-dist.mk: Create an .ez archive for `rabbit` too
The goal is to distribute RabbitMQ core (the `rabbit` Erlang
application) exactly as we distribute plugins. This simplifies the
startup script and CLI tools when we have to setup Erlang code search
path.
2019-12-11 14:45:39 +01:00
Jean-Sébastien Pédron 11c29bfb29 Add `rabbit_log_prelaunch` log category
While here, sort categories alphabetically and add missing ones to the
declared type().
2019-12-11 14:45:38 +01:00
Jean-Sébastien Pédron 77b655bc71 rabbit_env: New module to prepare context based on environment
... and default values.

It can also query a remote node for some specific values. The use case
is the CLI which should know what the RabbitMQ node it controls uses
exactly.

It supports several new environment variables:

  RABBITMQ_DBG:
    Used to setup `dbg` for some simple tracing scenarios.

  RABBITMQ_ENABLED_PLUGINS:
    Used to list plugins to enable automatically on node startup.

  RABBITMQ_KEEP_PID_FILE_ON_EXIT:
    Used to indicate if the PID file should be removed or kept when the
    node exits.

  RABBITMQ_LOG:
    Used to configure the global and per-category log levels and enable
    ANSI colors.
2019-12-11 14:45:35 +01:00
Jean-Sébastien Pédron 5b13de0927 rabbitmq-dist.mk: Ensure `make test-dist` is not always out-of-date
`ebin/test` is always touch(1)'d by Erlang.mk, which made the list of
dependencies of an .ez archive newer than the archive itself. This caused the
archive to be recreated.

While here, set `TEST_DIR` to something random in the case of `make
test-dist`: this way, rebuilding all testsuites is skipped by Erlang.mk.
Yes, this is a hack.
2019-12-05 14:54:16 +01:00
Jean-Sébastien Pédron ba498049ed rabbit_misc: Use PowerShell to check process aliveness on Windows
At least on the Windows Server 2019 AWS EC2 image, the `tasklist`
command is unavailable.

If that's the case, we fallback to using a PowerShell oneliner. It's not
the default, just in case PowerShell is unavailable.
2019-12-05 12:29:41 +01:00
Jean-Sébastien Pédron da3e784a7a rabbitmq-build.mk: Don't add Elixir lib dir to `$ERL_LIBS`
This is now done in xrefr (`mk/xrefr`) and rabbimq-ct-helpers when
needed.

This has several benefits:
  * This fixes `make run-broker` on Windows because the computed
    `$ERL_LIBS` was invalid there.
  * This saves a lot of Makefile processing time, because elixir(1) is
    quite slow to startup. On my laptop, a complete build in
    rabbitmq-server-release from 8.5 seconds to 3 seconds.
2019-12-05 12:29:30 +01:00
Michael Klishin 388f514e1a rabbit_misc:append_rpc_all_nodes/4: wrap non-list return values
into a list, as the function implies.

All current call sites use it to call functions that return lists.
However, rabbitmq/rabbitmq-cli#389 breaks this cycle.
2019-12-05 06:50:15 +03:00
Luke Bakken decd320133 Merge pull request #340 from rabbitmq/lrb-epmd-starter-tweak
epmd-starter improvements
2019-11-19 10:18:22 -08:00
Michael Klishin 5784240b99 Extract parse_bool/1 and parse_int/1 from rabbit_mgmt_util
A follow-up to rabbitmq/rabbitmq-management#749.
2019-11-19 19:10:48 +03:00
Michael Klishin 4361cd6ddf Merge pull request #339 from rabbitmq/rabbitmq-management-749
Move some helpers from rabbitmq-management
2019-11-19 02:27:13 +03:00
Luke Bakken b4b7549ad3 Special-case x-queue-type classic/undefined
Fixes #341
2019-11-15 13:33:43 -08:00
Luke Bakken 7eb5b3c5d5 epmd-starter improvements
* Use `noinput`
* Use `-s erlang halt` to skip small `eval` overhead
* Use `no_dot_erlang` boot file since we do not want user customizations to interfere
2019-11-14 10:40:44 -08:00
Michael Klishin 5aef852257 Move some helpers from rabbitmq-management
Part of rabbitmq/rabbitmq-management#749.
2019-11-12 03:07:14 +03:00
Michael Klishin d0384fabfe Merge branch 'master' into reserve-qq-file-handles 2019-10-24 11:57:40 +03:00
Yury.Alioshinov 80dc973aae add forgotten ldap type 2019-10-20 23:38:52 +03:00
Michael Klishin f03f4886c3 Naming 2019-10-17 00:07:42 +03:00
dcorbacho 2c56e75158 Reserve the 3 fixed ra file handles
[#169063174]
2019-10-16 10:44:21 +01:00
dcorbacho df0f34d1cb Reserve file handles for quorum queues
These should be taken into account into the limits, but always be granted.
Files must be reserved by the queues themselves using `set_reservation/0` or
`set_reservation/1`. This is an absolute reservation that increases or
decreases the number of files reserved to reach the given amount on every
call.

[#169063174]
2019-10-15 15:16:10 +01:00
Michael Klishin 6798bc3575 Make license line in startup banner more specific 2019-10-04 20:12:44 +03:00
Jean-Sébastien Pédron 2625f43086 rabbitmq-run.mk: Fix generated rabbitmq-server configuration
To configure the AMQP TCP listener, the key is `tcp_listeners`, not
`listeners`.
2019-09-13 13:47:16 +02:00
kjnilsson 353382c94e Change Ra dep back to git master
To more easily align RabbitMQ and Ra developement
2019-09-13 09:23:33 +01:00
kjnilsson 44d01eb9d0 update ra dep 2019-09-04 11:02:03 +01:00
Jean-Sébastien Pédron ad52a23bb5 rabbitmq-run.mk: Set $RABBITMQ_BASE
Otherwise on Windows, the broker may read system files: this would
pollute the test environment.
2019-09-03 18:14:38 +02:00
Jean-Sébastien Pédron 3dd58ae12a rabbitmq-run.mk: Bump `rabbitmqctl wait` timeout from 10 to 60 seconds
... when we wait for a node started in the background.

This helps when the PID is written asynchronously by the Erlang node
instead of the rabbitmq-server(8) script: in this case, the `rabbitmqctl
wait` command may start to wait earlier in the former situation than the
latter one, and thus timeout earlier.
2019-09-03 18:10:48 +02:00
Jean-Sébastien Pédron f6780f1bec rabbitmq-dist.mk: Sort files inside the .ez archives
This helps with reproducible builds.
2019-09-03 18:10:39 +02:00
Jean-Sébastien Pédron bb5022ccec rabbitmq-dist.mk: Ensure rsync(1) arg is a Unix-like path
On Windows, if we pass it a Windows-native path like `C:\User\...` or
even something with forward slashes, rsync(1) will consider that `C`
(before the colon) is a hostname and it should try to connect to it.

Using `cygpath.exe` on Windows converts the Windows path to a Unix-like
one (e.g. `/c/Users/...`).
2019-09-03 12:02:20 +02:00
Michael Klishin c5df5043e9 rabbit_types:vhost/0 now delegates to vhost:name/0
[#166298298]
2019-08-30 10:58:34 +02:00
Diana Corbacho b94e01c90c The vhost record moved to a versioned record in rabbitmq-server
Add metadata to virtual hosts

[#166298298]

rabbit_vhost: use record defaults

The vhost record moved to a versioned record in rabbitmq-server

Co-Authored-By: Michael Klishin <mklishin@pivotal.io>
2019-08-30 10:19:50 +02:00
Jean-Sébastien Pédron a1fb3fcc37 Update erlang.mk 2019-08-29 20:44:37 +02:00
Michael Klishin 735c47eca9 Depend on credentials_obfuscation 1.1.0 2019-08-20 13:21:40 +10:00
Michael Klishin 91dd7dd1ab A typo 2019-08-20 13:13:07 +10:00
Michael Klishin b4990145de Use credentials_obfuscation from Hex 2019-08-20 13:10:07 +10:00
Michael Klishin b7f3114ebd Merge pull request #334 from rabbitmq/optimise-erlang-timers
Replace timer:send_after/3 by erlang:send_after/3
2019-08-17 08:45:29 +10:00
Michael Klishin 485888bbcd Switch to eunit macros for assertions 2019-08-17 05:47:42 +10:00
codeadict 5fb17b0943 Add stop{1,3} functions to gen_server2
These functions utilize proc_lib:stop, which in turn utilizes sys:terminate.

They were introduced in
9d7d1207ff.

Closes: #266
2019-08-16 12:14:48 -04:00
Diana Corbacho b580595ea4 Replace timer:send_after/3 by erlang:send_after/3
[#167926549]
2019-08-16 15:29:38 +01:00
Michael Klishin 65675b5f1f Merge pull request #332 from rabbitmq/rabbitmq-erlang-client-123-crypted-password-in-state
Enable credential obfuscation
2019-08-16 12:14:33 +10:00
Jean-Sébastien Pédron 57c14b1214 rabbitmq-{build,run,tools}.mk: Pass several variables to sub-makes
This saves a lot of time because:
1. we don't spawn a shell each time to compute the same value;
2. elixir(1) has a long startup time.

In my tests, a no-op gmake in `rabbit` goes from 2.5 seconds to 0.9
seconds.
2019-08-14 11:29:07 +02:00
Jean-Sébastien Pédron 79d7969c16 rabbitmq-run.mk: No need to find erl_call(1)
We don't use it anymore in the Makefiles. This speeds up the build
because we don't spawn a shell for something useless in the end.
2019-08-14 11:27:06 +02:00
Jean-Sébastien Pédron 16b702e0ca rabbitmq-run.mk: Use GNU Make functions to prepare $(DIST_ERL_LIBS)
... instead of Unix commands and a one-liner which assumes that `:` is
the path separator. This speeds up the build because we don't spawn a
shell.

While here, also remove `$(APPS_DIR)` from `$(ERL_LIBS)`.
2019-08-14 11:25:27 +02:00
Arnaud Cogoluègnes e4a935c49f Use credentials obfuscation application
rabbit_pbe is now delegating calls to the credentials obfuscation
app/library.

[#167070941]

References rabbitmq/rabbitmq-erlang-client#123
2019-08-13 09:50:25 +02:00
Arnaud Cogoluègnes dceeee8e31 Merge branch 'master' into rabbitmq-erlang-client-123-crypted-password-in-state 2019-08-12 14:02:09 +02:00
Michael Klishin 407cbfd503 Bump Lager to 3.8.0 2019-08-11 01:47:34 +10:00
Jean-Sébastien Pédron 0b20c2dd6b rabbitmq-tools.mk: Fix tags counting in `commits-since-release`
We have to apply the same tag filtering when counting them as the one
done by git-describe(1).

This fixes the following error:

    fatal: No names found, cannot describe anything

This issue was hit when there were tags in the project, but they were
all filtered out by git-describe(1).
2019-08-09 11:00:15 +02:00
Jean-Sébastien Pédron 205042d593 Update erlang.mk 2019-08-02 09:53:18 +02:00
Michael Klishin f2e147b025 Bump observer_cli and sysmon_handler deps 2019-08-01 17:11:57 +03:00
Arnaud Cogoluègnes 9f98340fd2 Add credentials obfuscation module
WIP, the secret is hardcoded, which is obviously not secured. It is
enough though to see if modules/applications manipulating credentials
can use it to avoid those credentials to end up in logs when the state
of crashed processes is dumped.

[#167070941]

References rabbitmq/rabbitmq-erlang-client#123
2019-07-29 16:09:40 +02:00
Jean-Sébastien Pédron 4af40e2d25 rabbitmq-run.mk: Compute MQTT and STOMP TCP ports for `run-broker`
They are based on `$(RABBITMQ_NODE_PORT)`, like the management plugin's
computed port.
2019-07-26 13:20:57 +02:00
Arnaud Cogoluègnes d01011d0f5 rabbitmq-tools.mk: Handle RabbitMQ components without tags
... in `commits-since-release`.

Before this change, the script was expecting at least one tag so that
git-describe(1) worked. Without that, it would fail with:

fatal: No names found, cannot describe anything.

Now, if a component has no tag, it will display "New in this release!".

Patch from @dumbbell
2019-07-12 16:53:05 +02:00
Arnaud Cogoluègnes b9a7be7e64 Add OAuth 2 plugin to rabbitmq-components.mk 2019-07-09 16:04:48 +02:00
Arnaud Cogoluègnes 80c8a09c3b Merge pull request #331 from rabbitmq/oauth2-credential-expiration-support
Support client-driven refresh of expiring credentials
2019-07-04 10:57:24 +02:00
Jean-Sébastien Pédron ed3dba3670 rabbitmq-dist.mk: Don't assume the plugin lives in `$(DEPS_DIR)`
The application to "package" as a plugin (an .ez archive) might be under
`$(APPS_DIR)`. Therefore now, the all the variables and recipes are
created from the path to the application not just its name.
2019-07-01 14:41:53 +02:00
Arnaud Cogoluègnes 55e7881c4a Merge branch 'master' into oauth2-credential-expiration-support 2019-07-01 11:42:37 +02:00
Jean-Sébastien Pédron e887709ada rabbitmq-dist.mk: Exclude `ebin/dep_built` from the files to distribute in plugins
This file is useful at build time only (for Erlang.mk) and it breaks the
build of the .ez archive otherwise.
2019-06-28 23:48:43 +02:00
Jean-Sébastien Pédron 8d1e9ce40a Update erlang.mk 2019-06-28 16:01:30 +02:00
Jean-Sébastien Pédron 095294be04 rabbitmq-components.mk: Force rebuild of all RabbitMQ components
With the update of Erlang.mk, dependencies are not rebuilt anymore by
default, except if `FULL=1` is set.

This behavior is not adapted to the work on RabbitMQ where many
components are split into many repositories, and we work on several of
them at the same time.

Therefore, the idea of this commit is to tell Erlang.mk to always visit
dependencies which are RabbitMQ components. Other dependencies are only
built once the first time.

[#166980833]
2019-06-28 15:54:23 +02:00
Jean-Sébastien Pédron 89a188c4e9 rabbitmq-mix.mk: Moved to rabbitmq-server-release 2019-06-26 18:49:40 +02:00
Jean-Sébastien Pédron f12002e2f3 rabbitmq-*test.mk: Fix latest regressions on our side w.r.t *-on-concourse
Unfortunately, the *-on-concourse targets still don't work: fly(1), the
Concourse CLI, looks to have regressed even more: it doesn't upload all
inputs. Half of them are just empty directories.

Obviously, compiling anything fails because if this.
2019-06-25 18:23:54 +02:00
Michael Klishin 10b4cb1c48 WIP: credential expiration support prototyping 2019-06-22 18:40:01 +03:00
D Corbacho 683bed4802 Merge pull request #329 from rabbitmq/rabbitmq-server-2030
Make default worker pool size configurable
2019-06-13 15:14:43 +01:00
Michael Klishin 29c933a4cd Make default worker pool size configurable
Part of rabbitmq/rabbitmq-server#2030.
2019-06-13 16:55:16 +03:00
Michael Klishin dd6e521204 New Lager sink for Shovel
References rabbitmq/rabbitmq-shovel#60.

[#166627333]
2019-06-12 18:33:21 +03:00
Michael Klishin cb42235776 Merge branch 'master' into rabbitmq-server-1767-protocol-specific-ctx-in-authn-authz 2019-06-07 19:53:26 +03:00
Gerhard Lazu a4b5953d78 Update rabbitmq-components.mk 2019-06-03 02:24:18 +01:00
Arnaud Cogoluègnes a930be7489 Modify authz to propagate protocol-specific context
References rabbitmq/rabbitmq-server#1767
2019-05-29 10:35:48 +02:00
Jean-Sébastien Pédron 6b16a1f2f5 rabbitmq-components.mk: Take observer_cli from Hex.pm 2019-05-17 15:17:48 +02:00
Michael Klishin b4feede8b2 observer_cli 1.5.0 2019-05-17 08:38:02 +03:00
Michael Klishin ef0d843ba5 Bump Recon 2.5.0 for Erlang 22 compat, depend on our fork of observer_cli that uses it 2019-05-16 23:22:26 +03:00
Michael Klishin 8ff556bde2 Depend on observer_cli 1.4.5 2019-05-14 11:46:38 +03:00
Michael Klishin 69598d36fb rabbitmq-components.mk: add observer_cli dependency
For rabbitmq/rabbitmq-cli#353 and rabbitmq/rabbitmq-server#2006.
2019-05-13 16:40:02 +03:00
Gerhard Lazu 05b3f9dedd Fix start-brokers / start-cluster make target
`-ra data_dir` is not necessary. It was also missing a \
2019-05-09 18:02:14 +01:00
Gerhard Lazu df416530ce Update prometheus to v4.3.0 to benefit from global_labels
deadtrickster/prometheus.erl#91
2019-05-01 13:13:58 +01:00
Luke Bakken 70d2020f81 Update rabbitmq-components.mk 2019-04-30 16:22:59 -07:00
Jean-Sébastien Pédron a0a044ce5e rabbit_pretty_stdout: Remove module
It was replaced by the external library, `stdout_formatter`, which is
based on this module.

[#164931055]
2019-04-30 14:33:27 +02:00
Jean-Sébastien Pédron 72cb6bbe6d rabbitmq-components.mk: Pin stdout_formatter version to 0.2.2
[#164931055]
2019-04-30 14:28:46 +02:00
Michael Klishin 9eb9686795 Merge branch 'master' into rabbitmq-erlang-client-91 2019-04-25 21:10:36 +03:00
Daniil Fedotov e9cd793eb4 Move rabbit_queue_collector to rabbit_common repo.
Collector is used by a connection supervisor, which may be on
the client side for direct connections.

Addresses rabbitmq-erlang-client#91
2019-04-23 16:47:23 -04:00
Michael Klishin a8495e1c30 channel_exchange_metrics now has one more metric: dropped unroutable messages
Part of rabbitmq/rabbitmq-server#1904.

[#165548314]
2019-04-23 23:22:58 +03:00
Gerhard Lazu 3bed6894d7 Merge branch 'rabbitmq-prometheus'
[#164376052]
2019-04-22 21:51:47 +01:00
Jean-Sébastien Pédron b0b2963023 rabbit_pbe: Default cipher's name depends on Erlang version
In Erlang 22, the name is now `aes_256_cbc`.

The default cipher/hash/iterations are also set in rabbit's application
default environment. I'm going to remove those default values there
because the code already queries this module if they are missing from
the application environment.
2019-04-19 16:03:52 +02:00
Jean-Sébastien Pédron 3d93ed3d90 rabbit_pbe: Use the new `crypto:supports/1` function in Erlang 22
This fixes a crash of the call to `crypto:cipher_info/1` later because
the ciphers list returned by `crypto:supports/0` contains more ciphers:
"old aliases" are added to that list and those aliases are unsupported
by `crypto:cipher_info/1`.
2019-04-19 11:28:40 +02:00
Michael Klishin 39528ba08b rabbit_misc: introduce rabbitmq_and_erlang_versions/0
Combines version/0 and otp_release/0 so that both can be retrieved
by rabbitmqctl cluster_status in one shot.
2019-04-19 04:10:42 +03:00
Gerhard Lazu fbe2ac4cdb Allow RABBITMQ_CONFIG_FILE make variable to be overwritten 2019-04-17 13:27:31 +01:00
Michael Klishin 6adeb6a220 rabbit_resource_monitor_misc:parse_information_unit/1: coerce input to a list
Elixir passes them in as Erlang binaries.
2019-04-16 17:10:02 +04:00
Michael Klishin a66df54b1a Revert "Clarify"
This reverts commit 7c9f170cee.

CLI tools cannot use this function as it logs errors.
`rabbit_resource_monitor_misc:parse_information_unit/1` is a better fit.
2019-04-16 16:11:22 +04:00
Michael Klishin 7c9f170cee Clarify 2019-04-16 16:02:10 +04:00
Gerhard Lazu 0e7a68cfc9 Add rabbitmq_prometheus dep
[#164376052]
2019-04-16 12:06:44 +01:00
Jean-Sébastien Pédron 052697a3e7 Merge pull request #323 from rabbitmq/blacklist-tls1.3-until-client-implementation-is-finished
rabbit_ssl_options: Blacklist TLS 1.3 until Erlang client implementation is finished
2019-04-11 14:11:58 +02:00
Jean-Sébastien Pédron 858bd20704 rabbit_ssl_options: Blacklist TLS 1.3 until Erlang client implementation is finished
Erlang 22 will introduce TLS 1.3, but at the time of this commit, only
the server side is implemented. If the Erlang client requests TLS 1.3, the
server will accept but the client will either hang or crash.

So for now, just blacklist TLS 1.3 to avoid any issues, even on the
server side, just to be safe.

[#165214130]
2019-04-11 14:02:52 +02:00
Loïc Hoguin 1755b82ca1 Don't support aes_ctr ciphers until OTP-22+ 2019-04-09 12:21:12 +02:00
Jean-Sébastien Pédron b90088f63c rabbit_misc: Generate a `NEW_PID_EXT`-based binary in compose_pid/4
The `creation` field might not fit into one byte which makes the
`PID_EXT` format unsuitable for this case.

The `NEW_PID_EXT` format is supported since Erlang 19.0, so it is safe
to always use it, no matter the value of `creation`, because RabbitMQ
3.7+ requires at least Erlang 19.3+.

References #313.
2019-04-08 11:35:31 +02:00
Michael Klishin f90e81610f Merge pull request #319 from rabbitmq/rabbit-common-318
Handle missing getconf command
2019-04-03 08:43:11 +03:00
Luke Bakken affc3b3991 Handle missing getconf command
Previous behavior is to crash, this is more forgiving

Fixes #318
2019-04-02 10:09:39 -07:00
Loïc Hoguin d077ea6a20 Support both PID_EXT and NEW_PID_EXT simultaneously 2019-04-02 14:23:04 +02:00
Michael Klishin 35cf0b48c3 Merge pull request #311 from rabbitmq/rabbitmq-auth-backend-cache-20
Cache vhost access requests using client IP address only
2019-04-01 02:29:07 +03:00
Jean-Sébastien Pédron d8dd5c623a Merge pull request #316 from rabbitmq/lxv-vm-memory-monitor-fix
vm_memory_monitor: handle KB as well as kB
2019-03-29 14:08:16 +01:00
kjnilsson c206aa0819 vm_memory_monitor: handle KB as well as kB
There are cases (e.g. inside LXC) where the unit reported in /proc/meminfo uses
KB instead of kB. Handle this case.
2019-03-29 11:12:47 +00:00
Michael Klishin 49b02019eb Dialyzer: disable no_match for decompose_pid/1
which has code matching on a constant conditional to OTP version.

Follow-up to #313.
2019-03-26 15:25:56 +03:00
Loïc Hoguin c0d58226c5 We don't support aes_ctr before OTP-22
The cipher was not available via the EVP interface before
Erlang/OTP-22.
2019-03-26 10:55:56 +01:00
Michael Klishin 16d4e55d90 Merge branch 'master' into new_pid_ext-otp22 2019-03-26 11:56:19 +03:00
Michael Klishin 42b8c32cf5 Merge pull request #308 from rabbitmq/improve-rabbit-pbe-otp22
Make rabbit_pbe work for OTP-22
2019-03-26 11:56:01 +03:00
Michael Klishin 774d92cc00 gen_server2: don't emit deprecation warnings on OTP 22
This is a transitional step to get rabbit_common to compile
on OTP 22.
2019-03-26 11:52:29 +03:00
Loïc Hoguin a35d8567b0 Support the NEW_PID_EXT format introduced in OTP-22
In OTP-22 the Creation field has been increased to be 32 bits.
For now we only need to handle it when using term_to_binary
and parsing the result manually.
2019-03-26 08:59:57 +01:00
Luke Bakken 1789c5fc5c Update authz_data type to include binaries 2019-03-25 14:46:52 -07:00
Luke Bakken 7889ad3425 Finish converting check_vhost_access/3 to new API 2019-03-22 13:10:27 -07:00
Luke Bakken a4767a772a Modify check_vhost_access/3 to use map of data
Part of rabbitmq/rabbitmq-auth-backend-cache#20
2019-03-22 07:21:59 -07:00
Jean-Sébastien Pédron 0d0cbadf6b rabbitmq-hexpm.mk: Always download the latest hexpm-cli
As of this commit, it should still be version 0.3.0.
2019-03-21 15:51:08 +01:00
Michael Klishin fb44b03d3b Update test expectations to match the change in 882876297b 2019-03-20 12:22:02 +03:00
Spring Operator 882876297b 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://erlang.org/doc/apps/erts/erl_ext_dist.html (200) with 1 occurrences could not be migrated:
   ([https](https://erlang.org/doc/apps/erts/erl_ext_dist.html) result ConnectTimeoutException).
* http://erlang.org/doc/man/erlang.html (200) with 1 occurrences could not be migrated:
   ([https](https://erlang.org/doc/man/erlang.html) result ConnectTimeoutException).
* 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://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://erldb.org (UnknownHostException) with 1 occurrences migrated to:
  https://erldb.org ([https](https://erldb.org) result UnknownHostException).
* http://host (UnknownHostException) with 1 occurrences migrated to:
  https://host ([https](https://host) result UnknownHostException).
* http://host:port/foo (UnknownHostException) with 2 occurrences migrated to:
  https://host:port/foo ([https](https://host:port/foo) result UnknownHostException).
* http://www.cs.indiana.edu/~burger/fp/index.html (301) with 1 occurrences migrated to:
  https://cs.indiana.edu/~burger/fp/index.html ([https](https://www.cs.indiana.edu/~burger/fp/index.html) 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://en.wikipedia.org/wiki/X86-64 with 1 occurrences migrated to:
  https://en.wikipedia.org/wiki/X86-64 ([https](https://en.wikipedia.org/wiki/X86-64) 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://lukego.livejournal.com/6753.html with 1 occurrences migrated to:
  https://lukego.livejournal.com/6753.html ([https](https://lukego.livejournal.com/6753.html) result 200).
* http://ninenines.eu with 6 occurrences migrated to:
  https://ninenines.eu ([https](https://ninenines.eu) result 200).
* http://semver.org/ with 1 occurrences migrated to:
  https://semver.org/ ([https](https://semver.org/) 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.erlang.org/ with 2 occurrences migrated to:
  https://www.erlang.org/ ([https](https://www.erlang.org/) result 200).
* http://www.mail-archive.com/asn1@asn1.org/msg00460.html with 1 occurrences migrated to:
  https://www.mail-archive.com/asn1@asn1.org/msg00460.html ([https](https://www.mail-archive.com/asn1@asn1.org/msg00460.html) 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/amqp-0-9-1-errata.html with 1 occurrences migrated to:
  https://www.rabbitmq.com/amqp-0-9-1-errata.html ([https](https://www.rabbitmq.com/amqp-0-9-1-errata.html) result 200).
* http://www.rabbitmq.com/memory.html with 1 occurrences migrated to:
  https://www.rabbitmq.com/memory.html ([https](https://www.rabbitmq.com/memory.html) result 200).
* http://www.rebar3.org with 1 occurrences migrated to:
  https://www.rebar3.org ([https](https://www.rebar3.org) result 200).
* http://code.google.com/p/clink/issues/detail?id=141 with 1 occurrences migrated to:
  https://code.google.com/p/clink/issues/detail?id=141 ([https](https://code.google.com/p/clink/issues/detail?id=141) result 301).
* 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://msdn.microsoft.com/en-us/library/aa366778 with 1 occurrences migrated to:
  https://msdn.microsoft.com/en-us/library/aa366778 ([https](https://msdn.microsoft.com/en-us/library/aa366778) result 301).
* http://msdn.microsoft.com/en-us/library/bb540814 with 1 occurrences migrated to:
  https://msdn.microsoft.com/en-us/library/bb540814 ([https](https://msdn.microsoft.com/en-us/library/bb540814) result 301).
* http://rabbitmq.com/documentation.html with 1 occurrences migrated to:
  https://rabbitmq.com/documentation.html ([https](https://rabbitmq.com/documentation.html) 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.erlang.org/doc/system_principles/versions.html with 1 occurrences migrated to:
  https://www.erlang.org/doc/system_principles/versions.html ([https](https://www.erlang.org/doc/system_principles/versions.html) result 301).
* http://www.mozilla.org/MPL/ with 66 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:13:48 -05:00
Michael Klishin 9f6d2b449f Require Erlang 21.3 2019-03-20 10:24:51 +03:00
Loïc Hoguin 944f0087bf Make rabbit_pbe work for OTP-22 2019-03-19 15:02:24 +01:00
Jean-Sébastien Pédron 3eb5ae110a rabbitmq-hexpm.mk: Switch to hexpm-cli 0.3.0
This version should work with the latest `rebar3_hex` plugin (6.5.0).
2019-03-18 13:40:25 +01:00
Jean-Sébastien Pédron 844c591027 Revert "rabbitmq-run.mk: Increase lager message rate threshold from 50 to 5000"
We don't need this anymore, now that the high watermark is bumped
automatically when the log level is set to `debug` in rabbit_lager.

This reverts commit 49956c6423.
2019-03-18 11:41:28 +01:00
Michael Klishin 80c867763d Recon 2.4.0
[#164450566]
2019-03-15 05:32:16 +03:00
Michael Klishin cdf2a5afc0 Lager 3.6.9
[#164603900]
2019-03-15 05:17:19 +03:00
kjnilsson 1e6fed8e4e Replace use of erl_call with rabbitmqctl
The stop-node command is the only make target still using erl_call who
is prone to breakage (broken in OTP 21.3) and can readily be replaced
with rabbitmqctl stop.
2019-03-14 15:26:24 +00:00