(基于Jenkins + SVN + Ant + Weblogic Server的)应用程序自动(/一键)部署的设想
一直想实现自动部署,这里说的自动部署,是指点击一个按钮(或定时执行),让计算机将最新的应用程序发布到相应的环境(UAT或PRD)中。
自动部署的意义
自动部署能省去繁琐的人工发布步骤;如配置得当,发布的执行稳定性(成功率)会比较高。
这样主要有几点意义:
- 避免繁琐的人工发布。在开发阶段,User总比我们着急,希望快些看到新开发完成的模块,并进行适当的UAT测试。这就可能要求我们完成一个模块的开发和测试后,及时发布到UAT环境中。这时,如果我们配置好定时自动部署。这将避免了繁琐工作,事半功倍。
- 严谨。如果发布的流程比较复杂,发布过程由人工操作不可避免地会产生粗心的失误。而使用计算机帮忙调度发布的各个动作,如果配置正确,那么失误的可能性将大大降低,除非当初假设的环境参数发生改变。
我们开发中常用的软件组合为:Java + SVN(版本控制工具) + Ant(编译打包工具) + Weblogic(Web Server)。
所以我也是以这一套组合为设想,再加上自动部署工具Jenkins。
大家用的工具不尽相同,但工具间的使用或遵循的规范类似,所以切换应该是可行的。比如现在使用的Web Server是Weblogic,需要切换成Tomcat或Jboss,应该问题不大(但本人没试过- - !)。
以前做过上述的设想,但一直卡在Weblogic的更新问题上:如何使用脚本让Weblogic更新我们的应用程序。
最近仔细看了Weblogic文档,发现调用weblogic.Deployer能很好地满足我的需求。
发布的思路
那么,自动部署的思路是,使用Jenkins作为任务的总调度师
- Jenkins首先调用SVN更新代码。
- Jenkins再调用Ant将工程打成war。并拷贝到指定目录,这里的指定目录指Web Server读取源文件的目录(这个过程可由Ant的build.xml完成,也可由一个单独的脚本完成)。
- Jenkins再调用一个写好的脚本触发Web Server更新应用程序。比如,使用的是Weblogic,那么这个脚本中就可以使用weblogic.Deployer更新应用程序。
如何更新Weblogic部署的应用程序
weblogic.Deployer是class,所以执行时需附上对应classpath,JAR在$WLS_HOME/server/lib/weblogic.jar。
我使用redeploy的参数实现更新应用程序:
java -cp $WLS_HOME/server/lib/weblogic.jar weblogic.Deployer -adminurl t3://xx.xx.xx.xx:7001 -username weblogicusername -password weblogicpassword -name appname -redeploy
Call Redeploy App
PS,附上weblogic.Deployer的帮助信息:
Usage: java weblogic.Deployer [options] [action] [Deployment units(s)]
where options include:
-help Print the standard usage message.
-version Print version information.
-adminurl <<protocol>://<server>:<port>> [option] Administration
server URL: default t3://localhost:7001
-username <username> [option] user name
-password <password> [option] password for the user
-userconfigfile <userconfigfile> [option] The user config file
contains the user security credentials; it
is administered by the weblogic.Admin tool
-userkeyfile <keyConfigFile> [option] The users key file; it is
administered by the weblogic.Admin tool.
-distribute [action] Distribute application to the
targets.
-start [action] Makes an already distributed
application available on a target.
-stop [action] Makes an application unavailable on
targets.
-redeploy [action] Replace a running application
partially or entirely.
-undeploy [action] Take an application out of service.
-deploy [action] Make an application available for
service.
-update [action] Update an application configuration
in place.
-examples [option] Displays example usage of this tool.
-name <application name> [option] Defaults to the basename of the
deployment file or directory.
-targets <<target(s)>> [option] A comma separated list of targets
for the current operation. If not specified,
all configured targets are used. For a new
application, the default target is the
administration server.
-plan <Deployment plan path> [option] Specifies location of
deployment plan
-library [option] Indicates that the unit being
deployed is a library. This option is
required when the application is a library.
-advanced Print advanced usage options.
The optional trailing arguments are deployment units and may
represent the archive being deployed, the name of a previously
deployed application or a list of files for a partial redeploy operation.
(基于Jenkins + SVN + Ant + Weblogic Server的)应用程序自动(/一键)部署的设想的更多相关文章
- Jenkins+svn+ant+tomcat持续集成
转载自 http://www.cnblogs.com/liuhaixia/p/7267473.html Jenkins是基于Java开发的一种持续集成工具,用于监控秩序重复的工作.通过Jenkins+ ...
- Weblogic Server 的下载,安装配置与部署
下载 下载页面: http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html 目前 ...
- jenkins+svn+Ant+tomcat+非maven项目构建
首先,输入项目名称,创建一个自由风格的项目; 然后,配置旧项目的策略参数,目的是防止构建项目太多,占用资源. 下一步,jdk版本选择: 下一步,关联svn项目. 下一步:配置ant 看不清,再来一张. ...
- Jenkins+SVN+Ant在Linux环境下自动完成版本的增量更新与编译
第一步:查看安装的jdk版本,查看是否安装ant,查看是否安装Jenkins java -version ant -version rpm -qa|grep jenkins 第二步:安装ant 官网: ...
- 基于jenkins搭建一个持续集成服务器
1 引言 1.1 编写目的 指导质量管理部,业务测试组同事进行Jenkins环境部署,通过Jenkins解决测试环境不可控,开发测试环境不一致等问题. 1.2 使用对象 质量管理部.基础研发部,集成部 ...
- 基于Jenkins自动构建系统开发
1 绪论 1.1 课题的研究背景 随着IT行业的不断发展,软件开发的复杂度也随着不断提高.与此同时,软件的开发团队也越来越庞大,而如何更好地协同整个团队进行高效准确的工作,从而确保软件开发的质量已经 ...
- 基于Jenkins的环境搭建
基于 Jenkins 快速搭建持续集成环境 持续集成是一种软件开发实践,对于提高软件开发效率并保障软件开发质量提供了理论基础.Jenkins 是一个开源软件项目,旨在提供一个开放易用的软件平台,使持续 ...
- 基于 Jenkins 快速搭建持续集成环境--转
源地址:http://www.ibm.com/developerworks/cn/java/j-lo-jenkins/ 持续集成是一种软件开发实践,对于提高软件开发效率并保障软件开发质量提供了理论基础 ...
- 基于Jenkins的持续集成CI
CI(continuous integration)持续集成 一次构建:可能包含编译,测试,审查和部署,以及其他一些事情,一次构建就是将源代码放在一起,并验证软件是否可以作为一个一致的单元运行的过程. ...
随机推荐
- Android自己定义控件:进度条的四种实现方式
前三种实现方式代码出自: http://stormzhang.com/openandroid/2013/11/15/android-custom-loading/ (源代码下载)http://down ...
- 用Postfix + Dovecot 搭建的邮件server被垃圾邮件其中转server的处理
今天发邮件. 发送失败.然后到server上看日志, 发现硬盘被垃圾邮件的缓存队列和日志塞满了. tail -f /var/log/maillog 发现疯狂刷屏.部分日志例如以下 : ...
- eclipse no java machine vitual was found
eclipse no java machine vitual was found CreateTime--2018年4月27日10:41:20 Author:Marydon 1.错误提示 2.问题 ...
- window下rabbitmq的配置问题
最近项目想用个MQ来做业务分离,看了市面上众多产品,最后选了rabbitmq,理由很简单,对window的支持很到位(其实是公司的系列产品都是.net的). 安装方法什么的就不说了,直接到官网下载双击 ...
- python之函数用法bin()
# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法bin() #bin() #说明:一个整数转换为一个二进制字符串 ''' bin(.. ...
- 一段测试try...catch运行时间的代码
public class Test2 { private static int test() { int i=1; try { i=2; ...
- 用openssl生成SSL使用的私钥和证书,并自己做CA签名(转)
本 文记叙的是一次基于SSL的socket通讯程序开发中,有关证书,签名,身份验证相关的步骤. 我们的场景下,socket服务端是java语言编写的,客户端是c语言.使用了一个叫做matrixssl的 ...
- C-从源文件到可执行文件的详细编译链接过程
一直用windows一键搞定, 没有去了解详细的编译链接过程, 今天看了一篇文章, 顺便实验和记录在Linux下逐步生成的步骤. 预处理: 执行#include, #define, #if, #ifd ...
- Makefile 中:= ?= += =的区别【转】
转自:http://www.cnblogs.com/wanqieddy/archive/2011/09/21/2184257.html 在Makefile中我们经常看到 = := ?= +=这几个赋值 ...
- 用setitimer实现多个定时器
从这篇文章中可以看出,setitimer只能实现一个定时器,如果多次调用setitimer,旧值都会被覆盖掉. 如何用setitimer实现多个定时器呢?下面是我的一个实现,具体的方法是: 用链表从小 ...