From 48bdf363369ebadc0e08e10957cb05883eab3f8b Mon Sep 17 00:00:00 2001 From: Mano Marks Date: Mon, 9 Jan 2017 14:23:30 -0800 Subject: [PATCH 1/6] adding docker-stack.yml --- docker-stack.yml | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 docker-stack.yml diff --git a/docker-stack.yml b/docker-stack.yml new file mode 100644 index 0000000..2c30529 --- /dev/null +++ b/docker-stack.yml @@ -0,0 +1,76 @@ +version: "3" +services: + + redis: + image: redis:alpine + ports: + - "6379" + networks: + - front-tier + deploy: + replicas: 2 + update_config: + parallelism: 2 + delay: 10s + restart_policy: + condition: on-failure + db: + image: postgres:9.4 + volumes: + - db-data:/var/lib/postgresql/data + networks: + - back-tier + deploy: + placement: + constraints: [node.role == manager] + vote: + image: dockersamples/examplevotingapp_vote + ports: + - 5000:80 + networks: + - front-tier + depends_on: + - redis + deploy: + replicas: 2 + update_config: + parallelism: 2 + restart_policy: + condition: on-failure + result: + image: dockersamples/examplevotingapp_result + ports: + - 5001:80 + networks: + - back-tier + depends_on: + - db + deploy: + replicas: 2 + update_config: + parallelism: 2 + delay: 10s + restart_policy: + condition: on-failure + + worker: + image: dockersamples/examplevotingapp_worker + networks: + - front-tier + - back-tier + deploy: + mode: replicated + replicas: 1 + labels: [APP=VOTING] + restart_policy: + condition: on-failure + delay: 10s + max_attempts: 3 + window: 120s + +networks: + front-tier: + back-tier: + +volumes: + db-data: From 4743b464a67d7363cfc4358efdf876ce5758dd35 Mon Sep 17 00:00:00 2001 From: Mano Marks Date: Mon, 9 Jan 2017 14:42:37 -0800 Subject: [PATCH 2/6] changing docker-stack.yml to more closely match the rest of the app, and add a visualizer --- docker-stack.yml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/docker-stack.yml b/docker-stack.yml index 2c30529..d5ead8e 100644 --- a/docker-stack.yml +++ b/docker-stack.yml @@ -6,7 +6,7 @@ services: ports: - "6379" networks: - - front-tier + - frontend deploy: replicas: 2 update_config: @@ -19,7 +19,7 @@ services: volumes: - db-data:/var/lib/postgresql/data networks: - - back-tier + - backend deploy: placement: constraints: [node.role == manager] @@ -28,7 +28,7 @@ services: ports: - 5000:80 networks: - - front-tier + - frontend depends_on: - redis deploy: @@ -42,7 +42,7 @@ services: ports: - 5001:80 networks: - - back-tier + - backend depends_on: - db deploy: @@ -56,8 +56,8 @@ services: worker: image: dockersamples/examplevotingapp_worker networks: - - front-tier - - back-tier + - frontend + - backend deploy: mode: replicated replicas: 1 @@ -67,10 +67,17 @@ services: delay: 10s max_attempts: 3 window: 120s + visualizer: + image: manomarks/visualizer + ports: + - "8080:8080" + stop_grace_period: 1m30s + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" networks: - front-tier: - back-tier: + frontend: + backend: volumes: - db-data: + db-data: \ No newline at end of file From fc316a130ae2e81fb4d2505b629c13ab8a4c7f39 Mon Sep 17 00:00:00 2001 From: Mano Marks Date: Mon, 9 Jan 2017 14:44:01 -0800 Subject: [PATCH 3/6] adding a line where one was missing --- docker-stack.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-stack.yml b/docker-stack.yml index d5ead8e..e37317c 100644 --- a/docker-stack.yml +++ b/docker-stack.yml @@ -67,6 +67,7 @@ services: delay: 10s max_attempts: 3 window: 120s + visualizer: image: manomarks/visualizer ports: From 0285545512094caa6b2b43774d8a36c853d34839 Mon Sep 17 00:00:00 2001 From: Mano Marks Date: Tue, 10 Jan 2017 17:57:43 -0800 Subject: [PATCH 4/6] adding before tag to vote and result images --- docker-stack.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-stack.yml b/docker-stack.yml index e37317c..2d41710 100644 --- a/docker-stack.yml +++ b/docker-stack.yml @@ -24,7 +24,7 @@ services: placement: constraints: [node.role == manager] vote: - image: dockersamples/examplevotingapp_vote + image: dockersamples/examplevotingapp_vote:before ports: - 5000:80 networks: @@ -38,7 +38,7 @@ services: restart_policy: condition: on-failure result: - image: dockersamples/examplevotingapp_result + image: dockersamples/examplevotingapp_result:before ports: - 5001:80 networks: From a34564cb55f94c0ae622baf60577bf7c016ea7c9 Mon Sep 17 00:00:00 2001 From: Mano Marks Date: Tue, 10 Jan 2017 18:29:36 -0800 Subject: [PATCH 5/6] updating to use dockersamples/visualizer:stable instead of manomarks/visualizer --- docker-stack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-stack.yml b/docker-stack.yml index 2d41710..09fecd8 100644 --- a/docker-stack.yml +++ b/docker-stack.yml @@ -69,7 +69,7 @@ services: window: 120s visualizer: - image: manomarks/visualizer + image: dockersamples/visualizer:stable ports: - "8080:8080" stop_grace_period: 1m30s From d53ab169ac9a65ccf5094a9784f9d4fc3c55c0fe Mon Sep 17 00:00:00 2001 From: Mano Marks Date: Fri, 13 Jan 2017 18:15:26 -0800 Subject: [PATCH 6/6] adding placement restraint to add visualizer, must run on a manager --- docker-stack.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-stack.yml b/docker-stack.yml index 09fecd8..ebc2d6b 100644 --- a/docker-stack.yml +++ b/docker-stack.yml @@ -67,6 +67,8 @@ services: delay: 10s max_attempts: 3 window: 120s + placement: + constraints: [node.role == manager] visualizer: image: dockersamples/visualizer:stable