CN111913720A - Program deployment method and device - Google Patents
Program deployment method and device Download PDFInfo
- Publication number
- CN111913720A CN111913720A CN201910388180.8A CN201910388180A CN111913720A CN 111913720 A CN111913720 A CN 111913720A CN 201910388180 A CN201910388180 A CN 201910388180A CN 111913720 A CN111913720 A CN 111913720A
- Authority
- CN
- China
- Prior art keywords
- program
- file
- configuration file
- deployment
- remote server
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/447—Target code generation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
Abstract
The embodiment of the application provides a program deployment method and a device, wherein the method comprises the following steps: the terminal receives a deployment instruction aiming at the program code; compiling and packaging the program code to obtain a program file in response to the deployment instruction; then, according to the first configuration file, deploying the program file to at least one remote server; the first configuration file comprises a user name and a login password of each remote server in at least one remote server. By applying the program deployment method and device, the problems of complicated program deployment process and high possibility of error in the prior art can be solved, the rapidness and the accuracy of program deployment are ensured, and the efficiency of program deployment is improved.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for deploying a program.
Background
In the prior art, a specific method for deploying program codes in a maven is as follows: firstly, a program code is compiled and packaged to form a war file by manual operation on a terminal, and after the war file is obtained, the terminal is manually operated, and then the war file is deployed on a server.
In addition, at present, in the process of deploying the program code, input of related parameters needs to be performed for many times, for example, in the process of deploying the program code, a user interface pops up on the terminal, and a user needs to input related parameters such as an Internet Protocol Address (IP) of the server, a user name, and the like on the user interface.
In summary, the existing deployment method of the program code needs more manual operations, and the efficiency of the program code deployment is low.
Disclosure of Invention
The embodiment of the application provides a program deployment method and device, compiling, packaging and deployment of a program are completed in one key by setting a configuration file, complex manual operation is reduced, rapidness and accuracy of program deployment are guaranteed, and efficiency of program deployment is improved.
In a first aspect, the present application provides a program deployment method, comprising: the terminal receives a deployment instruction aiming at the program code; the terminal responds to the deployment instruction, compiles and packs the program code to obtain a program file; the terminal deploys the program file to at least one remote server according to a first configuration file; the first configuration file comprises a user name and a login password of each remote server in at least one remote server.
In the embodiment of the application, the terminal continuously compiles, packs and deploys the program codes according to the deployment instruction, writes the parameters required during deployment into the first configuration file, and directly reads the required parameters from the first configuration file during deployment, so that complicated manual operation is reduced, the rapidness and the accuracy of program deployment are ensured, and the efficiency of the whole process is improved.
Optionally, the first configuration file is a configuration file of a project management tool maven.
Optionally, the program file is a file with an extension name of war.
Optionally, the terminal, in response to the deployment instruction, compiles and packages the program code to obtain a program file, including: the terminal responds to the deployment instruction, compiles the program code, and packages the program code according to a second configuration file to obtain the program file; wherein the second configuration file comprises an address of the at least one remote server. And the second configuration file is applied to package the program file, so that the complicated manual input can be reduced, and the rapidness and the accuracy of program packaging are ensured.
Optionally, the second configuration file is a project object model pom file.
In a second aspect, the present application provides a program deployment apparatus, including:
an input module: the terminal receives a deployment instruction aiming at the program code;
the processing module is used for responding to the deployment instruction, compiling and packaging the program code to obtain a program file, and deploying the program file to at least one remote server according to a first configuration file; the first configuration file comprises a user name and a login password of each remote server in at least one remote server.
Optionally, the first configuration file is a configuration file of a project management tool maven.
Optionally, the program file is a file with an extension name of war.
Optionally, the processing module is specifically configured to:
the terminal responds to the deployment instruction, compiles the program code, and packages the program code according to a second configuration file to obtain the program file; wherein the second configuration file comprises an address of the at least one remote server.
Optionally, the second configuration file is a project object model pom file.
In a third aspect, an embodiment of the present application further provides a terminal, including a memory and a processor, where the memory stores program instructions, and the processor is configured to call the program instructions stored in the memory to execute the method provided in the first aspect and any optional implementation manner.
In a fourth aspect, the present application further provides a computer storage medium, where the computer storage medium includes a computer program, and when the computer program runs on a computer, the computer is caused to execute the method provided in the first aspect and any optional implementation manner of the foregoing method.
In a fifth aspect, the present application further provides a computer program product containing instructions, where the instructions, when executed on a computer, cause the computer to perform the method provided in the first aspect of the above method and any optional implementation manner.
Drawings
FIG. 1 is a flowchart of a program deployment method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a program deployment apparatus in an embodiment of the present application;
fig. 3 is a schematic diagram of a program deployment terminal in an embodiment of the present application.
Detailed Description
In the prior art, files need to be manually uploaded to a server in the process of deploying program codes, installation packages are excessive, input parameters are excessive, redundancy exists, and the problem that the whole process of deploying program codes is complex and prone to errors is caused.
In view of this, an embodiment of the present application provides a program deployment method, including: the terminal receives a deployment instruction aiming at the program code; compiling and packaging the program code to obtain a program file in response to the deployment instruction; then, according to the first configuration file, deploying the program file to at least one remote server; the first configuration file comprises a user name and a login password of each remote server in at least one remote server. Compared with the manual deployment mode in the prior art, the method has the advantages that the complicated manual operation is reduced, and the accuracy and the efficiency of program code deployment are improved.
The program deployment method provided in the embodiments of the present application may be implemented as one application or as one functional module integrated into one application, for example, the program deployment method provided in the embodiments of the present application may be implemented as one functional module integrated into the project management tool maven.
The maven is a project management tool, can integrate the compiling, packaging and deploying functions of the program, and comprises a project object model (pom) file, when the maven is used, a pom file is used for describing the program code, and the maven can realize simple and rapid deployment of the program code based on the pom file.
The embodiments of the present application will be described in detail below with reference to maven as an example.
Some terms in the present application are explained below to facilitate understanding by those skilled in the art.
1. Program code. The program code may also be referred to as a program, code, item code, or the like, without limitation. The program code is code for implementing one or more functions. For example, the program file in the embodiment of the present application may be a collection of all source program codes under a website project, and the collection of the source program codes includes program codes of front-end HTML/CSS/JSP, and also includes program codes of compiled Java. To facilitate testing and deployment of program code, it is necessary to package the program code into program files.
2. A first configuration file. The first configuration file is used to deploy the packaged program file to the remote server, and may include a user name and a login password of each remote server in at least one remote server. For example, the remote server is tomcat, and the first configuration file includes configuration information of tomcat and configuration information of maven.
3. A second configuration file. The second configuration file is a pom file in maven and is used for packaging the program codes, and different packaging strategies can be realized for parameters in the second configuration file.
Illustratively, as shown in fig. 1, a method for deploying a program according to an embodiment of the present application specifically includes the following steps.
In step 101, a terminal receives a deployment instruction for a program code.
The deployment instruction for the program code may be an instruction input by a user in a command output box of maven, for example, "mvn deploy, mvn component, mvn page, mvn install," or a deployment instruction generated according to an operation of the user, for example, the operation of the user may be a click or touch operation of the user on a virtual key used for deploying the program code in maven.
And 102, the terminal responds to the deployment instruction, compiles and packages the program code to obtain a program file.
In the embodiment of the present application, the program file may be a war file, a jar file, or a file with another extension name. Specifically, the definition may be performed according to actual situations, and is not limited thereto. For example, in maven, the terminal compiles and packages the program code to obtain a war file in response to the deployment instruction.
For example, in response to the deployment instruction, the terminal may compile and package the program code to obtain a program file based on the following manners:
and the terminal responds to the deployment instruction, compiles the program code, and then packages the program code according to a second configuration file to obtain a program file, wherein the second configuration file comprises the address of at least one remote server.
Taking the second configuration file as a pom file in a maven as an example, a specific configuration mode of the second configuration file is introduced correspondingly.
For example, the second configuration file includes project tag, build tag, and plugins tag. The project tag is used for indicating corresponding packaging strategies under different environments, and the trim tag is used for indicating a program code needing packaging processing; the plugins tag is used to indicate the address of at least one remote server that deploys the program file after packaging.
For example, project tags are used to indicate a packaging policy corresponding to a development environment, a packaging policy corresponding to a test environment, and a packaging policy corresponding to a production environment.
For example, in the embodiment of the present application, the project tag may be configured in the second configuration file in the following manner:
in the embodiment of the application, the program code which needs to be packaged can be determined by configuring the build tag in the second configuration file. For example, the configuration of the build tag may be implemented in the second configuration file by:
the first directory is combined with the instances to exclude the second configuration file corresponding to the resources, and the second configuration file corresponding to the resources is not packaged; the second directory indicates that the second configuration file in the specified directory is packaged.
In the embodiment of the application, the addresses of the servers where the program codes are deployed can be configured by configuring the plugins tags in the second configuration file, and then the program codes are packaged. For example, the configuration of the plugins tags may be implemented in the second configuration file by:
after the program codes are compiled and packaged, a program file is obtained, for example, the program file is a file with an extension name war, the program file can be understood as a web archive file, and the time required for transmitting the file can be reduced by applying the file with the extension name war.
103, the terminal deploys the program file to at least one remote server according to the first configuration file; the first configuration file comprises a user name and a login password of each remote server in at least one remote server.
In some embodiments, the first configuration file is a maven's configuration file, the remote server is tomcat, and the first configuration file includes a username and a login password for each tomcat of the at least one tomcat. Taking one tomcat of the at least one tomcat as an example, the terminal may log in through a user name and a login password of the tomcat, so that the program file may be deployed on the tomcat. In other embodiments, after the terminal logs in to the tomcat according to the user name and the login password of the tomcat, the terminal may also start, stop, deploy, uninstall, and the like, the application in the tomcat.
Optionally, in this embodiment of the present application, the user name and the login password of each remote server in the at least one remote server may be configured in the maven configuration file in the following manner:
for example, the maven configuration file may be set in a plug-in the embodiment of the present application, for example, the plug-in may be named tomcat7-maven-plug, and may also be named by other names, which is not limited in the embodiment of the present application.
For example, in the embodiment of the present application, the user name and the login password of the remote server may be set in the maven configuration file in the following manners:
for another example, the first configuration file may also be a file with a root path of \ conf \ tomcat-users. The root path, the file name, and the like of the file may be customized by the user as needed, and are not limited to the above example.
Wherein: the manager-script can be used for starting, stopping, deploying and uninstalling the application in the remote server; manager-gui can be used for terminals to remotely access the manager's management page.
The various embodiments described above can be used independently or in combination with each other to achieve different functions.
Based on the above embodiments, an alternative implementation manner of the apparatus for executing the program deployment method may be shown in fig. 2, and includes an input module 201 and a processing module 202; wherein, the input module 201 is used for receiving a deployment instruction for the program code; the processing module 202 is configured to compile and package a program code to obtain a program file in response to the deployment instruction, and deploy the program file to at least one remote server according to the first configuration file; the first configuration file includes a username and a login password for each of the at least one remote server.
Optionally, the processing module 202 is specifically configured to compile the program code in response to the deployment instruction, and package the program code according to the second configuration file to obtain a program file; wherein the second configuration file comprises an address of the at least one remote server.
In addition, as shown in fig. 3, an embodiment of the present application further provides a terminal, which includes a processor 301 and a memory 302;
wherein the memory 302 is used for storing program instructions; processor 301 is configured to call program instructions stored in memory 302 to perform the method of program deployment illustrated in fig. 1.
In an embodiment of the invention, the processor 301 may be a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, and may implement or perform the methods, steps, and logic blocks disclosed in an embodiment of the invention. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.
In the embodiment of the present invention, the memory 302 may be a non-volatile memory, such as a Hard Disk Drive (HDD) or a solid-state drive (SSD), and may also be a volatile memory (RAM), for example, a random-access memory (RAM). The memory can also be, but is not limited to, any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory in embodiments of the present invention may also be circuitry or any other device capable of performing a storage function for storing program instructions and/or data.
Embodiments of the present application further provide a computer storage medium, where the computer-readable storage medium includes a computer program, which when executed on a computer causes the computer to execute the method described in fig. 1.
Embodiments of the present application also provide a computer program product containing instructions, wherein the instructions, when executed on a computer, cause the computer to perform the method described in fig. 1. As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.
Claims (12)
1. A program deployment method, the method comprising:
the terminal receives a deployment instruction aiming at the program code;
the terminal responds to the deployment instruction, compiles and packs the program code to obtain a program file;
the terminal deploys the program file to at least one remote server according to a first configuration file; the first configuration file comprises a user name and a login password of each remote server in at least one remote server.
2. The method of claim 1, wherein the first configuration file is a configuration file of a project management tool maven.
3. A method according to claim 1 or 2, wherein the program file is a file with an extension of war.
4. The method of claim 1, wherein the terminal, in response to the deployment instruction, compiles and packages the program code to obtain a program file, comprising:
the terminal responds to the deployment instruction, compiles the program code, and packages the program code according to a second configuration file to obtain the program file;
wherein the second configuration file comprises an address of the at least one remote server.
5. The method of claim 4, wherein the second configuration file is a project object model (pom) file.
6. A program deployment apparatus, the apparatus comprising:
an input module for receiving a deployment instruction for a program code;
the processing module is used for responding to the deployment instruction, compiling and packaging the program code to obtain a program file, and deploying the program file to at least one remote server according to a first configuration file; the first configuration file comprises a user name and a login password of each remote server in at least one remote server.
7. The apparatus of claim 6, wherein the first configuration file is a configuration file of a project management tool maven.
8. Apparatus according to claim 6 or 7, wherein the program file is a file with an extension of war.
9. The apparatus of claim 6, wherein the first deployment module is specifically configured to:
the terminal responds to the deployment instruction, compiles the program code, and packages the program code according to a second configuration file to obtain the program file; wherein the second configuration file comprises an address of the at least one remote server.
10. The apparatus of claim 9, wherein the second configuration file is a project object model (pom) file.
11. A computer storage medium, characterized in that the computer-readable storage medium comprises a computer program which, when run on a computer, causes the computer to perform the method according to any one of claims 1 to 5.
12. A computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910388180.8A CN111913720A (en) | 2019-05-10 | 2019-05-10 | Program deployment method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910388180.8A CN111913720A (en) | 2019-05-10 | 2019-05-10 | Program deployment method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111913720A true CN111913720A (en) | 2020-11-10 |
Family
ID=73242645
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910388180.8A Pending CN111913720A (en) | 2019-05-10 | 2019-05-10 | Program deployment method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111913720A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112615916A (en) * | 2020-12-14 | 2021-04-06 | 微医云(杭州)控股有限公司 | File deployment method and device, electronic equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140359589A1 (en) * | 2013-05-30 | 2014-12-04 | National Instruments Corporation | Graphical Development and Deployment of Parallel Floating-Point Math Functionality on a System with Heterogeneous Hardware Components |
CN104407856A (en) * | 2014-11-10 | 2015-03-11 | 北京国双科技有限公司 | SDK (Software Development Kit) file packaging method and SDK file packaging device |
CN105373401A (en) * | 2015-10-27 | 2016-03-02 | 上海钢富电子商务有限公司 | Method and system for automatically releasing software package |
CN107577469A (en) * | 2017-08-21 | 2018-01-12 | 厦门悦讯教育科技有限公司 | A kind of Software package method for release management |
-
2019
- 2019-05-10 CN CN201910388180.8A patent/CN111913720A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140359589A1 (en) * | 2013-05-30 | 2014-12-04 | National Instruments Corporation | Graphical Development and Deployment of Parallel Floating-Point Math Functionality on a System with Heterogeneous Hardware Components |
CN104407856A (en) * | 2014-11-10 | 2015-03-11 | 北京国双科技有限公司 | SDK (Software Development Kit) file packaging method and SDK file packaging device |
CN105373401A (en) * | 2015-10-27 | 2016-03-02 | 上海钢富电子商务有限公司 | Method and system for automatically releasing software package |
CN107577469A (en) * | 2017-08-21 | 2018-01-12 | 厦门悦讯教育科技有限公司 | A kind of Software package method for release management |
Non-Patent Citations (1)
Title |
---|
王西文: "使用tomcat7插件将项目一键部署到远程tomcat服务器-热部署", 《HTTPS://WWW.JIANSHU.COM/P/D4585B83B9DD?UTM_CAMPAIGN=MALESKINE&UTM_CONTENT=NOTE&UTM_MEDIUM=SEO_NOTES&UTM_SOURCE=RECOMMENDATION》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112615916A (en) * | 2020-12-14 | 2021-04-06 | 微医云(杭州)控股有限公司 | File deployment method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108459962B (en) | Code normalization detection method and device, terminal equipment and storage medium | |
CN107704238B (en) | Method and device for packaging items | |
CN106909498B (en) | Method and system for injecting fault into Java program | |
US9658842B2 (en) | Application runtime expert for deployment of an application on multiple computer systems | |
CN108897547B (en) | Software automation deployment method and device | |
CN111324522A (en) | Automatic test system and method | |
CN112068852B (en) | Method, system, equipment and medium for installing open-source software based on domestic server | |
CN113064630A (en) | Mobile terminal APP automatic packaging method and system, electronic device and storage medium | |
CN111651352A (en) | Warehouse code merging method and device | |
CN113254054A (en) | Intelligent contract one-stop development system and method | |
CN114546819A (en) | Code processing method and device, electronic equipment and readable medium | |
CN106649081B (en) | A kind of method and device that commissioning test wraps offline in client application | |
CN111913720A (en) | Program deployment method and device | |
CN116303099B (en) | Cross-platform rapid deployment method, device, medium and equipment for automatic test environment | |
CN117055501A (en) | Deployment method, system, equipment and storage medium of trusted DCS upper computer system | |
CN115454575B (en) | jar packet conversion and automatic loading method, device, equipment and storage medium | |
CN109144524B (en) | Version release method of subject game on education platform and electronic equipment | |
CN109428936B (en) | APP upgrading method, device, system, electronic equipment and storage medium | |
CN110647349A (en) | Method for realizing continuous delivery of iOS APP | |
CN116126357A (en) | Automatic deployment method and device for test tool, readable storage medium and electronic equipment | |
CN112650189A (en) | Embedded PLC automatic test system and method | |
CN115525301A (en) | Application program code packaging method, device, equipment, medium and program product | |
CN115525545A (en) | Docker-based automatic testing method, system, equipment and medium | |
CN112486511A (en) | Method for generating operating system installation mirror image through web | |
CN115168175A (en) | Program error solving method, device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20201110 |