On Sat, Nov 14, 2015 at 2:18 PM, Baptiste <bed...@gmail.com> wrote: > > Le 14 nov. 2015 14:01, "Paul Menzel" <paulepan...@users.sourceforge.net> a > écrit : >> >> Dear HAProxy folks, >> >> >> I am using a Docker setup to serve Web application using a database. >> >> HAProxy, the Web app and the database each run in a separate Docker >> container. >> >> The HAProxy container is than started with the command below. >> >> docker run --detach --name haproxy --link webapp:webapp >> myimages/haproxy >> >> The goal is to have zero downtime deployments. >> >> Now the problem is, that each time the Web app container is replaced by >> a container run from a newer version, the HAProxy container has to be >> stopped an started again so that the link works. This is certainly not >> desired. >> >> I search the Web for documentation and how-tos but couldn’t find >> anything directly related to my issue. Do you know of such write-ups, >> which I might have missed due to the generic key words. >> >> Do you have any experiences with serving Web apps with HAProxy using >> Docker links? >> >> Should I stop using that “technology” and do things differently? >> >> >> Thanks, >> >> Paul >> >> >> [1] >> http://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/ > > Hi Paul, > > What about using dns resolution available in haproxy 1.6? > That's how I do. > > Baptiste
Just to make it longer, you run your haproxy docker like this: docker run --detach --name haproxy --link webapp:webapp (install in it a dnsmasq to act as a wrapper between /etc/hosts and HAProxy), then when a new version of your app is available, do docker build -t webapp /path/to/webapp docker restart webapp docker will automatically populate new IP address into haproxy's container /etc/hosts file and dnsmasq will deliver the new IP to HAProxy when HAProxy will perform a DNS resolution. Well, now, I remember, in my HAProxy docker, I also use inotify tools to trigger a dnsmasq reload. Baptiste