jenkins部署应用实践1-以部署tomcat为例

jenkins的具体配置:

1、general
1)项目名称:location
2)描述:
×××务运营平台
/tomcat/tomcat_location/upload/
/tomcat/tomcat_location/bin/
./startup.sh
在这里插入图片描述

2、源码管理
1)respository url:http://10.99.99.99/svn/ODS/LBIP/trunk
在这里插入图片描述

3、构建触发器
在这里插入图片描述

4、构建环境

5、构建
1)command
echo build phase 1 ${PWD}
echo ${CLASSPATH}
cp /home/zr/location/build.xml ${WORKSPACE}
rm -f ${WORKSPACE}/WebRoot/WEB-INF/lib/wstx-asl-3.2.0.jar
在这里插入图片描述

6、构建后操作
1)command
cd /tomcat/tomcat_location/upload/
./getwar
./ndeploy
在这里插入图片描述

Getwar:
ftp -niv <<!
open 10.99.99.99
user weblogic web123
binary
cd /var/lib/jenkins/workspace/location/build/
lcd /tomcat/tomcat_location/upload/
prompt
get ChannelWeb.war
bye

逻辑:
通过FTP的方式,从10.99.99.99的
/var/lib/jenkins/workspace/location/build/
中获取ChannelWeb.war文件,并将文件放到
/tomcat/tomcat_location/upload/

ndeploy:
cd /tomcat/tomcat_location/webapps/
cp ChannelWeb.war /tomcat/tomcat_location/upload/ChannelWeb.bak
cd /tomcat/tomcat_location/bin/
./shutdown.sh
cd /tomcat/tomcat_location/work/Catalina/localhost/
rm -rf *
cd /tomcat/tomcat_location/webapps/
rm -rf *
cd /tomcat/tomcat_location/upload/
cp ChannelWeb.war /tomcat/tomcat_location/webapps
cd /tomcat/tomcat_location/bin/
./startup.sh

逻辑:
备份原来的war包
停止服务
删除旧的war包与文件
删除tomcat缓存
获取war包到webapps目录下
启动服务

最后将这2个文件放在
/tomcat/tomcat_location/upload/
目录下,并给其赋予读写(rwx)权限。

博客主页:https://blog.csdn.net/yisumi

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值