Skip to content

Conversation

@TimWolla
Copy link
Contributor

Closes #48

haproxy 1.8-rc4 is the first version I found stable enough for use inside of a Docker container. This pull request implements my suggestions I made on #48:

  • Switch to Debian Stretch and Alpine 3.6
  • Replace systemd-wrapper by master-worker-mode (-W)

I verified that reloading haproxy works fine in master-worker mode.

According to Willy on the mailing list the final release is not too far off. I'm creating this pull request nonetheless for some early discussion of the changes I did.

@yosifkit
Copy link
Member

Diff:
$ git --no-pager diff --no-index 1.7/ 1.8-rc/
diff --git a/1.7/Dockerfile b/1.8-rc/Dockerfile
index 44fa2ec..69fbfd8 100644
--- a/1.7/Dockerfile
+++ b/1.8-rc/Dockerfile
@@ -1,15 +1,15 @@
-FROM debian:jessie-backports
+FROM debian:stretch
 
 RUN apt-get update \
 	&& apt-get install -y --no-install-recommends \
 		liblua5.3-0 \
 		libpcre3 \
-		libssl1.0.0 \
+		libssl1.1 \
 	&& rm -rf /var/lib/apt/lists/*
 
-ENV HAPROXY_MAJOR 1.7
-ENV HAPROXY_VERSION 1.7.9
-ENV HAPROXY_MD5 a2bbbdd45ffe18d99cdcf26aa992f92d
+ENV HAPROXY_MAJOR 1.8
+ENV HAPROXY_VERSION 1.8-rc4
+ENV HAPROXY_MD5 9bf5e689ceda1e5c8ec137042b2b1549
 
 # see http://sources.debian.net/src/haproxy/jessie/debian/rules/ for some helpful navigation of the possible "make" arguments
 RUN set -x \
@@ -20,6 +20,7 @@ RUN set -x \
 		liblua5.3-dev \
 		libpcre3-dev \
 		libssl-dev \
+		zlib1g-dev \
 		make \
 		wget \
 	' \
@@ -49,4 +50,4 @@ RUN set -x \
 
 COPY docker-entrypoint.sh /
 ENTRYPOINT ["/docker-entrypoint.sh"]
-CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]
+CMD ["haproxy", "-W", "-f", "/usr/local/etc/haproxy/"]
diff --git a/1.7/alpine/Dockerfile b/1.8-rc/alpine/Dockerfile
index f9a2b2d..f42fcf6 100644
--- a/1.7/alpine/Dockerfile
+++ b/1.8-rc/alpine/Dockerfile
@@ -1,8 +1,8 @@
-FROM alpine:3.5
+FROM alpine:3.6
 
-ENV HAPROXY_MAJOR 1.7
-ENV HAPROXY_VERSION 1.7.9
-ENV HAPROXY_MD5 a2bbbdd45ffe18d99cdcf26aa992f92d
+ENV HAPROXY_MAJOR 1.8
+ENV HAPROXY_VERSION 1.8-rc4
+ENV HAPROXY_MD5 9bf5e689ceda1e5c8ec137042b2b1549
 
 # https://www.lua.org/ftp/#source
 ENV LUA_VERSION=5.3.3 \
@@ -77,4 +77,4 @@ RUN set -x \
 
 COPY docker-entrypoint.sh /
 ENTRYPOINT ["/docker-entrypoint.sh"]
-CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]
+CMD ["haproxy", "-W", "-f", "/usr/local/etc/haproxy/"]
diff --git a/1.7/alpine/docker-entrypoint.sh b/1.8-rc/alpine/docker-entrypoint.sh
index 1b413a9..06c4dfa 100755
--- a/1.7/alpine/docker-entrypoint.sh
+++ b/1.8-rc/alpine/docker-entrypoint.sh
@@ -6,10 +6,4 @@ if [ "${1#-}" != "$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 "$@"
diff --git a/1.7/docker-entrypoint.sh b/1.8-rc/docker-entrypoint.sh
index 1b413a9..06c4dfa 100755
--- a/1.7/docker-entrypoint.sh
+++ b/1.8-rc/docker-entrypoint.sh
@@ -6,10 +6,4 @@ if [ "${1#-}" != "$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 "$@"

@yosifkit
Copy link
Member

I have a question/suggestion: do you think we should put something in the entrypoint script to ensure -W is in the args? After some tests, it doesn't matter if -W is specified more that once, so we can just add it unilaterally when they run haproxy.

I added a couple additions to update.sh and generate-stackbrew-library.sh that will make them work better with this PR.

@tianon
Copy link
Member

tianon commented Nov 20, 2017

I have a question/suggestion: do you think we should put something in the entrypoint script to ensure -W is in the args? After some tests, it doesn't matter if -W is specified more that once, so we can just add it unilaterally when they run haproxy.

+1, since that'd be consistent with our pre-1.8 behavior (of unilaterally adding haproxy-systemd-wrapper)

@TimWolla
Copy link
Contributor Author

I have a question/suggestion: do you think we should put something in the entrypoint script to ensure -W is in the args? After some tests, it doesn't matter if -W is specified more that once, so we can just add it unilaterally when they run haproxy.

I consider it unlikely that one wants to run haproxy with additional CLI arguments as all the relevant configuration options can be specified in the haproxy.cfg. That said: I'm not opposed to the change. Feel free to make the change inside this PR like you did with the update.sh.

@TimWolla
Copy link
Contributor Author

@yosifkit @tianon I just added another commit passing the -db flag to haproxy. This makes haproxy ignore daemon inside the configuration file and makes this warning in the docs obsolete:

Note: Many configuration examples propose to put daemon into the global section to run HAProxy as daemon. Do not configure this or the Docker container will exit immediately after launching because the HAProxy process would go into the background.

@yosifkit
Copy link
Member

Oh 😄, the -db flag is good even down to 1.4. (I think we'll make a separate PR to update the others)

daemon
  Makes the process fork into background. This is the recommended mode of
  operation. It is equivalent to the command line "-D" argument. It can be
  disabled by the command line "-db" argument.

- https://www.haproxy.org/download/1.4/doc/configuration.txt

@TimWolla
Copy link
Contributor Author

I think we'll make a separate PR to update the others

Yes, I did not want to make unrelated changes in this PR. Poking you into the right direction with my comment worked, though 😁

@tianon tianon merged commit df342c6 into docker-library:master Nov 21, 2017
@tianon
Copy link
Member

tianon commented Nov 21, 2017

Follow-up is in #51

@TimWolla TimWolla deleted the haproxy-1.8 branch November 22, 2017 15:48
yosifkit added a commit to infosiftr/stackbrew that referenced this pull request Nov 22, 2017
 - docker, golang, hello-world, mongo, openjdk, python Use new microsoft/windowsservercore tags
 - ghost `1.18.0` bump
 - haproxy lua bump: docker-library/haproxy#52, 1.8-rc docker-library/haproxy#49, `-db` docker-library/haproxy#51
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

Successfully merging this pull request may close these issues.

3 participants