Centos下安装部署DOCLever

   DOClever是一个可视化接口管理工具 ,可以分析接口结构,校验接口正确性, 围绕接口定义文档,通过一系列自动化工具提升我们的协作效率。

DOClever前后端全部采用了javascript来作为我们的开发语言,前端用的是vue+element UI,后端是express+mongodb,这样的框架集成了高并发,迭代快的特点,保证系统的稳定可靠。

#!/bin/bash
# @Author: HanWei
# @Date:   2020-03-06 14:57:43
# @Last Modified by:   HanWei
# @Last Modified time: 2020-03-06 16:27:35
# @E-mail: [email protected]
# 
# 
# 教程描述:安装DOCLever,需要提前准备安装包
HOME=/www/software
DOC_HOME=/www/server
function download ()
{
	cd /www/package
	wget https://nodejs.org/dist/v10.13.0/node-v10.13.0-linux-x64.tar.xz
	wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.4.tgz
}

function install_node ()
{
	cd /www/package
	tar xvJf node-v10.13.0-linux-x64.tar.xz
	mv node-v10.13.0-linux-x64 ${HOME}/node
	cat >> /ete/profile << EOF
	export NODE_HOME=${HOME}/node  
	export PATH=$NODE_HOME/bin:$PATH
EOF
source /etc/profile
node -v
}

function install_mongodb ()
{
	cd /www/package
	tar zxvf mongodb-linux-x86_64-4.0.4.tgz
	mv mongodb-linux-x86_64-4.0.4 ${HOME}/mongodb
	cd ${HOME}/mongodb
	mkdir db 
	mkdir logs 
	cd bin
	cat >>  mongodb.conf << EOF
port=27017
dbpath=/usr/local/mongodb/db
logappend=true
fork=true
logpath=/usr/local/mongodb/logs/mongpdb.log
#nohttpinterface=true
EOF
./mongod -f mongodb.conf
chmod +x /etc/rc.d/rc.local
echo "${HOME}/mongodb/bin/mongod --config ${HOME}/mongodb/bin/mongodb.conf" >> /etc/rc.d/rc.local
}

function install_DOC ()
{
	echo "安装前将源码解压到${SOC_HOME}/DOClever/"
	node ${SOC_HOME}/DOClever/Server/bin/www
	npm install -g cnpm --registry=https://registry.npm.taobao.org
	cnpm install forever -g
	forever start ${SOC_HOME}/DOClever/Server/bin/www
	echo "/www/software/node/bin/forever DOClever/Server/bin/www 2>&1 >>/tmp/doclever.log  & " >> /etc/rc.d/rc.local
	echo "这里 /www/DOClever/config.json 可以更改端口号"
}
download
install_node
install_mongodb
install_DOC
echo "安装完成"

你可能感兴趣的:(SHELL脚本)