Skip to content

Commit

Permalink
Merge pull request #43 from WeBankFinTech/dev
Browse files Browse the repository at this point in the history
deploy english version
  • Loading branch information
mingzhenliu authored Nov 20, 2019
2 parents c2f2902 + 3aabd33 commit b10194b
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 34 deletions.
25 changes: 16 additions & 9 deletions deploy/comm/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ def do():
print ("================================================================")
return

def start():
startNode()
startWeb()
startManager()
startFront()
return

def end():
stopNode()
stopWeb()
Expand Down Expand Up @@ -58,9 +65,9 @@ def installNode():
else:
info = "n"
if sys.version_info.major == 2:
info = raw_input("FISCO-BCOS节点目录nodes已经存在。是否重新安装?[y/n]:")
info = raw_input("FISCO-BCOS node directory “nodes” already exists. Reinstall or not?[y/n]:")
else:
info = input("FISCO-BCOS节点目录nodes已经存在。是否重新安装?[y/n]:")
info = input("FISCO-BCOS node directory “nodes” already exists. Reinstall or not?[y/n]:")
if info == "y" or info == "Y":
doCmdIgnoreException("bash nodes/127.0.0.1/stop_all.sh")
doCmd("rm -rf nodes")
Expand Down Expand Up @@ -141,9 +148,9 @@ def startWeb():
if os.path.exists("/run/nginx-webase-web.pid"):
info = "n"
if sys.version_info.major == 2:
info = raw_input("WeBASE-Web进程已经存在,是否kill进程强制重启?[y/n]:")
info = raw_input("WeBASE-Web Process already exists. Kill process to force restart?[y/n]:")
else:
info = input("WeBASE-Web进程已经存在,是否kill进程强制重启?[y/n]:")
info = input("WeBASE-Web Process already exists. Kill process to force restart?[y/n]:")
if info == "y" or info == "Y":
fin = open('/run/nginx-webase-web.pid', 'r')
pid = fin.read()
Expand Down Expand Up @@ -234,13 +241,13 @@ def installManager():
script_dir = server_dir + "/script"

if len(sys.argv) == 3 and sys.argv[2] == "travis":
print ("Travis CI 不初始化数据库")
print ("Travis CI do not initialize database")
else:
info = "n"
if sys.version_info.major == 2:
info = raw_input("是否初始化数据(首次部署或重建库需执行)?[y/n]:")
info = raw_input("Whether to initialize the data (the first deployment or rebuilding of the library needs to be performed)?[y/n]:")
else:
info = input("是否初始化数据(首次部署或重建库需执行)?[y/n]:")
info = input("Whether to initialize the data (the first deployment or rebuilding of the library needs to be performed)?[y/n]:")
if info == "y" or info == "Y":
os.chdir(script_dir)
doCmdIgnoreException("chmod u+x *.sh")
Expand Down Expand Up @@ -361,9 +368,9 @@ def installFront():
if res_file:
info = "n"
if sys.version_info.major == 2:
info = raw_input("WeBASE-Front数据库{}已经存在,是否删除重建?[y/n]:".format(frontDb))
info = raw_input("WeBASE-Front database {} already exists, delete rebuild or not?[y/n]:".format(frontDb))
else:
info = input("WeBASE-Front数据库{}已经存在,是否删除重建?[y/n]:".format(frontDb))
info = input("WeBASE-Front database {} already exists, delete rebuild or not?[y/n]:".format(frontDb))
if info == "y" or info == "Y":
doCmdIgnoreException("rm -rf {}/{}.*".format(db_dir,frontDb))

Expand Down
5 changes: 5 additions & 0 deletions deploy/comm/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ def do():
print ("===================== envrionment ready... =====================")
print ("================================================================")

def checkPort():
checkWebPort()
checkMgrPort()
checkFrontPort()

def installRequirements():
for require in checkDependent:
print ("check {}...".format(require))
Expand Down
4 changes: 2 additions & 2 deletions deploy/comm/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def dbConnect():
if result == 1:
info = "n"
if sys.version_info.major == 2:
info = raw_input("WeBASE-Node-Manager数据库{}已经存在,是否删除重建?[y/n]:".format(mysql_database))
info = raw_input("WeBASE-Node-Manager database {} already exists, delete rebuild or not?[y/n]:".format(mysql_database))
else:
info = input("WeBASE-Node-Manager数据库{}已经存在,是否删除重建?[y/n]:".format(mysql_database))
info = input("WeBASE-Node-Manager database {} already exists, delete rebuild or not?[y/n]:".format(mysql_database))
if info == "y" or info == "Y":
log.info(drop_db)
cursor.execute(drop_db)
Expand Down
8 changes: 4 additions & 4 deletions deploy/comm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ def pullSourceExtract(gitComm,fileName):
else:
info = "n"
if sys.version_info.major == 2:
info = raw_input("{}.zip编译包已经存在。是否重新下载?[y/n]:".format(fileName))
info = raw_input("{}.zip already exists. Download again or not?[y/n]:".format(fileName))
else:
info = input("{}.zip编译包已经存在。是否重新下载?[y/n]:".format(fileName))
info = input("{}.zip already exists. Download again or not?[y/n]:".format(fileName))
if info == "y" or info == "Y":
doCmd("rm -rf {}.zip".format(fileName))
doCmd("rm -rf {}".format(fileName))
Expand All @@ -192,9 +192,9 @@ def pullSourceExtract(gitComm,fileName):
else:
info1 = "n"
if sys.version_info.major == 2:
info1 = raw_input("{}.zip编译包已经解压。是否重新解压?[y/n]:".format(fileName))
info1 = raw_input("{}.zip has been unzipped. Whether to re-unzip?[y/n]:".format(fileName))
else:
info1 = input("{}.zip编译包已经解压。是否重新解压?[y/n]:".format(fileName))
info1 = input("{}.zip has been unzipped. Whether to re-unzip?[y/n]:".format(fileName))
if info1 == "y" or info1 == "Y":
doCmd("rm -rf {}".format(fileName))
doCmd("unzip -o {}.zip".format(fileName))
Expand Down
38 changes: 19 additions & 19 deletions deploy/common.properties
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
[common]

# WeBASE版本(v1.1.0或以上版本)
# Webase Version (V1.1.0 or above)
webase.version=v1.2.0

# 节点管理子系统mysql数据库配置
# Mysql database configuration of WeBASE-NodeManager
mysql.ip=localhost
mysql.port=3306
mysql.user=dbUsername
mysql.password=dbPassword
mysql.database=webasenodemanager

# 节点前置子系统h2数据库名
# H2 database name of WeBASE-Front
front.h2.name=webasefront

# WeBASE管理平台服务端口
# WeBASE-Web service port
web.port=5000
# 节点管理子系统服务端口
# WeBASE-NodeManager service port
mgr.port=5001
# 节点前置子系统端口
# WeBASE-Front service port
front.port=5002

# 节点监听Ip
# Node listening IP
node.listenIp=127.0.0.1
# 节点p2p端口
# Node p2p service port
node.p2pPort=30300
# 节点链上链下端口
# Node channel service port
node.channelPort=20200
# 节点rpc端口
# Node rpc service port
node.rpcPort=8545

# 是否使用已有的链(yes/no)
# Use existing chain or not(yes/no)
if.exist.fisco=no

# 使用已有链时需配置
# 已有链的路径,start_all.sh脚本所在路径
# 路径下要存在sdk目录,里面存放sdk证书(ca.crtnode.crt和node.key)
# Configuration is required when using the existing chain
# The path of the existing chain, the path of the start_all.sh script
# Under the path, there should be a SDK directory where the SDK certificates (ca.crt, node.crt and node. Key) are stored
fisco.dir=/data/app/nodes/127.0.0.1
# 前置所连接节点的绝对路径
# 路径下有conf目录,里面存放节点证书(ca.crtnode.crt和node.key)
# Absolute path of the connected node in WeBASE-Front
# Under the path, there is a conf directory where node certificates (ca.crt, node.crt and node. Key) are stored
node.dir=/data/app/nodes/127.0.0.1/node0

# 搭建新链时需配置
# FISCO-BCOS版本
# Configuration required when building a new chain
# Fisco-bcos version
fisco.version=2.0.0
# 搭建节点个数(默认两个)
# Number of building nodes (two by default)
node.counts=nodeCounts
4 changes: 4 additions & 0 deletions deploy/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ def do():
if "installAll" == param:
commCheck.do()
commBuild.do()
if "startAll" == param:
commCheck.checkPort()
commBuild.start()
elif "stopAll" == param:
commBuild.end()
elif "startNode" == param:
Expand Down Expand Up @@ -45,6 +48,7 @@ def help():
Parameter:
check: check the environment
installAll: check the environment, deploy all server
startAll: check server port, start all server
stopAll: stop all server
startNode: start FISCO-BCOS nodes
stopNode: stop FISCO-BCOS nodes
Expand Down

0 comments on commit b10194b

Please sign in to comment.