-
Notifications
You must be signed in to change notification settings - Fork 430
Add /docker-entrypoint-initdb.d customization hooks #53
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
Conversation
@@ -131,6 +131,15 @@ if [ "$1" = 'rabbitmq-server' ]; then | |||
export RABBITMQ_CTL_ERL_ARGS="$RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS" | |||
fi | |||
|
|||
echo | |||
for f in /docker-entrypoint-initdb.d/*; do | |||
case "$f" in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not test -e
and let users choose the language they want to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean -x
for testing executable status?
The *.sh
case is sourcing the script, not just executing it, so it can actually affect the surrounding environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides that, it's pretty easy to call out to an interpreter of your choice from a *.sh
script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, my bad. I didn't see you were sourcing the script, not executing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@md5 Is the sourcing a problem? I guess that the script could affect the environment is a good thing? More power to extend the base docker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@c0deaddict I think the sourcing can be useful, provided the underlying command uses environment variables directly.
This comment has been minimized.
This comment has been minimized.
Hmm, I'm a little confused on this one -- what makes this different from having your own |
@tianon The reason I want these changes in the docker image is that I want to make a RabbitMQ docker image with some extra plugins installed (like STOMP and MQTT). Installing plugins can be done by extending the rabbitmq base image. But what about adding some configuration for the plugin based on the environment variables. The configuration is build in docker-entrypoint.sh and currently there is no way to extend it. So I would have to copy and paste the docker-entrypoint.sh and make my modifications there. Wouldn't it be nicer if anyone can add their own scripts that add something to the rabbitmq.config? Thinking about this made me realize that the location of the for loop is not correct. The loop should be before the rabbitmq.config file is finalized. I guess something like this would work (from line 112): fi
echo
for f in /docker-entrypoint-initdb.d/*; do
case "$f" in
*.sh) echo "$0: running $f"; . "$f" ;;
*) echo "$0: ignoring $f" ;;
esac
echo
done
cat >> /etc/rabbitmq/rabbitmq.config <<-'EOF' Then for example one could add some plugin specific config with:
stomp.sh #!/bin/bash
cat >> /etc/rabbitmq/rabbitmq.config <<-'EOF'
{rabbitmq_stomp, [{tcp_listeners, [12345]}]}
EOF What do you think about this? |
ping @tianon |
Ah, yeah, I suppose using this to enable custom additions to the config does make some sense, but I am still concerned that it's different from the way |
Did this PR stall? :( |
Finally getting back to this old issue and feel like my response is basically the same as docker-library/elasticsearch#86 (comment).
|
Add customization hooks like in the postgres docker (lines are actually from that Dockerfile). This allows for extending the official rabbitmq image without having to copy and refine the whole docker-entrypoint.sh. It could be used for example to configure additional plugins.