Skip to content
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

[RFC] use augeas to write RabbitMQ config file instead of hardcoded bash #120

Closed
jippi opened this issue Nov 6, 2016 · 10 comments
Closed

Comments

@jippi
Copy link

jippi commented Nov 6, 2016

Augeas is pretty amazing, it allows for easy modification of the configuration file using "sniper" accuracy

example:

augtool --autosave set /files/etc/rabbitmq/rabbitmq.config/rabbit/vm_memory_high_watermark "0.4"

This will inject just that one change into the file, leaving everything as it initially was.

I'm currently hitting a problem where I want to modify the configuration file in my derivative Dockerfile, but all those changes are overwritten by the current docker endpoint

Usage:

  • apt-get install augeas-tools augeas-lenses
  • wget https://raw.githubusercontent.com/hercules-team/augeas/master/lenses/erlang.aug -O /usr/share/augeas/lenses/dist/erlang.aug
  • wget https://raw.githubusercontent.com/hercules-team/augeas/master/lenses/rabbitmq.aug -O /usr/share/augeas/lenses/dist/rabbitmq.aug
  • augtool --autosave set /files/etc/rabbitmq/rabbitmq.config/rabbit/vm_memory_high_watermark "0.4"

done! :)

we could even have the docker entrypoint run all augeas files in /etc/rabbitmq/conf.d/*.aug to allow easier extension of this amazing Dockerfile :)

My current case is that I want to modify the vm_memory_high_watermark value, but can't find a way to do it without modifying the image

@yosifkit
Copy link
Member

yosifkit commented Nov 8, 2016

That sounds pretty amazing and would make our entrypoint and possibly #53 much simpler, but I am curious what users think about it and also if it is recommended by upstream. @michaelklishin or @dumbbell, do you have any opinions about adding and using Augeas to generate/modify the config file in the image?

@dumbbell
Copy link

Hi!

I have too little experience with Docker and none with Augeas to have an educated opinion. I guess whatever makes your life and the end users' life easier is perfect :-)

@tianon
Copy link
Member

tianon commented Nov 14, 2016

This looks like a much cleaner way to munge the configuration indeed, but the size hit for installing it appears to be ~40.06MB (which is ~22% of our current image size of ~178.7MB) 😰

@jippi
Copy link
Author

jippi commented Nov 14, 2016

do the image size truly matter in those small increments compared to the flexibility and features it would provide ? :) for me personally, it would not be a deal breaker at all. :)

@michaelklishin
Copy link
Collaborator

If Augeas supports Erlang term files, it sounds like a good idea. Note that starting with 3.7.0 RabbitMQ will use an easier to parse config format by default but even then using Augeas may be worth it.

The 40 MB of added image size aspect doesn't concern me personally, bandwidth is getting cheaper predictably year after year and developer/operator time does not.

@jippi
Copy link
Author

jippi commented Nov 15, 2016

@tianon
Copy link
Member

tianon commented Dec 10, 2016

It still concerns me a bit that Augeas parses Erlang expressions with regular expressions in order to accomplish the task of modification. I seem to recall that @yosifkit found that we'd also need to install a newer RabbitMQ lense than is available in the Debian packages in order to parse the (arguably very simple) default configuration file we include.

IMO this newer INI-style format is going to be a simpler solution that should clean up our script pretty dramatically (especially and including being able to handle user-supplied files way easier). 😅

@jippi
Copy link
Author

jippi commented Dec 11, 2016

Augeas can also handle ini files :)

@Thubo
Copy link
Contributor

Thubo commented Dec 12, 2016

I took the liberty and started working on the feature: https://github.com/Thubo/rabbitmq/tree/FEATURE-%23120

The augeas lenses are based on the work of Raphael Pinson, but extended them to fit (nearly) all options I could find in the official docs.

There are some open TODOs:

  • Update the entrypoint.sh script
  • Modify /etc/rabbitmq/enabled_plugins
  • Some cleanup and more test

For now I've added the augeas lenses to this repo since it's not yet complete. Sooner or later these changes can be merged back to the hercules-team.

Please note, this is work in progress. Nevertheless I'm happy to hear suggestions how to improve.

@jippi
Copy link
Author

jippi commented Feb 27, 2018

with the new config file setup this isn't relevant any more

@jippi jippi closed this as completed Feb 27, 2018
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