-
Notifications
You must be signed in to change notification settings - Fork 160
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
Add reload support #17
Conversation
Wow, I didn't realize that this was here (though only available in Either way, I like using the solution provided, but would love to make it easier for users. Would it be helpful for us to provide a small wrapper script so that a user could directly pass arguments (and we add $ docker run -v /my/config:/... haproxy -m 100 -f /... -N 1000 |
haproxy-systemd-wrapper is hardcoded to
Shouldn't changing
Do we need to write some sort of update.sh (like some of the other docker repo), or is it okay if one of the dockerfile differ from the rest? |
I think something as simple as this is what @yosifkit was referring to: diff --git a/1.6/Dockerfile b/1.6/Dockerfile
index fbcae43..f01fc30 100644
--- a/1.6/Dockerfile
+++ b/1.6/Dockerfile
@@ -27,4 +27,6 @@ RUN buildDeps='curl gcc libc6-dev libpcre3-dev libssl-dev make' \
&& rm -rf /usr/src/haproxy \
&& apt-get purge -y --auto-remove $buildDeps
+COPY docker-entrypoint.sh /
+ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]
diff --git a/1.6/docker-entrypoint.sh b/1.6/docker-entrypoint.sh
new file mode 100755
index 0000000..bdb02c3
--- /dev/null
+++ b/1.6/docker-entrypoint.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+set -e
+
+# first arg is `-f` or `--some-option`
+if [ "${1:0:1}" = '-' ]; then
+ set -- haproxy "$@"
+fi
+
+if [ "$1" = 'haproxy' ]; then
+ # if the user wants "haproxy", let's use "haproxy-systemd-wrapper" instead so we can have proper reloadability implemented by upstream
+ shift # "haproxy"
+ set -- "$(which haproxy-systemd-wrapper)" -p /run/haproxy.pid "$@"
+fi
+
+exec "$@" (allows the user to still specify any arbitrary args, and allows the image to still work as-is without any modification in the same way it does currently) |
(and this repo doesn't use a |
https://github.com/horms/haproxy/blob/83104804996f354f167d8bdfcd27fb1f6148a252/src/haproxy-systemd-wrapper.c#L153-L161 is the money shot for where |
This will also enable
|
I don't think you correct, at least I couldn't get that behavior a few days ago. For that we need something like #19 |
Arg, you are correct -- this doesn't solve that problem. 😢
|
https://www.mail-archive.com/haproxy@formilux.org/msg17436.html is an
interesting (and depressing) post on that front
|
This looks good, but the changes to 1.4 need to be reverted (since it doesn't have the |
The code hase a |
Technically, but what's the point of doing so when we don't use a template? (and can thus just have 1.4 diverge in this instance, keeping the script slightly simpler) |
You the boss :) Done. |
Thanks ❤️ This will probably need some minor updates for Alpine support (POSIX vs Bash), but I'm happy to take on those changes if you'd like! LGTM |
Fine with me. |
LGTM |
I have only tested 1.6 and only slightly.
Reload like
docker kill --signal=USR2 <container>
or HUPFull path and pid is required for haporxy-systemd-wrapper to work.
Fix #5