Bug 256686 - net/rabbitmq: update to 3.8.18
Summary: net/rabbitmq: update to 3.8.18
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dave Cottlehuber
URL: https://reviews.freebsd.org/D27532
Depends on:
Reported: 2021-06-18 08:32 UTC by Kirill
Modified: 2021-07-21 08:17 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (erlang)


Note You need to log in before you can comment on or make changes to this bug.
Description Kirill 2021-06-18 08:32:26 UTC

Anyone have news of updating to the latest version?
Comment 1 Dave Cottlehuber freebsd_committer 2021-06-25 12:17:57 UTC
No promises but things are coming along, there's already a patch in phabricator,
which is 90% of the way there. The newer RabbitMQ environment vars still default
to /var/lib/rabbitmq/* and similar for the pidfile, and backend mnesia db files.

The knobs tweaked in the previous releases are broken. Feel free to see if you
can work out where this can be safely reset. The patches should end up in sbin/rabbitmq-defaults so that all RabbitMQ functions inherit the settings.
Comment 2 Kirill 2021-06-25 17:16:28 UTC
Great news!

I have tested your patch and have a couple of questions. Libraries from '/work/rabbitmq-server-3.8.18/deps/rabbit/ebin' directory are missing. And 'exec erl' command in sbin scripts does not work as expected if lang/erlang is installed.
Comment 3 Dave Cottlehuber freebsd_committer 2021-06-25 22:42:24 UTC
thanks for the test info!

yes this is still related to some problems with path handling (I have this sorted locally already), and the homedir problem already mentioned.

I expect that this might only build cleanly in poudriere for the moment, but at runtime it shouldn't matter where things come from. How are you building it?

Please paste in specific commands and errors, its much easier to debug with the details :)
Comment 4 Kirill 2021-06-26 07:41:55 UTC
There were no problems in the libraries, sorry) This may be a problem in the Makefile in $ {REINPLACE_CMD}, there is no more ${ERL_DIR} in the source code.
Comment 5 Dave Cottlehuber freebsd_committer 2021-06-28 12:47:40 UTC
patch is updated, let me know how that works now, the rc.d script 
has also changed quite a bit:

service rabbitmq start
service rabbitmq status
service rabbitmq stop
service rabbitmq status

On a fresh install, you may need to run:
sudo -u rabbitmq rabbitmq-plugins enable rabbitmq_management
Comment 6 Kirill 2021-06-29 08:22:34 UTC
An error occurred while compiling. I think this is because Erlang/OTP 23.2 is required.

==> rabbitmqctl
Compiling 221 files (.ex)
Generated rabbitmqctl app
** (UndefinedFunctionError) function :ram_file.compress/1 is undefined or private
    (kernel 8.0.1) :ram_file.compress({:file_descriptor, :ram_file, #Port<0.16>})
    (mix 1.10.4) lib/mix/release.ex:790: Mix.Release.strip_beam/1
    (mix 1.10.4) lib/mix/tasks/escript.build.ex:285: anonymous fn/2 in Mix.Tasks.Escript.Build.strip_beams/1
    (elixir 1.10.4) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
    (mix 1.10.4) lib/mix/tasks/escript.build.ex:283: Mix.Tasks.Escript.Build.strip_beams/1
    (mix 1.10.4) lib/mix/tasks/escript.build.ex:188: Mix.Tasks.Escript.Build.escriptize/2
    (mix 1.10.4) lib/mix/task.ex:330: Mix.Task.run_task/3
    (mix 1.10.4) lib/mix/task.ex:364: Mix.Task.run_alias/3
gmake[4]: *** [Makefile:106: escript/rabbitmqctl] Error 1
gmake[4]: Leaving directory '/usr/ports/net/rabbitmq/work/rabbitmq-server-3.8.18/deps/rabbitmq_cli'
gmake[3]: *** [../../erlang.mk:4512: deps] Error 2
gmake[3]: Leaving directory '/usr/ports/net/rabbitmq/work/rabbitmq-server-3.8.18/deps/rabbit'
gmake[2]: *** [erlang.mk:4512: deps] Error 2
gmake[2]: Leaving directory '/usr/ports/net/rabbitmq/work/rabbitmq-server-3.8.18'
*** Error code 1
Comment 7 Kirill 2021-06-29 09:10:11 UTC
I compiled with erlang 23 and tried to run the script. Another error I got after run the rabbitmq-plugins script:

vm1:/usr/local/lib/rabbitmq_server-3.8.18/sbin# ./rabbitmq-plugins
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (wh
ich can be verified by running "locale" in your shell)
** (UndefinedFunctionError) function :rabbit_plugins.read_enabled/1 is undefined (module :rabbit_plugins is not available)
    (rabbitmqctl 3.8.0-dev) lib/rabbitmq/cli/core/command_modules.ex:60: RabbitMQ.CLI.Core.CommandModules.plugin_modules/1
    (rabbitmqctl 3.8.0-dev) lib/rabbitmq/cli/core/command_modules.ex:48: RabbitMQ.CLI.Core.CommandModules.load_commands/2
    (rabbitmqctl 3.8.0-dev) lib/rabbitmq/cli/core/command_modules.ex:33: RabbitMQ.CLI.Core.CommandModules.load/1
    (rabbitmqctl 3.8.0-dev) lib/rabbitmq/cli/ctl/commands/help_command.ex:212: RabbitMQ.CLI.Ctl.Commands.HelpCommand.commands_description/0
    (rabbitmqctl 3.8.0-dev) lib/rabbitmq/cli/ctl/commands/help_command.ex:92: RabbitMQ.CLI.Ctl.Commands.HelpCommand.all_usage/1
    (rabbitmqctl 3.8.0-dev) lib/rabbitmqctl.ex:40: RabbitMQCtl.exec_command/2
    (rabbitmqctl 3.8.0-dev) lib/rabbitmqctl.ex:31: RabbitMQCtl.main/1
Press any key to continue...

This problem went away when I copied /work/rabbitmq-server-3.8.18/deps/rabbit to /usr/local/lib/erlang23/lib.
Comment 8 Kirill 2021-06-29 09:14:30 UTC
And yet rabbitmqctl didn't want to start because it couldn't find the cookie. Everything worked after adding export HOME=/var/db/rabbitmq to rabbitmq-defaults.
Comment 9 Dave Cottlehuber freebsd_committer 2021-06-29 10:44:57 UTC
Updated https://reviews.freebsd.org/D27532

- incorporate en_US.UTF-8 locale into rabbitmq-defaults so that VM & escripts are consistent
- ensure permissions on /usr/local/etc/rabbitmq allow mgmt escripts to write/update plugins
Comment 10 Kirill 2021-06-29 12:24:24 UTC
Everything is going well in Poudriere. But what about rabbitmqctl, we need save cookie in a home directory?
Comment 11 Dave Cottlehuber freebsd_committer 2021-06-29 20:49:51 UTC
Kirill, not sure what your comment means but I assume you're referring to
the inter-node cookie which is:

- /var/db/rabbitmq/.erlang.cookie
- chmod 0600
- chown rabbitmq:rabbitmq

As is with all RabbitMQ installs, it's up to the user to decide how/if to
share this outside the rabbitmq user.

In theory you can copy/softlink/export HOME=/var/db/rabbitmq and run these as different users, but then you risk getting important files chowned by the wrong user.

The recommended approach is, for example:

sudo -u rabbitmq rabbitmq-plugins enable rabbitmq_management

thus ensuring the user and permissions line up.
Comment 12 Kirill 2021-06-30 13:40:14 UTC
OK. This used to work, so I asked.
Comment 13 Erik Cederstrand 2021-07-13 16:09:08 UTC
Is anything blocking the Phabricator patch?

A VuXML entry was recently added, affecting rabbitmq<3.8.16. See https://vuxml.freebsd.org/freebsd/7003b62d-7252-46ff-a9df-1b1900f1e65b.html
Comment 14 Kirill 2021-07-21 08:17:03 UTC
There are problems with the pid file. It is interestingly created and is empty after starting the daemon.