Skip to content

Conversation

dumbbell
Copy link
Collaborator

This has several benefits:

  1. It simplifies the code, all configuration being handled by the same code path (no more condition on Erlang-term-based vs. Cuttlefish). rabbit_config shrinks quite a lot in the process.

  2. We can use additional configuration files AND an Erlang-term-based configuration file. In other words, it is possible to use the same existing Erlang-term-based file and introduce Cuttlefish files when needed.

    It allows a user to run RabbitMQ with:

    RABBITMQ_CONFIG_FILE=/path/to/rabbitmq.config \
    RABBITMQ_CONFIG_FILES=/path/to/conf.d/*.conf \
    ./sbin/rabbitmq-server
    

    A developer can do the same with make run-broker:

    make run-broker \
    RABBITMQ_CONFIG_FILES=/path/to/conf.d/*.conf
    

    In the example above, the main configuration file generated by rabbitmq-run.mk is an Erlang-term-based one.

This is implemented by calling Cuttlefish with a (possibly empty) list of additional files and the Erlang-term-based file as the advanced configuration file.

References #2180.

This has several benefits:

1. It simplifies the code, all configuration being handled by the same
   code path (no more condition on Erlang-term-based vs. Cuttlefish).
   `rabbit_config` shrinks quite a lot in the process.

2. We can use additional configuration files AND an Erlang-term-based
   configuration file. In other words, it is possible to use the same
   existing Erlang-term-based file and introduce Cuttlefish files when
   needed.

   It allows a user to run RabbitMQ with:

   RABBITMQ_CONFIG_FILE=/path/to/rabbitmq.config \
   RABBITMQ_CONFIG_FILES=/path/to/conf.d/*.conf \
   ./sbin/rabbitmq-server

   A developer can do the same with `make run-broker`:

   make run-broker \
   RABBITMQ_CONFIG_FILES=/path/to/conf.d/*.conf

   In the example above, the main configuration file generated by
   rabbitmq-run.mk is an Erlang-term-based one.

This is implemented by calling Cuttlefish with a (possibly empty) list
of additional files and the Erlang-term-based file as the advanced
configuration file.

References #2180.
It is unused in RabbitMQ or tier-1 plugins, and the previously returned
value made no sense since the switch to Cuttlefish as a library (as part
of #2180).
@dumbbell dumbbell force-pushed the always-handle-config-files-with-cuttlefish branch from 10aa4d3 to 5f5fccf Compare April 23, 2020 15:33
@dumbbell dumbbell marked this pull request as ready for review April 23, 2020 16:11
@gerhard
Copy link
Contributor

gerhard commented Apr 23, 2020

Works as expected, confirmed by running the following command locally:

cat > rabbitmq.conf <<EOF
load_definitions = /Users/gerhard/github.com/rabbitmq/3.9.x/deps/rabbit/rabbitmq-definitions.json
EOF

cat > rabbitmq-definitions.json <<EOF
{
  "global_parameters": [
    {"name": "cluster_name", "value": "pr-2277"}
  ]
}
EOF

RABBITMQ_CONFIG_FILES=/Users/gerhard/github.com/rabbitmq/3.9.x/deps/rabbit/rabbitmq.conf make run-broker
...
(rabbit@focker)1> rabbit_mnesia:status().
[{nodes,[{disc,[rabbit@focker]}]},
 {running_nodes,[rabbit@focker]},
 {cluster_name,<<"pr-2277">>},
 {partitions,[]}]

@gerhard gerhard merged commit 27ed8c1 into master Apr 23, 2020
@dumbbell dumbbell deleted the always-handle-config-files-with-cuttlefish branch April 29, 2020 09:01
@gerhard gerhard added this to the 3.8.4 milestone Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants