Skip to content

Ability to specify arbitrary config file variables is needed #76

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

Closed
CVTJNII opened this issue Mar 14, 2016 · 6 comments
Closed

Ability to specify arbitrary config file variables is needed #76

CVTJNII opened this issue Mar 14, 2016 · 6 comments

Comments

@CVTJNII
Copy link
Contributor

CVTJNII commented Mar 14, 2016

RabbitMQ currently supports many more tunables in the config file then the entrypoint script supports:

https://www.rabbitmq.com/configure.html

The current entrypoint script paints things into a corner somewhat due to it's handling of some of the arguments (SSL, namely), assumptions about argument formatting of arguments by wrapping them in '<<"${val}">>', and the general nested format of the Rabbit config.

I believe the ability to set these variables is going to be a requirement for many users, especially for the settings documented in the production checklist. Unfortunately, I also believe that the complexity of the rabbitmq config file is too much for a simple bash script.

I propose a script that can build an hash of the default configs that the script currently builds, and that can then merge in a hash of user defined options. This would allow the script to continue maintain the settings it does now, and thereby maintain existing functionality, while also exposing the full config to the user so that they can perform any tuning needed for their environment.

I'm curious what others think of this idea and if others have other solutions in mind.

CVTJNII added a commit to CVTJNII/rabbitmq-1 that referenced this issue Mar 14, 2016
@CVTJNII CVTJNII changed the title Ability to specify arbitry config file variables is needed Ability to specify arbitrary config file variables is needed Mar 14, 2016
CVTJNII added a commit to CVTJNII/rabbitmq-1 that referenced this issue Mar 16, 2016
@briancavalier
Copy link

I currently need this as well. I'd like to be able to set the heartbeat interval at the rabbit server so that it negotiates that value with all clients rather than having to configure it at each client (clients still can, to override, of course).

@jonapich
Copy link

jonapich commented Oct 17, 2016

We used the environment variables approach to configure our RabbitMQ servers for SSL, which works well. Now I have to plug in LDAP authentication support, which can only configured through a config file. Unfortunately, because of the SSL options, the entrypoint's script will override my rabbitmq.config file with the SSL stuff.

I like the OP's idea; alternatively, we use dotted notation inside environment variables to override some YAML settings in some of our apps. Would be interesting to be able to modify the configuration file this way.

e.g.: RABBITMQ_CONFIG.rabbitmq_auth_backend_ldap.servers=["server1", "server2"]

Meanwhile, is there any acceptable workaround that won't force me to operate all of the entrypoint's SSL mechanics within my configuration manager?

@yosifkit
Copy link
Member

Given docker-library/docs#1011, and that 3.7 introduced the new (trivial to write/append to) ini/sysctl-style configuration format (https://www.rabbitmq.com/configure.html#config-file-formats), I'm going to close this.

In Kubernetes, it should be pretty trivial to create a config object which gets inserted at /etc/rabbitmq/rabbitmq.conf with the desired settings included. 👍

(Or to create a derivative image FROM this one which adds a simple ENTRYPOINT that appends the contents of an environment variable to the above-noted file.)

- #186 (comment)

@alethenorio
Copy link

I have run into the issue where I would like to configure the default_pass variable in the rabbitmq.conf from an environment variable. You can indeed trivially generate such a file using a config object in kubernetes as @yosifkit suggested however you probably also want that password to be stored somewhere safe.

In its simplest form that would mean storing it as a kubernetes secret (And likely not storing it in version control) however at the moment this means you need to store the entire rabbitmq.conf as a secret and that you cannot keep that config in version control and this is not very practical.

If I were able to refer to an environment variable I could keep the rabbitmq.conf in version control and keep only the relevant data (The value for default_pass in my case) out of it (As a kubernetes secret for example)

I think the option to be able to refer to an environment variable for a single arbitrary parameter in the rabbitmq configuration is very much relevant and I hope this can be reconsidered in the future

@tianon
Copy link
Member

tianon commented Jul 30, 2018

@ByteFlinger default_pass is one of the few we support:

default_pass

(In fact, it's even supported with an _FILE suffix if you wanted to store it in a Docker or Kubernetes secret and provide it to the container via a file mounted on tmpfs.)

That'd be RABBITMQ_DEFAULT_PASS or RABBITMQ_DEFAULT_PASS_FILE when specifying.

@tianon
Copy link
Member

tianon commented Jul 30, 2018

See also https://hub.docker.com/_/rabbitmq/ under "Setting default user and password": (https://github.com/docker-library/docs/tree/a702c5579f1199b6203d66a66e2a9021a6ea72a3/rabbitmq#setting-default-user-and-password)

Setting default user and password

If you wish to change the default username and password of guest / guest, you can do so with the RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS environmental variables:

$ docker run -d --hostname my-rabbit --name some-rabbit -e RABBITMQ_DEFAULT_USER=user -e RABBITMQ_DEFAULT_PASS=password rabbitmq:3-management

You can then go to http://localhost:8080 or http://host-ip:8080 in a browser and use user/password to gain access to the management console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants