VOL-394: Optimize Consul cluster configuration to better support HA

Change-Id: I2049a3ab419b214ca82785cb182a7fb562e46c9f
diff --git a/Makefile b/Makefile
index 7f64095..f54865e 100644
--- a/Makefile
+++ b/Makefile
@@ -197,7 +197,7 @@
 
 
 fetch-jenkins:
-	docker pull consul:latest
+	docker pull consul:0.9.2
 	docker pull fluent/fluentd:latest
 	docker pull gliderlabs/registrator:master
 	docker pull ubuntu:xenial
@@ -206,7 +206,7 @@
 	docker pull zookeeper:latest
 
 fetch:
-	docker pull consul:latest
+	docker pull consul:0.9.2
 	docker pull fluent/fluentd:latest
 	docker pull gliderlabs/registrator:master
 	docker pull ubuntu:xenial
diff --git a/compose/docker-compose-consul-cluster.yml b/compose/docker-compose-consul-cluster.yml
index 4a4200c..78f83e1 100644
--- a/compose/docker-compose-consul-cluster.yml
+++ b/compose/docker-compose-consul-cluster.yml
@@ -1,20 +1,25 @@
 #
-# Deploying a Consul cluster using this file assumes that overlay network 'voltha_net'
-# has already been created. To deploy the cluster, issue the command:
+# This stackfile deploys a Consul cluster to a docker swarm.
+#
+# The Consul cluster depends on:
+# - voltha_net (overlay network)
+#
+# To deploy the cluster, issue the command:
 #
 #     docker stack deploy -c docker-compose-consul-cluster.yml consul
 #
 # This command will create overlay network 'consul_net'.
 #
+
 version: "3"
 services:
 
   consul:
-    image: consul:latest
+    image: consul:0.9.2
 
     # Deploy to all docker manager nodes
     deploy:
-      replicas: 3
+      mode: global
       placement:
         constraints:
           - node.role == manager
@@ -33,6 +38,8 @@
       - -bind={{ GetInterfaceIP "eth0" }}
       - -client=0.0.0.0
       - -ui
+      - -raft-protocol=3
+      - -rejoin
       - -retry-join=172.29.20.2
       - -retry-join=172.29.20.3
       - -retry-join=172.29.20.4
@@ -47,6 +54,9 @@
       - "8400:8400"
       - "8500:8500"
       - "8600:8600/udp"
+    volumes:
+      - /cord/incubator/voltha/consul/data:/consul/data
+      - /cord/incubator/voltha/consul/config:/consul/config
 
 networks:
   net:
@@ -60,4 +70,3 @@
   voltha-net:
     external:
       name: voltha_net
-
diff --git a/consul_config/basic.json b/consul_config/basic.json
new file mode 100644
index 0000000..3a4db19
--- /dev/null
+++ b/consul_config/basic.json
@@ -0,0 +1,11 @@
+{
+    "autopilot":
+    {
+        "cleanup_dead_servers": true
+    },
+    "performance":
+    {
+        "raft_multiplier": 1
+    }
+}
+