WO2016000126A1 - 一种自动化部署方法和终端 - Google Patents

一种自动化部署方法和终端 Download PDF

Info

Publication number
WO2016000126A1
WO2016000126A1 PCT/CN2014/081157 CN2014081157W WO2016000126A1 WO 2016000126 A1 WO2016000126 A1 WO 2016000126A1 CN 2014081157 W CN2014081157 W CN 2014081157W WO 2016000126 A1 WO2016000126 A1 WO 2016000126A1
Authority
WO
WIPO (PCT)
Prior art keywords
maven
remote server
deployment
file
site
Prior art date
Application number
PCT/CN2014/081157
Other languages
English (en)
French (fr)
Inventor
江义旺
Original Assignee
北京新媒传信科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京新媒传信科技有限公司 filed Critical 北京新媒传信科技有限公司
Priority to PCT/CN2014/081157 priority Critical patent/WO2016000126A1/zh
Priority to CN201480010653.6A priority patent/CN106104467B/zh
Publication of WO2016000126A1 publication Critical patent/WO2016000126A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to an automated deployment method and terminal.
  • BACKGROUND OF THE INVENTION In recent years, agile development has become more and more popular in the field of software engineering. How to quickly adapt and guarantee the quality of software in the ever-changing needs, the concept of continuous deployment is extremely important. It enables development teams to introduce new features more quickly, fix bugs, reduce the complexity and variability of managing multiple versions and development branches, and discover software integration issues at any point in time, enabling deployment at any time. Software has become possible.
  • an embodiment of the present invention provides an automated deployment method and terminal.
  • an embodiment of the present invention provides an automated deployment method, including:
  • Use Maven to compile and package the obtained latest code to generate a package file; use the SSH protocol to connect to the remote server, and perform pre-processing before the package file is uploaded;
  • an embodiment of the present invention provides an automated deployment terminal, including: A configuration unit adapted to configure a project object model POM file in Maven; a running unit adapted to run a pre-written plug-in in Maven, the plug-in being based on a project management tool Maven, a version control tool SVN, and a secure shell SSH protocol write;
  • a code acquisition unit adapted to obtain the latest code from the SVN server
  • a compiling unit adapted to use Maven to compile and package the obtained latest code to generate a package file
  • the pre-processing unit is adapted to connect to the remote server by using the SSH protocol, and performs pre-processing before the package file is uploaded;
  • the uploading unit is adapted to upload the packaged file to the remote server by using an SSH protocol; and the restarting unit is configured to restart the site service of the remote server, record and report the deployment log.
  • the invention has the following advantages:
  • the automatic deployment method and the terminal provided by the embodiment of the present invention can configure the POM file in the Maven by following the convention, and then run the pre-written plug-in based on the Maven, SVN and SSH protocols in the Maven, as far as possible Eliminate the duplication of the build, abstract the project deployment lifecycle, implement most of the build tasks, no longer need to define the process, or even need to implement some of the tasks in the process, the deployment work will be automated, and the automation runs efficiently Order, easy to use, thus getting rid of the reliance on manual deployment operations, eliminating many repetitive tasks.
  • the solution of the embodiment of the present invention provides a set of development, testing, compiling, packaging, uploading for software or project deployment by implementing automatic version management, automatic compilation and packaging, automated remote server operation and file uploading, and automatic server restart and shutdown. , a complete set of lightweight solutions such as server configuration.
  • BRIEF DESCRIPTION OF THE DRAWINGS Figure 1 is a flow chart showing an automated deployment method of an embodiment of the present invention
  • FIG. 2 shows an example of performing an automated deployment plug-in of an embodiment of the present invention in an eclipse environment
  • FIG. 3 is a schematic structural diagram of an automated deployment terminal according to an embodiment of the present invention.
  • An embodiment of the present invention provides an automated deployment method. Referring to FIG. 1, the method includes the following steps:
  • Maven is an open source project management tool and build automation tool written in pure Java. Maven uses a POM (Project Object Model) concept to manage projects. POM is a file in a Maven project. It is represented in XML. All project configuration information is defined in a file called POM.xml. . Through this file, Maven can manage the entire lifecycle of a project, including compiling, building, testing, publishing, reporting, and more.
  • POM Project Object Model
  • the login authentication information for connecting to the remote server is configured
  • the login verification information includes: a remote server address, a username and a password; and, the site information of the remote server is configured.
  • the connection information of the remote server is configured in advance, which is the user login verification for the automated deployment scenario.
  • the plugin (also translated into English, Plug-in, addin, add-in, addon or add-on or app, ) is a computer program that interacts with the application to add some to the application. needs Specific features.
  • the plugin should be positioned to develop a program that does not have the functionality of the original pure system platform/application software platform. It can only run under the system platform specified by the program (may support multiple platforms at the same time), and cannot be run separately from the specified platform. Because the plugin needs to call the function library or data provided by the original pure system.
  • Maven itself supports a variety of plug-ins for easy and flexible control of projects. Because Maven's default build rules are highly reusable, it's common to build simple projects with two or three lines of Maven scripts. As a project management tool, Maven includes a POM, a set of standard groups, a project lifecycle (Project Lifecycle), a Dependency Management System, and logic to run plug-in targets defined in the lifecycle phase. . When using Maven, simply use a well-defined project object model POM to describe the project.
  • this plugin uses Maven to manage dependencies, project testing, compiling, and packaging, and is responsible for generating online packages.
  • Use Maven to manage the jar packages that the project depends on keep the project basic dependencies, eliminate redundant jar packages, and easily upgrade the dependent jar packages. On this basis, clean, compile, test, package, and release. Wait for the work of building the project.
  • SVN or Subversion
  • CVS Current Version System
  • Directory version control SVN can track changes to the entire directory by time, and both directories and files can be versioned.
  • Auto-commit Allows developers to create and commit changes in logical intervals to prevent problems that occur when partial submissions are successful.
  • Each file and directory is accompanied by a set of attribute keywords that are associated with attribute values to create and store any desired Key/Value pairs. Attributes are version controlled over time, just like file content.
  • SVN can be embedded as an extension module into the Apache HTTP service In the device.
  • the Apache HTTP server provides SVN with very advanced stability and interoperability, in addition to providing many important features. For example, there are authentication, authorization, online compression, and file library browsing.
  • the SVN server uses a custom communication protocol that can be easily used via SSH in a secure encrypted link (Tunnel).
  • SVN uses a binary difference algorithm to represent file differences. It treats both text and binary files equally. Both types of files are stored in compressed form in the same archive, and file differences are transmitted over the network in both directions.
  • Valid branches and tags The consumption on branches and tags does not have to be proportional to the size of the project.
  • the way SVN establishes branches and labels is just to copy the project, using a method similar to hard-link. So these operations will only take a small amount of time and are fixed times.
  • SVN does not have any historical burden. It is mainly a group of shared C libraries with well-defined APIs. This makes the SVN easy to maintain and can be used by other applications and programming languages.
  • SVN is an excellent version control tool.
  • the plug-in written by the embodiment of the present invention can be used for version control by using SVN, to track and maintain changes of source code, files, setting documents, etc., and to provide a program for controlling the control of these changes, and to protect the code submitted by the team members. It does not cause the integration to fail.
  • the code is submitted to the SVN server and the compiler obtains the latest code from the SVN server.
  • SSH Secure Shell
  • SSH Secure Shell
  • the SSH protocol is currently a more reliable protocol that provides security for remote login sessions and other network services.
  • the SSH protocol can effectively prevent the information leakage problem in the remote management process.
  • the plug-in written in the embodiment of the present invention implements a secure and reliable remote connection between the client and the server, and remote command execution based on the SSH protocol.
  • the SSH protocol consists of the following three parts: The security and confidentiality mechanism of the SSH protocol is implemented together.
  • is a transport layer protocol that provides security measures such as authentication, trust, and integrity checks, and it also provides data compression.
  • these transport layer protocols are built on top of a connection-oriented TCP data stream.
  • the second is the user authentication protocol layer, which is used to implement identity authentication between the server and the client user. It runs on the transport layer protocol.
  • the third is to connect the protocol layer, assign multiple encrypted channels to some logical channels, and it runs on the user authentication layer protocol.
  • the client After the secure transport layer connection is established, the client will send a service request. A second service request will be sent when the user authentication layer connection is established. This allows the newly defined protocol to coexist with the previous protocol.
  • Connection protocols provide a channel for a variety of purposes, providing a standard way to set up secure interactive shell sessions and transport arbitrary TCP/IP ports and XI I connections.
  • SSH provides two levels of security authentication: The first level (password-based security authentication), you can log in to the remote host as long as you know your account and password. The second level (key-based security verification) relies on the key. If you want to connect to the SSH server, the client software will send a request to the server to request security verification with the key.
  • Maven has a lifecycle that is called when mvn install is run. This command tells Maven to perform a series of ordered steps until the specified life cycle is reached. As shown in Figure 2, Figure 2 is an example of configuring a plug-in execution command in an eclipse environment. After executing the command Run as, the Maven command can be executed automatically in the project to execute mvn: com. feinno.Mavn-RDP: deploy.
  • the plug-in written by the embodiment of the present invention abstracts the life cycle of the project deployment.
  • Maven begins to build a project, it is implemented by defining the phase steps of the sequence and the goals of each phase of the registration. The order of execution depends on the order in which the target and build phases are called.
  • SVN is a centralized file version management system.
  • the plug-in When executed, it is first automated to the SVN server to get the latest code.
  • the plug-in written by the present invention is also constructed with a test phase.
  • Maven Before using Maven to compile and package the latest code obtained, Maven is used to automatically test the latest code, and if the test fails, only when the test passes. Only use Maven to automate the compilation and packaging of the latest code obtained.
  • the pre-processing before the package file uploads one or more of the following operations: backing up the data, stopping the site when the remote server's site already exists, killing related processes to stop the service, executing related scripts before going live, and so on.
  • connection to the remote server wherein the configured connection information includes information such as a remote server address, a username, and a password, and then automatically performs the series of pre-processed contents before the packaged file is uploaded.
  • the SSH protocol is automatically used to upload the packaged file to the specified location.
  • the deployment log includes a record of successful deployment or a record of failed deployment. After the site service is restarted, the entire automated deployment is complete. You need to record the deployment logs and report the deployment logs to the control terminal.
  • the method of the embodiment of the present invention further includes: detecting a deployment result, and automatically restoring the site service if the deployment fails. This operation ensures the security and reliability of the automated deployment solution.
  • the automated deployment method of the embodiments of the present invention provides a complete solution for automated version management, automated compilation and packaging, automated remote server operation and file upload, and automated server restart and shutdown.
  • the embodiment of the present invention further provides an automated deployment terminal based on the same inventive concept as the above-described automated deployment method of the embodiment of the present invention.
  • the automated deployment terminal 300 provided by the embodiment of the present invention includes:
  • the configuration unit 301 is adapted to configure the project object model POM file in the Maven according to the convention; the running unit 302 is adapted to run the pre-written plug-in in the Maven, the plug-in is based on the project management tool Maven, the version control tool SVN and the secure shell SSH The agreement is written;
  • the code obtaining unit 303 is adapted to obtain the latest code from the SVN server;
  • the compiling unit 304 is adapted to compile and package the obtained latest code by using Maven to generate a package file.
  • the pre-processing unit 305 is adapted to connect to the remote server by using the SSH protocol, and perform pre-processing before the package file uploading;
  • the uploading unit 306 is adapted to upload the packaged file to the remote server by using an SSH protocol.
  • the restarting unit 307 is adapted to restart the site service of the remote server, and record and report the deployment log.
  • the configuration unit 301 includes one or more configuration modules as follows:
  • a first configuration module configured to configure address information of the SVN server;
  • a second configuration module configured to configure login verification information connected to the remote server, where the login verification Information includes: remote server address, username and password; and/or,
  • the third configuration module is adapted to configure site information of the remote server.
  • the automated deployment terminal 300 of the present invention may further include:
  • the test unit is adapted to test the latest code using Maven before compiling and packaging the obtained latest code using Maven.
  • the pre-processing unit 305 includes one or more of the following modules:
  • Site stop module adapted to stop the site when the remote server's site already exists
  • Service stop module suitable for stopping the service
  • a script execution module suitable for executing related scripts before going online.
  • the automated deployment terminal 300 of the present invention may further include:
  • a detection unit suitable for detecting deployment results, automatically restores the site service if the deployment fails.
  • the above-mentioned units or modules of the automated deployment terminal of the embodiment of the present invention respectively correspond to the method steps of the automatic deployment of the embodiment of the present invention, and details are not described herein again.
  • the automated deployment method and terminal provided by the embodiments of the present invention can eliminate the build by using the Maven, SVN, and SSH-based plug-ins in the Maven by configuring the POM file in the Maven and then running the pre-written plug-in based on the Maven, SVN, and SSH protocols in the Maven.
  • the solution of the embodiment of the present invention provides a set of development, testing, compiling, packaging, uploading for software or project deployment by implementing automatic version management, automatic compilation and packaging, automated remote server operation and file uploading, and automatic server restart and shutdown. , a complete set of lightweight solutions such as server configuration.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

一种自动化部署方法和终端,包括:遵循约定配置Maven中的项目对象模型POM文件(S11);在Maven中运行预先编写的插件(S12),所述插件基于项目管理工具Maven、版本控制工具SVN和安全外壳SSH协议进行编写;从SVN富翁i获取最新代码(S13);使用Maven对获取的所述最新代码进行编译打包,生成打包文件(S14);使用SSH协议连接远程服务器,进行打包文件上传前的预处理(S15);使用SSH协议上传所述打包文件到所述远程服务器(S16);重启所述远程服务器的站点服务,记录并上报部署日志(S17)。所述方法和终端为项目部署提供一套从开发,测试,编译,打包,上传,服务器配置等一整套轻量级解决方案。

Description

一种自动化部署方法和终端 技术领域 本发明涉及计算机技术领域, 特别涉及一种自动化部署方法和终端。 发明背景 近些年来, 敏捷开发在软件工程领域越来越红火, 如何能在不断变化的需 求中快速适应和保证软件的质量, 持续部署理念极为重要。 它使得开发团队能 够更加快速引入新特性, 修复 bug , 减少管理多个版本及开发分支的复杂性与差 异性, 任何时间点都能第一时间发现软件的集成问题, 使任意时间发布可部署 的软件成为了可能。
然而在现有的项目部署流程中, 仍需要进行很多手动操作, 包括备份原站 点、 停掉原站点、 执行相关脚本、 上传软件包到远程服务器, 重启站点服务等, 人工成本高, 低效且容易出错。 另外, 测试、 编译、 打包、 上传、 服务器配置 等工作都是相互独立的, 各个环节分离无连贯性, 花费时间长, 过程繁瑣, 重 复性动作多。 发明内容 为了解决上述问题, 或者部分地解决上述问题, 本发明实施例提供了一种 自动化部署方法和终端。
为了达到上述目的, 本发明实施例釆用的技术方案如下:
一方面, 本发明实施例提供了一种自动化部署方法, 包括:
遵循约定配置 Maven中的项目对象模型 POM 文件;
在 Maven 中运行预先编写的插件, 所述插件基于项目管理工具 Maven 、 版本控制工具 SVN和安全外壳 SSH协议进行编写;
从 SVN服务器获取最新代码;
使用 Maven对获取的所述最新代码进行编译打包, 生成打包文件; 使用 SSH协议连接远程服务器, 进行打包文件上传前的预处理;
使用 SSH协议上传所述打包文件到所述远程服务器;
重启所述远程服务器的站点服务, 记录并上报部署日志。
另一方面, 本发明实施例提供了一种自动化部署终端, 包括: 配置单元, 适于遵循约定配置 Maven中的项目对象模型 POM 文件; 运行单元, 适于在 Maven 中运行预先编写的插件, 所述插件基于项目管理 工具 Maven 、 版本控制工具 SVN和安全外壳 SSH协议进行编写;
代码获取单元, 适于从 SVN服务器获取最新代码;
编译单元, 适于使用 Maven对获取的所述最新代码进行编译打包, 生成打 包文件;
预处理单元, 适于使用 SSH协议连接远程服务器, 进行打包文件上传前的 预处理;
上传单元, 适于使用 SSH协议上传所述打包文件到所述远程服务器; 重启单元, 适于重启所述远程服务器的站点服务, 记录并上报部署日志。 本发明的有益效果是: 本发明实施例提供的自动化部署方法和终端, 通过 遵循约定配置 Maven中的 POM 文件, 然后在 Maven 中运行预先编写的基于 Maven 、 SVN和 SSH协议的插件, 可以尽可能消除构建的重复, 抽象项目部署 生命周期, 实现绝大部分的构建任务, 不再需要定义过程, 甚至不需要再去实 现这些过程中的一些任务, 部署工作便会自动化运行, 且自动化运行高效有序, 方便易用, 从而摆脱对手动部署操作的依赖, 消除许多的重复工作。 本发明实 施例的方案通过实现自动化版本管理、 自动化编译打包、 自动化远程服务器操 作和文件上传、 以及自动化服务器重启和关闭, 从而为软件或项目部署提供一 套从开发, 测试, 编译, 打包, 上传, 服务器配置等一整套轻量级解决方案。 附图简要说明 图 1示出了本发明实施例的一种自动化部署方法的流程图;
图 2示出了在 eclipse环境中执行本发明实施例的自动化部署插件的示例; 图 3示出了本发明实施例的一种自动化部署终端的结构示意图。 实施本发明的方式 为使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图对本发明 实施方式作进一步地详细描述。
本发明实施例提供了一种自动化部署方法, 参见图 1 , 包括如下步骤:
S 11、 遵循约定配置 Maven中的项目对象模型 POM 文件。
Maven是一个釆用纯 Java编写的开源项目管理工具和构建自动化工具。 Maven釆用了一种 POM ( Project Object Model, 项目对象模型)概念来管理项 目 , POM是 Maven项目中的文件, 使用 XML表示, 所有的项目配置信息都被 定义在一个叫做 POM.xml的文件中。 通过该文件, Maven可以管理项目的整个 生命周期, 包括编译、 构建、 测试、 发布、 报告等等。
在运行本发明实施例编写的插件之前, 有必要遵循约定配置 Maven 中的 POM 文件。 在本发明中, 仅需要在 Maven 中对 POM 文件进行少量配置, 不 用编写各种脚本, 简单易用。
下面是自动化部署插件的基本配置的一个示例:
. ; : ; <: d d f es s lS2,ieS^^^^ <■ /ad d ί ^ s.
: : : ! m¾!" root s sr : srs /da ta feidou tomc t_7 47— S 7/ ½« a pps/ te^i >
'^ΐ er -、/dats/f e dou/tomca £— θΰ /weba pps /: $f >
; ;
;
■ ; : :
Figure imgf000005_0001
在上述示例中, 对连接远程服务器的登录验证信息进行了配置, 所述登录 验证信息包括: 远程服务器地址、 用户名和密码; 以及, 对远程服务器的站点 信息进行了配置。 事先配置远程服务器的连接信息, 是用于自动化部署方案的 用户登录验证。 当然,还可以根据需要对 Maven 的依赖库的搜索路径进行配置, 这其中包括配置 SVN服务器的地址信息。
S12 , 在 Maven 中运行预先编写的插件, 所述插件基于项目管理工具 Maven 、 版本控制工具 SVN和安全外壳 SSH协议进行编写。
插件 (又译夕卜挂, 英文为 Plug-in、 addin、 add-in、 addon或 add-on或 app , ) 是一种电脑程序, 通过与应用程序的互动, 用来替应用程序增加一些所需要的 特定的功能。 插件的定位应该是开发实现原纯净系统平台 /应用软件平台不具备 的功能的程序,其只能运行在程序规定的系统平台下(可能同时支持多个平台), 而不能脱离指定的平台单独运行, 因为插件需要调用原纯净系统提供的函数库 或者数据。
本发明实施例中编写的插件具有如下特征:
a)基于 Maven作为项目管理工具
Maven本身支持多种插件, 可以方便灵活的控制项目。 由于 Maven的缺省 构建规则有较高的可重用性, 所以常常用两三行 Maven脚本就可以构建简单的 项目。 作为一个项目管理工具, Maven 包含了一个 POM, —组标准集合, 一个 项目生命周期 ( Project Lifecycle ), 一个依赖管理系统 ( Dependency Management System ),和用来运行定义在生命周期阶段中插件目标的逻辑。 当使用 Maven 的 时候, 只需用一个明确定义的项目对象模型 POM来描述项目即可。
通过编写一个基于 Maven 的插件, 此插件用 Maven管理依赖, 项目测试, 编译, 打包, 负责生成上线包。 使用 Maven对项目依赖的 jar包进行管理, 让 项目保持基本的依赖, 排除冗余 jar包, 非常轻松的对依赖的 jar包进行版本升 级, 在这基础上完成清理、 编译、 测试、 打包、 发布等构建项目的工作。
b)基于 SVN实现版本控制
SVN, 即 Subversion, 是版本管理工具 CVS ( Concurrent Version System ) 的重写版和改进版, 主要实现文件管理及文件版本管理。 SVN提供以下主要功
•6匕 .
目录版本控制: SVN能够依时间跟踪整个目录的变动, 目录和文件都能进 行版本控制。
真实的版本历史:在 SVN中,你可以增加(add )、删除(delete )、复制(copy ) 和重命名 (rename ), 无论是文件还是目录, 所有的新加的文件都从一个新的、 干净的版本开始。
自动提交: 允许开发人员以逻辑区间建立并提交变动, 以防止当部分提交 成功时出现的问题。
纳入版本控管的元数据: 每一个文件与目录都附有一组属性关键字, 并和 属性值相关联, 可以创建并存储任何想要的 Key/Value对。 属性是随着时间进行 版本控管的, 就像文件内容一样。
选择不同的网络层: SVN可以作为一个扩展模块嵌入到 Apache HTTP服务 器中。 Apache HTTP服务器为 SVN提供了非常先进的稳定性和协同工作能力, 除此之外还提供了许多重要功能。 举例来说, 有身份认证、 授权、 在线压缩、 以及文件库浏览等等。 SVN服务器使用自定义的通信协议, 可以很容易地通过 SSH 以安全加密链路 ( Tunnel ) 方式使用。
一致的数据处理方式: SVN使用二进制差异算法来表示文件的差异, 它对 文字与二进制文件两类的文件都一视同仁。 这两类的文件都同样地以压缩形式 储存在档案库中, 而且文件差异是以两个方向在网络上传输的。
有效的分支与标签: 在分支(branch ) 与标签(tag )上的消耗并不必一定 要与项目大小成正比。 SVN建立分支与标签的方法, 就只是复制该项目, 使用 的方法类似于硬连接(hard-link )。 所以这些操作只会花费很小, 而且是固定的 时间。
可编程性 (Hackability): SVN没有任何的历史包袱, 它主要是一群共用的 C 程序库, 具有定义完善的 API。 这使得 SVN便于维护, 并且可被其它应用程序 与程序语言使用。
由此可知, SVN是一个优秀的版本控制工具。 本发明实施例编写的插件通 过集成 SVN, 使用 SVN可以进行版本控制, 来追踪、 维护源码、 文件以及设定 文档等等的改动, 并且提供控制这些改动控制权的程序, 保障团队成员提交的 代码不会导致集成失败, 代码开发完毕提交到 SVN服务器, 由编译器向 SVN 服务器获取最新代码。
c)基于 SSH协议实现远程服务器安全操作
SSH( Secure Shell, 安全外壳), 即 "安全壳协议", 是一项建立在应用层和 传输层基础上的安全协议。 SSH协议是目前较可靠, 专为远程登录会话和其他 网络服务提供安全性的协议。利用 SSH协议可以有效防止远程管理过程中的信 息泄露问题, 本发明实施例编写的插件基于 SSH协议实现客户端和服务器端的 安全和可靠的远程连接, 以及远程命令执行。
SSH协议主要由以下三部分组成, 共同实现 SSH协议的安全保密机制。 ― 是传输层协议, 它提供诸如认证、 信任和完整性检验等安全措施, 此外它还可 以提供数据压缩功能。 通常情况下, 这些传输层协议都建立在面向连接的 TCP 数据流之上。 二是用户认证协议层, 用来实现服务器跟客户端用户之间的身份 认证, 它运行在传输层协议之上。 三是连接协议层, 分配多个加密通道至一些 逻辑通道上, 它运行在用户认证层协议之上。 当安全的传输层连接建立之后, 客户端将发送一个服务请求。 当用户认证 层连接建立之后将发送第二个服务请求。 这就允许新定义的协议可以和以前的 协议共存。 连接协议提供可用作多种目的的通道, 为设置安全交互 Shell会话和 传输任意的 TCP/IP端口和 XI I连接提供标准方法。
从客户端来看, SSH提供两种级别的安全验证: 第一种级别 (基于口令的 安全验证),只要知道自己帐号和口令,就可以登录到远程主机。第二种级别(基 于密匙的安全验证), 需要依靠密匙, 如果要连接到 SSH服务器上, 客户端软件 就会向服务器发出请求, 请求用密匙进行安全验证。
Maven有一个生命周期, 当运行 mvn install 的时 4昊被调用。 这条命令告诉 Maven执行一系列的有序的步骤, 直到到达指定的生命周期。 如图 2所示, 图 2 是在 eclipse环境中配置插件执行命令的示例。 执行命令 Run as配置完成后, 在 项目中执行 Maven命令即可自动执行 mvn: com. feinno.Mavn-RDP: deploy。
本发明实施例编写的插件, 抽象了项目部署的生命周期。 当 Maven开始建 立一个项目, 它通过定义序列的阶段步骤和执行注册的每个阶段的目标来实现, 执行的顺序取决于目标和构建阶段被调用的顺序。
以下即是在 Maven 中运行本发明编写的插件实现自动化部署的步骤。
513、 从 SVN服务器获取最新代码。
SVN是一种集中式文件版本管理系统,插件执行时首先自动化到 SVN服务 器获取最新代码。
514、 使用 Maven对获取的最新代码进行编译打包, 生成打包文件。
一种实施例,根据需要本发明编写的插件还构建有测试阶段,在使用 Maven 对获取的最新代码进行编译打包之前,使用 Maven对最新代码进行自动化测试, 测试失败则返回, 只有测试通过时, 才使用 Maven对获取的所述最新代码进行 自动化编译打包。
515、 使用 SSH协议连接远程服务器, 进行打包文件上传前的预处理。 打包文件上传前的预处理依次操作如下的一项或多项: 备份数据、 在远程 服务器的站点已存在时停止站点、 杀掉相关进程以停止服务、 执行上线前相关 脚本等等。
打包文件上传前的上述预处理操作同于现有方案, 不同的是不再依赖手动 操作, 完全是自动化操作。在本发明实施例中,依据在 POM 文件中所配置的信 息连接远程服务器, 其中所述配置的连接信息包括远程服务器地址、 用户名和 密码等信息, 然后自动进行打包文件上传前的这一系列的预处理内容。
516、 使用 SSH协议上传打包文件到所述远程服务器。
文件上传前的预处理完成后, 即自动使用 SSH协议上传打包文件到指定位 置。
517、 重启所述远程服务器的站点服务, 记录并上报部署日志。
部署日志包括部署成功的记录, 或者部署失败的记录。 重启站点服务后, 整个自动化部署工作完成, 需要对部署日志做记录, 并上报部署日志至控制终 端。
可选地, 本发明实施例的方法还包括: 检测部署结果, 如果部署失败, 则 自动还原站点服务。 该操作可以保证自动化部署方案的安全性和可靠性。
可见, 本发明实施例的自动化部署方法, 为自动化版本管理、 自动化编译 打包、 自动化远程服务器操作和文件上传、 以及自动化服务器重启和关闭提供 了一整套的解决方案。 基于与上述本发明实施例的自动化部署方法相同的发明构思, 本发明实施 例还提供了一种自动化部署终端。 参见图 3 , 本发明实施例提供的自动化部署终 端 300包括:
配置单元 301 , 适于遵循约定配置 Maven中的项目对象模型 POM 文件; 运行单元 302, 适于在 Maven 中运行预先编写的插件, 所述插件基于项目 管理工具 Maven 、 版本控制工具 SVN和安全外壳 SSH协议进行编写;
代码获取单元 303 , 适于从 SVN服务器获取最新代码;
编译单元 304, 适于使用 Maven对获取的所述最新代码进行编译打包, 生 成打包文件;
预处理单元 305 , 适于使用 SSH协议连接远程服务器, 进行打包文件上传 前的预处理;
上传单元 306, 适于使用 SSH协议上传所述打包文件到所述远程服务器; 重启单元 307,适于重启所述远程服务器的站点服务,记录并上报部署日志。 一个实施例, 上述配置单元 301包括如下一种或多种配置模块:
第一配置模块, 适于配置 SVN服务器的地址信息; 和 /或,
第二配置模块, 适于配置连接远程服务器的登录验证信息, 所述登录验证 信息包括: 远程服务器地址、 用户名和密码; 和 /或,
第三配置模块, 适于配置远程服务器的站点信息。
在该实施例中, 釆用了 "第一"、 "第二" 等字样对功能和作用基本相同的 相同项或相似项进行区分, 本领域技术人员可以理解 "第一"、 "第二" 等字样 并不对数量和执行次序进行限定。
另一个实施例, 本发明的自动化部署终端 300还可以包括:
测试单元, 适于使用 Maven对获取的所述最新代码进行编译打包之前, 使 用 Maven对所述最新代码进行测试。
再一个实施例, 上述预处理单元 305包括如下一种或多种模块:
备份模块, 适于备份数据;
站点停止模块, 适于在远程服务器的站点已存在时停止站点;
服务停止模块, 适于停止服务;
脚本执行模块, 适于执行上线前相关脚本。
再又一个实施例中, 本发明的自动化部署终端 300还可以包括:
检测单元, 适于检测部署结果, 如果部署失败, 则自动还原站点服务。 本发明实施例的自动化部署终端的上述单元或模块,分别对应本发明 实施例的自动化部署的方法步骤, 在此不再赘述。 综上所述, 本发明实施例提供的自动化部署方法和终端, 通过遵循约定配 置 Maven中的 POM文件,然后在 Maven 中运行预先编写的基于 Maven 、 SVN 和 SSH协议的插件, 可以尽可能消除构建的重复, 抽象项目部署生命周期, 实 现绝大部分的构建任务, 不再需要定义过程, 甚至不需要再去实现这些过程中 的一些任务, 部署工作便会自动化运行, 且自动化运行高效有序, 方便易用, 从而摆脱对手动部署操作的依赖, 消除许多的重复工作。 本发明实施例的方案 通过实现自动化版本管理、 自动化编译打包、 自动化远程服务器操作和文件上 传、 以及自动化服务器重启和关闭, 从而为软件或项目部署提供一套从开发, 测试, 编译, 打包, 上传, 服务器配置等一整套轻量级解决方案。
以上所述仅为本发明的较佳实施例而已, 并非用于限定本发明的保护范围。 凡在本发明的精神和原则之内所作的任何修改、 等同替换、 改进等, 均包含在 本发明的保护范围内。

Claims

权利要求书
1、 一种自动化部署方法, 其特征在于, 所述方法包括:
遵循约定配置 Maven中的项目对象模型 POM 文件;
在 Maven 中运行预先编写的插件, 所述插件基于项目管理工具 Maven 、 版本控制工具 SVN和安全外壳 SSH协议进行编写;
从 SVN服务器获取最新代码;
使用 Maven对获取的所述最新代码进行编译打包, 生成打包文件; 使用 SSH协议连接远程服务器, 进行打包文件上传前的预处理;
使用 SSH协议上传所述打包文件到所述远程服务器;
重启所述远程服务器的站点服务, 记录并上报部署日志。
2、 如权利要求 1所述的方法, 其特征在于, 所述遵循约定配置 Maven中的 项目对象模型 POM 文件包括:
配置 SVN服务器的地址信息; 和 /或,
配置连接远程服务器的登录验证信息, 所述登录验证信息包括远程服务器 地址、 用户名和密码; 和 /或,
配置远程服务器的站点信息。
3、 如权利要求 1所述的方法, 其特征在于, 所述使用 Maven对获取的所 述最新代码进行编译打包之前, 所述方法还包括:
使用 Maven对所述最新代码进行测试;
相应的, 所述使用 Maven对获取的所述最新代码进行编译打包具体为: 当所述测试通过时, 使用 Maven对获取的所述最新代码进行编译打包。
4、 如权利要求 1所述的方法, 其特征在于, 所述进行打包文件上传前的预 处理包括:
依次操作如下的一项或多项: 备份数据、 在远程服务器的站点已存在时停 止站点、 停止服务、 以及执行上线前相关脚本。
5、 如权利要求 1-4任一项所述的方法, 其特征在于, 所述方法还包括: 检测部署结果, 如果部署失败, 则自动还原站点服务。
6、 一种自动化部署终端, 其特征在于, 包括:
配置单元, 适于遵循约定配置 Maven中的项目对象模型 POM 文件; 运行单元, 适于在 Maven 中运行预先编写的插件, 所述插件基于项目管理 工具 Maven 、 版本控制工具 SVN和安全外壳 SSH协议进行编写;
代码获取单元, 适于从 SVN服务器获取最新代码;
编译单元, 适于使用 Maven对获取的所述最新代码进行编译打包, 生成打 包文件;
预处理单元, 适于使用 SSH协议连接远程服务器, 进行打包文件上传前的 预处理;
上传单元, 适于使用 SSH协议上传所述打包文件到所述远程服务器; 重启单元, 适于重启所述远程服务器的站点服务, 记录并上报部署日志。
7、 如权利要求 6所述的终端, 其特征在于, 所述配置单元包括如下一种或 多种配置模块:
第一配置模块, 适于配置 SVN服务器的地址信息; 和 /或,
第二配置模块, 适于配置连接远程服务器的登录验证信息, 所述登录验证 信息包括: 远程服务器地址、 用户名和密码; 和 /或,
第三配置模块, 适于配置远程服务器的站点信息。
8、 如权利要求 6所述的终端, 其特征在于, 所述终端还包括:
测试单元, 适于使用 Maven对获取的所述最新代码进行编译打包之前, 使 用 Maven对所述最新代码进行测试。
9、 如权利要求 6所述的终端, 其特征在于, 所述预处理单元包括如下一种 或多种模块:
备份模块, 适于备份数据;
站点停止模块, 适于在远程服务器的站点已存在时停止站点;
服务停止模块, 适于停止服务;
脚本执行模块, 适于执行上线前相关脚本。
10、 如权利要求 6-9任一项所述的终端, 其特征在于, 所述终端还包括: 检测单元, 适于检测部署结果, 如果部署失败, 则自动还原站点服务。
PCT/CN2014/081157 2014-06-30 2014-06-30 一种自动化部署方法和终端 WO2016000126A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2014/081157 WO2016000126A1 (zh) 2014-06-30 2014-06-30 一种自动化部署方法和终端
CN201480010653.6A CN106104467B (zh) 2014-06-30 2014-06-30 一种自动化部署方法和终端

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/081157 WO2016000126A1 (zh) 2014-06-30 2014-06-30 一种自动化部署方法和终端

Publications (1)

Publication Number Publication Date
WO2016000126A1 true WO2016000126A1 (zh) 2016-01-07

Family

ID=55018221

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/081157 WO2016000126A1 (zh) 2014-06-30 2014-06-30 一种自动化部署方法和终端

Country Status (2)

Country Link
CN (1) CN106104467B (zh)
WO (1) WO2016000126A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106325881A (zh) * 2016-08-30 2017-01-11 泰康保险集团股份有限公司 发布包自动生成方法及装置
CN106933573A (zh) * 2017-02-22 2017-07-07 广东网金控股股份有限公司 一种通过svn配置文件获取用户与角色的方法和系统
CN107133036A (zh) * 2017-04-26 2017-09-05 武汉斗鱼网络科技有限公司 一种模块的管理方法及装置
CN107885658A (zh) * 2017-10-31 2018-04-06 平安科技(深圳)有限公司 测试前置实现方法、装置、终端设备及存储介质
CN108628632A (zh) * 2018-03-20 2018-10-09 车音智能科技有限公司 一种打包方法及装置
CN112231302A (zh) * 2020-10-30 2021-01-15 深圳开源互联网安全技术有限公司 Java开源组件数据库的维护方法、装置及存储介质
CN117076004A (zh) * 2023-10-13 2023-11-17 美云智数科技有限公司 微服务打包合并方法、装置和电子设备

Families Citing this family (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106775730A (zh) * 2016-12-21 2017-05-31 深圳Tcl数字技术有限公司 程序发布方法及系统
CN108804088B (zh) * 2018-04-25 2022-03-08 广州视源电子科技股份有限公司 协议处理方法和装置
CN108647037A (zh) * 2018-04-28 2018-10-12 新疆熙菱信息技术股份有限公司 基于shell脚本的自动化部署方法和系统
CN110554876A (zh) * 2018-05-31 2019-12-10 北京京东尚科信息技术有限公司 用于编译安卓工程的方法和装置
CN108958753B (zh) * 2018-07-13 2022-04-12 中国银行股份有限公司 一种代码打包部署方法及装置
CN109254765B (zh) * 2018-08-22 2023-08-25 平安科技(深圳)有限公司 定时任务管理方法、装置、计算机设备及存储介质
CN109101269A (zh) * 2018-08-30 2018-12-28 长沙软工信息科技有限公司 一种软件交付方法及装置、电子设备
CN109582319B (zh) * 2018-12-04 2022-02-08 北京奇艺世纪科技有限公司 一种业务代码部署方法及装置
CN110262806B (zh) * 2019-06-20 2022-10-18 杭州泰然鲸数云计算有限公司 一种支持自动化服务编排的DevOps系统
CN110673858B (zh) * 2019-08-30 2023-04-11 四川新网银行股份有限公司 一种基于ssh免密登录协议的轻量级部署方法
CN110765011B (zh) * 2019-10-15 2023-04-07 卡斯柯信号有限公司 一种配置库内测试运维数据自动获取和校验装置及方法
CN111026403A (zh) * 2019-12-10 2020-04-17 北京锐安科技有限公司 一种打包部署方法、装置、计算机设备及存储介质
CN111142884B (zh) * 2019-12-12 2024-03-26 北京达佳互联信息技术有限公司 小程序的版本部署方法、装置、电子设备及存储介质
CN111162953B (zh) * 2019-12-31 2023-04-28 四川省公安科研中心 数据处理方法、系统升级方法和服务器
CN111290780B (zh) * 2020-03-10 2024-04-05 易方信息科技股份有限公司 一种自动化上传SDK到maven仓库的方法
CN111399856A (zh) * 2020-03-11 2020-07-10 山东汇贸电子口岸有限公司 一种服务部署中文件配置编辑方法及系统
CN111488173A (zh) * 2020-04-02 2020-08-04 苏州浪潮智能科技有限公司 一种离线环境下自动更新依赖包的软件开发方法与系统
CN111651219A (zh) * 2020-05-27 2020-09-11 泰康保险集团股份有限公司 一种多模块项目配置文件管理的方法及设备
CN112083948B (zh) * 2020-08-28 2022-08-09 广州九尾信息科技有限公司 一种基于数据配置化的自动化构建部署方法及工具
CN112379916A (zh) * 2020-11-12 2021-02-19 中国人寿保险股份有限公司 一种maven工程的版本号的修改方法及装置
CN112596779A (zh) * 2020-12-16 2021-04-02 中国建设银行股份有限公司 兼容双版本的依赖包生成方法、装置、设备及存储介质
CN112835572B (zh) * 2021-01-29 2024-03-29 浪潮通用软件有限公司 一种依赖项目管理工具自定义引用流程的方法及设备
CN112988571B (zh) * 2021-02-09 2022-11-29 中国建设银行股份有限公司 一种用于优化cc代码的自动化编译部署方法及系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102402427A (zh) * 2010-09-09 2012-04-04 阿里巴巴集团控股有限公司 一种Java应用程序的更新方法及装置
CN103324470A (zh) * 2012-03-21 2013-09-25 阿里巴巴集团控股有限公司 一种Web系统生成的方法和装置
CN103501341A (zh) * 2013-09-30 2014-01-08 乐视致新电子科技(天津)有限公司 一种Web服务的创建方法及装置
CN103500087A (zh) * 2013-09-17 2014-01-08 福建亿榕信息技术有限公司 一种基于maven插件和freemarker模版的代码生成方法及装置
US8813031B2 (en) * 2012-03-02 2014-08-19 Oracle International Corporation System and method for automatically resolving dependencies of Java Archive files for use with Maven

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102402427A (zh) * 2010-09-09 2012-04-04 阿里巴巴集团控股有限公司 一种Java应用程序的更新方法及装置
US8813031B2 (en) * 2012-03-02 2014-08-19 Oracle International Corporation System and method for automatically resolving dependencies of Java Archive files for use with Maven
CN103324470A (zh) * 2012-03-21 2013-09-25 阿里巴巴集团控股有限公司 一种Web系统生成的方法和装置
CN103500087A (zh) * 2013-09-17 2014-01-08 福建亿榕信息技术有限公司 一种基于maven插件和freemarker模版的代码生成方法及装置
CN103501341A (zh) * 2013-09-30 2014-01-08 乐视致新电子科技(天津)有限公司 一种Web服务的创建方法及装置

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106325881A (zh) * 2016-08-30 2017-01-11 泰康保险集团股份有限公司 发布包自动生成方法及装置
CN106933573A (zh) * 2017-02-22 2017-07-07 广东网金控股股份有限公司 一种通过svn配置文件获取用户与角色的方法和系统
CN106933573B (zh) * 2017-02-22 2020-10-16 广东网金控股股份有限公司 一种通过svn配置文件获取用户与角色的方法和系统
CN107133036A (zh) * 2017-04-26 2017-09-05 武汉斗鱼网络科技有限公司 一种模块的管理方法及装置
CN107133036B (zh) * 2017-04-26 2020-10-16 武汉斗鱼网络科技有限公司 一种模块的管理方法及装置
CN107885658A (zh) * 2017-10-31 2018-04-06 平安科技(深圳)有限公司 测试前置实现方法、装置、终端设备及存储介质
CN107885658B (zh) * 2017-10-31 2019-06-21 平安科技(深圳)有限公司 测试前置实现方法、装置、终端设备及存储介质
CN108628632A (zh) * 2018-03-20 2018-10-09 车音智能科技有限公司 一种打包方法及装置
CN112231302A (zh) * 2020-10-30 2021-01-15 深圳开源互联网安全技术有限公司 Java开源组件数据库的维护方法、装置及存储介质
CN117076004A (zh) * 2023-10-13 2023-11-17 美云智数科技有限公司 微服务打包合并方法、装置和电子设备
CN117076004B (zh) * 2023-10-13 2024-04-12 美云智数科技有限公司 微服务打包合并方法、装置和电子设备

Also Published As

Publication number Publication date
CN106104467A (zh) 2016-11-09
CN106104467B (zh) 2019-09-27

Similar Documents

Publication Publication Date Title
WO2016000126A1 (zh) 一种自动化部署方法和终端
US10379846B1 (en) Systems and methods for real time version control for integrating updated web-based components with a native application
US20210349706A1 (en) Release lifecycle management system for multi-node application
US10929117B2 (en) Container image building using shared resources
US20200142712A1 (en) Execution of workflows in distributed systems
US9575739B2 (en) Performing unattended software installation
US8799893B2 (en) Method, system and computer program product for solution replication
US20090249284A1 (en) Automation for virtualized it environments
US10686608B2 (en) Secure, platform-independent code signing
US9823915B1 (en) Software container format
US9053236B1 (en) Automated directory services test setup utility
US9747091B1 (en) Isolated software installation
US11237949B2 (en) Systems and methods for on-demand container-based development environments
Hall Ansible configuration management
Vivian et al. Rapid and efficient analysis of 20,000 RNA-seq samples with Toil
US11714660B2 (en) Trigger based configuration of continuous delivery pipeline
Srithar et al. Cost-Effective Integration and Deployment of Enterprise Application Using Azure Cloud Devops
Howard Helm--What It Can Do and Where Is It Going?
Solayman et al. Seamless Integration of DevOps Tools for Provisioning Automation of the IoT Application on Multi-Infrastructures
Choudhary Kubernetes-Based Architecture For An On-premises Machine Learning Platform
Pogran Learning PowerShell DSC
Salminen Design of development environment for mobile applications
Bhatia et al. Debugging for Import Issues and Best Practices
Gollenstede et al. reUpNix: reconfigurable and updateable embedded systems
CN118170420A (zh) 一种代码管理方法、系统及计算设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14896790

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14896790

Country of ref document: EP

Kind code of ref document: A1