Skip to content

Always handle config files with Cuttlefish #2277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2020

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