docker-archive / dockercloud-haproxy

HAproxy image that autoreconfigures itself when used in Docker Cloud
https://cloud.docker.com/
651 stars 187 forks source link

Sequential deployment okay? #194

Closed levino closed 7 years ago

levino commented 7 years ago

Why exactly should one not use sequential deployment? If I link a new service I need to roll over all load balancers. How do I do this without redeployment? Would that not be a nice case for sequential deployment?

tifayuki commented 7 years ago

@Levino Please do not set sequential deployment on haproxy service itself. As described here(https://docs.docker.com/docker-cloud/apps/service-scaling/#deployment-and-scaling-modes):

Sequential mode: each new container is deployed in the service one at a time. Each container is linked to all previous containers using service links. This makes complex configuration possible within the containers startup logic. This mode is explained in detail in the following sections.

If you have more than one containers in the haproxy services, the 2nd haproxy container will be linked to the 1st haproxy container, etc. This means, your 1st haproxy container is load balancing the 2nd haproxy, and your 2nd haproxy container is load balancing the 3rd haproxy container, etc. And this could make the configuration totally wrong, you will experience a lot of unexpected error, like 401.

You don't need to redeploy haproxy service manually, it will try to reconfigure itself automatically.

Use case can be found: https://docs.docker.com/docker-cloud/apps/service-scaling/#when-should-i-use-sequential-scaling

levino commented 7 years ago

If I add a new linked service to haproxy it will only be load balanced after a redeploy, right?

tifayuki commented 7 years ago

The new service will be load balanced after the haproxy is reloaded. This is done by by haproxy script automatically. You don't have to manually redeploy haproxy service.