dever 7 gadi atpakaļ
vecāks
revīzija
3c57a6b620

+ 6 - 0
src/docker/build/service/consul/consul.sh

@@ -9,8 +9,14 @@ start_consul()
 	elif [ "$1" == "client" ]; then
 		process_start consul agent -client -config-dir /root/consul/config -join 0.0.0.0
 	elif [ `echo $@|grep node|wc -l` -eq 1 ];then
+		if [ `echo $@|grep join|wc -l` != 1 ];then
+			echo "$ip consul_master" >> /etc/hosts
+		fi
 		process_start consul agent $@ -bind=$ip
     else
+    	if [ `echo $@|grep join|wc -l` != 1 ];then
+			echo "$ip consul_master" >> /etc/hosts
+		fi
         process_start consul agent $@ -bind=$ip -node=$ip
 	fi
 	#consul members

+ 4 - 4
src/docker/conf/daemon.conf

@@ -6,18 +6,18 @@ network = overlay_dm
 ;服务注册
 [master]
 image = consul
-port = 8500
+port = 8500:8500
 volumes = {container}conf/service/consul:/root/consul/config
-command = consul -server -bootstrap-expect 3 -data-dir=/root/consul/data -config-dir=/root/consul/config -client=0.0.0.0 -node={name} -dc={name}
+command = consul -server -bootstrap-expect 3 -data-dir=/root/consul/data -config-dir=/root/consul/config -client=0.0.0.0 -node=consul_master -dc={name}
 alias = consul
 slave = 2
-slave_command = consul -server -data-dir=/root/consul/data -config-dir=/root/consul/config -client=0.0.0.0 -join={parent} -dc={parent}
+slave_command = consul -server -data-dir=/root/consul/data -config-dir=/root/consul/config -client=0.0.0.0 -join=consul_master -dc={parent}
 
 ;服务发现
 [client]
 image = consul
 volumes = {container}conf/service/consul:/root/consul/config
-command = consul -data-dir=/root/consul/data -client=0.0.0.0 -join=daemon-master -dc=daemon-master
+command = consul -data-dir=/root/consul/data -client=0.0.0.0 -join=consul_master -dc=daemon-master
 alias = consul->consul_client
 
 ;文件共享与管理者

+ 1 - 0
src/tool/cluster.py

@@ -242,6 +242,7 @@ class Cluster_Action(Docker_Action):
 		import base64
 		url = 'http://' + ip + ':8500/v1/kv/' + ckey
 		value = Core.curl(url)
+		print value
 		value = json.loads(value)
 		if not value:
 			print 'join cluster:'+url+' error'

+ 1 - 4
src/tool/docker.py

@@ -534,10 +534,7 @@ class Image(object):
 				Core.shell('image.push ' + store + ' ' + value, bg=True)
 	@classmethod
 	def pull(self, stores):
-		store = stores[0]
-		if self.check(store) == 1:
-			del stores[0]
-			print Core.shell('image.pull ' + store, True)
+		print Core.shell('image.pull ' + stores[0], True)
 	@staticmethod
 	def show():
 		print Core.shell('image.show')