Re: Experiences with Docker and linking containers for zero downtime deployments

2015-11-15 Thread Aleksandar Lazic

Hi Paul.

Am 14-11-2015 14:00, schrieb Paul Menzel:

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?


You can take a look into kuberbetes, openshift or similar frameworks for 
docker management.


http://getcloudify.org/2015/06/11/orchestration-docker-cloud-automation-openstack-heat-tosca-kubernetes.html

https://github.com/kubernetes/kubernetes

http://kubernetes.io/v1.1/docs/user-guide/replication-controller.html#rolling-updates

https://github.com/openshift/origin

https://docs.openshift.org/latest/dev_guide/deployments.html

Due to the fact that this frameworks use docker inside you can reuse 
some of the dockerfiles.


I use this openshift stuff with rolling updates.

BR Aleks



Thanks,

Paul


[1]
http://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/




Experiences with Docker and linking containers for zero downtime deployments

2015-11-14 Thread Paul Menzel
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/

signature.asc
Description: This is a digitally signed message part


Re: Experiences with Docker and linking containers for zero downtime deployments

2015-11-14 Thread Baptiste
Le 14 nov. 2015 14:01, "Paul Menzel"  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


Re: Experiences with Docker and linking containers for zero downtime deployments

2015-11-14 Thread Baptiste
On Sat, Nov 14, 2015 at 2:18 PM, Baptiste  wrote:
>
> Le 14 nov. 2015 14:01, "Paul Menzel"  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