From edffb26c29ccb368b7de0f6f07bfe81c9d954a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Sat, 2 Apr 2016 01:07:01 +0000 Subject: [PATCH] Add DNS watcher --- bin/add-load-balancer-v2.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bin/add-load-balancer-v2.py b/bin/add-load-balancer-v2.py index b26962d9..d8a130a8 100755 --- a/bin/add-load-balancer-v2.py +++ b/bin/add-load-balancer-v2.py @@ -33,10 +33,15 @@ if service_name not in config["services"]: lb_name = "{}-lb".format(service_name) be_name = "{}-be".format(service_name) +wd_name = "{}-wd".format(service_name) if lb_name in config["services"]: error("load balancer {} already exists in $COMPOSE_FILE" - .format(service_name)) + .format(lb_name)) + +if wd_name in config["services"]: + error("dns watcher {} already exists in $COMPOSE_FILE" + .format(wd_name)) service = config["services"][service_name] if "networks" in service: @@ -63,6 +68,16 @@ config["services"][lb_name] = { }, } +# Add the DNS watcher. +config["services"][wd_name] = { + "image": "jpetazzo/watchdns", + "command": "{} {} {}".format(port, be_name, port), + "volumes_from": [ lb_name ], + "networks": { + service_name: None, + }, +} + if "networks" not in config: config["networks"] = {} if service_name not in config["networks"]: