From 93bdc8d5a880f062edc52773435d82d6b3a152c7 Mon Sep 17 00:00:00 2001 From: Josh Cox Date: Wed, 26 Jul 2017 12:22:28 -0500 Subject: [PATCH] Affinity rule to distribute instances by hosts, preventing run more than one by host. --- templates/MongoDB/3/docker-compose.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/MongoDB/3/docker-compose.yml b/templates/MongoDB/3/docker-compose.yml index fb26491..98e7dd3 100644 --- a/templates/MongoDB/3/docker-compose.yml +++ b/templates/MongoDB/3/docker-compose.yml @@ -11,6 +11,7 @@ services: - "${replset_name}" image: mongo:3.4 labels: + io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name} io.rancher.scheduler.affinity:host_label: ${host_label} io.rancher.container.hostname_override: container_name io.rancher.sidekicks: mongo-base, mongo-datavolume @@ -22,6 +23,7 @@ services: mongo-base: restart: always labels: + io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name} io.rancher.scheduler.affinity:host_label: ${host_label} io.rancher.container.hostname_override: container_name io.rancher.container.start_once: true @@ -30,6 +32,7 @@ services: entrypoint: /bin/true mongo-datavolume: labels: + io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name} io.rancher.scheduler.affinity:host_label: ${host_label} io.rancher.container.hostname_override: container_name io.rancher.container.start_once: true