11.服务端项目自动化发布、验证、故障排查与解决
2020-06-07 本文已影响0人
惜小八
gitee地址:https://gitee.com/superzqbo/mmall_learning
自动化脚本地址:sudo wget http://learning.happymmall.com/deploy/deploy.sh
使用自动化发布脚本进行项目发布:
echo "===========进入git项目happymmall目录============="
cd /developer/git-repository/mmall_learning
echo "==========git切换分之到mmall-v1.0==============="
git checkout v1.0
echo "==================git fetch======================"
git fetch
echo "==================git pull======================"
git pull
echo "===========编译并跳过单元测试===================="
mvn clean package -Dmaven.test.skip=true
echo "============删除旧的ROOT.war==================="
rm /developer/setup/apache-tomcat-9.0.16/webapps/ROOT.war
echo "======拷贝编译出来的war包到tomcat下-ROOT.war======="
cp /developer/git-repository/mmall_learning/target/mmall_learning.war /developer/setup/apache-tomcat-9.0.16/webapps/ROOT.war
echo "============删除tomcat下旧的ROOT文件夹============="
rm -rf /developer/setup/apache-tomcat-9.0.16/webapps/ROOT
echo "====================关闭tomcat====================="
/developer/setup/apache-tomcat-9.0.16/bin/shutdown.sh
echo "================sleep 10s========================="
for i in {1..10}
do
echo $i"s"
sleep 1s
done
echo "====================启动tomcat====================="
/developer/setup/apache-tomcat-9.0.16/bin/startup.sh
发布完成后如下所示则发布成功(/developer/setup/apache-tomcat-9.0.16/webapps/ROOT.war存在)
image.png