Software deployment method and device

Through continuous integration tools, the software deployment process is automated, and the problems of low deployment efficiency and frequent errors in software testing environments are solved, and efficient and accurate software deployment and configuration are achieved.

CN114564217BActive Publication Date: 2025-09-02SHANGHAI BILIBILI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210216520.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-07
Publication Date
2025-09-02
Estimated Expiration
2042-03-07

AI Technical Summary

Technical Problem

The deployment of software testing environments in the prior art is inefficient and prone to errors, requiring manual operations to lead to inefficiency and frequent errors.

Method used

Use the continuous integration tool to obtain the code of the target software, compile and generate the package, and mount the configuration file to Nginx of the Docker cluster through local shell scripts. Finally, use the continuous integration tool to deploy the package to the Docker cluster, supporting calls to Kubernetes for automated deployment.

Benefits of technology

It realizes the automated deployment of the software testing environment, improves deployment efficiency, reduces the probability of manual operation errors, and improves the efficiency of proxy forwarding configurations by automatically generating configuration files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114564217B_ABST
    Figure CN114564217B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a software deployment method, the method comprising: obtaining the code of the target software using a continuous integration tool; compiling the code of the target software using the continuous integration tool to obtain a program package of the target software; executing a local shell script of the target software using the continuous integration tool to generate a configuration file of the target software, and mounting the configuration file to Nginx of a Docker cluster so that Nginx performs proxy forwarding of the target software according to the configuration file; and deploying the program package to the Docker cluster using the continuous integration tool. The software deployment method provided by the embodiment of the present application can improve the efficiency of the test environment for deploying software and reduce the probability of errors caused by manual operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network technology, and in particular to a software deployment method, apparatus, computer equipment, and storage medium. Background Art

[0002] In daily testing work, in order to test the software, testers are usually required to deploy one or more test environments for the software to test and evaluate the software.

[0003] However, currently, when deploying software test environments, testers perform deployment manually, which is inefficient and prone to errors. Summary of the Invention

[0004] The purpose of this application is to provide a software deployment method, apparatus, computer equipment and storage medium to solve the following technical problems: the current test environment for deploying software is inefficient and prone to errors.

[0005] One aspect of an embodiment of the present application provides a software deployment method, including: using a continuous integration tool to obtain the code of the target software; using the continuous integration tool to compile the code of the target software to obtain a program package of the target software; using the continuous integration tool to execute the local shell script of the target software to generate a configuration file of the target software, and mounting the configuration file to the Nginx of the Docker cluster, so that Nginx performs proxy forwarding of the target software according to the configuration file, and the local shell script is obtained according to the configuration information of the target software; and using the continuous integration tool to deploy the program package to the Docker cluster.

[0006] Optionally, using a continuous integration tool to deploy the program package to the Docker cluster includes: using the continuous integration tool to call Kubernetes to deploy the program package to the Docker cluster.

[0007] Optionally, use a continuous integration tool to call Kubernetes to deploy the program package to the Docker cluster, including: when the target software is a front-end project or a static resource project, use the continuous integration tool to call Kubernetes to deploy the program package to Nginx in the Docker cluster; when the target software is a back-end project, use the continuous integration tool to call Kubernetes to deploy the program package to Tomcat in the Docker cluster.

[0008] Optionally, the code of the target software is compiled using a continuous integration tool to obtain the program package of the target software, including: when the target software is a Java project, using the continuous integration tool to call Maven to compile the code of the target software to obtain the program package of the target software; when the target software is a Node.js project, using the continuous integration tool to call NPM to compile the code of the target software to obtain the program package of the target software.

[0009] Optionally, using a continuous integration tool to obtain the code of the target software includes: obtaining the code address of the target software, pushing the code address to the continuous integration tool; and using the continuous integration tool to pull the code of the target software according to the code address.

[0010] Optionally, obtaining the code address of the target software includes: obtaining a query instruction of the target software input by a user through a web page; and obtaining target data of the target software from a preset database according to the query instruction of the target software, the target data including at least the code address.

[0011] Optionally, using a continuous integration tool to pull the target software code according to the code address includes: using Jenkins to pull the target software code from the git repository according to the address of the git repository.

[0012] One aspect of an embodiment of the present application provides a software deployment device, including: an acquisition module, used to obtain the code of the target software using a continuous integration tool; a compilation module, used to compile the code of the target software using the continuous integration tool to obtain the program package of the target software; a configuration module, used to execute the local shell script of the target software using the continuous integration tool to generate a configuration file of the target software, and mount the configuration file to the Nginx of the Docker cluster, so that Nginx performs proxy forwarding of the target software according to the configuration file, and the local shell script is obtained according to the configuration information of the target software; a deployment module, used to deploy the program package to the Docker cluster using the continuous integration tool.

[0013] One aspect of an embodiment of the present application further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it is used to implement the steps of the above-mentioned software deployment method.

[0014] One aspect of an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program can be executed by at least one processor to enable the at least one processor to perform the steps of the above-mentioned software deployment method.

[0015] The software deployment method, apparatus, computer device, and storage medium provided in the embodiments of the present application have at least the following advantages:

[0016] By using continuous integration tools to obtain the code of the target software, using continuous integration tools to compile the code of the target software, obtaining the program package of the target software, and then using continuous integration tools to execute the local shell script of the target software to generate the configuration file of the target software, and mounting the configuration file to Nginx of the Docker cluster, and then using continuous integration tools to deploy the program package to the Docker cluster, continuous integration tools can be used to realize automatic deployment of the software testing environment, thereby improving the efficiency of the test environment for deployed software and reducing the probability of errors caused by manual operation; at the same time, since the configuration file can be automatically generated by executing local shell scripts and mounted to Nginx of the Docker cluster, and Nginx can realize proxy forwarding of the target software according to the configuration file, the proxy forwarding configuration of the target software can be automatically realized, thereby improving configuration efficiency and reducing the workload of manual operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 The following schematically shows the environment architecture diagram of an embodiment of the present application;

[0018] Figure 2 The following schematically shows a flowchart of a software deployment method according to the first embodiment of the present application;

[0019] Figure 3 for Figure 2 Sub-steps of step S401;

[0020] Figure 4 for Figure 3 Sub-steps of step S4011;

[0021] Figure 5 The following is an illustrative diagram of the software deployment method according to the first embodiment of the present application;

[0022] Figure 6 The following is an exemplary diagram showing the principle of software access in the software deployment method of the first embodiment of the present application;

[0023] Figure 7 The schematic diagram shows the principle of implementing software deployment in a manual manner;

[0024] Figure 8 A block diagram of a software deployment device according to a second embodiment of the present application is schematically shown;

[0025] Figure 9 The hardware architecture diagram of the computer device of the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solutions and advantages of this application more clear, the present application is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0027] It should be noted that the descriptions of "first", "second", etc. in the embodiments of the present application are for descriptive purposes only and should not be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that they can be implemented by ordinary technicians in this field. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0028] In the description of this application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed. They are only used to facilitate the description of this application and to distinguish each step. Therefore, they cannot be understood as limitations on this application.

[0029] The following is an explanation of the terms involved in this application:

[0030] Docker: It is an open source application container engine that allows developers to package applications and dependent packages into a portable image and then publish it to machines with Linux or Windows operating systems to achieve application virtualization.

[0031] Nginx: is an asynchronous framework web server that can also be used as a reverse proxy, load balancer and HTTP cache.

[0032] Maven: It is a software project management and automatic build tool based on the concept of project object model, using a central information fragment to manage the construction, reporting and documentation steps of a project.

[0033] NPM (Node Package Manager): It is the default package management system for Node.js written in JavaScript.

[0034] Node.js: is an open source, cross-platform execution environment that can run JavaScript on the server side.

[0035] Java: It is a widely used computer programming language with cross-platform, object-oriented, and generic programming features. It is widely used in enterprise-level web application development and mobile application development.

[0036] Tomcat: It is a servlet container developed by the Jakarta project under the Apache Software Foundation. It supports Servlets and Java Server Pages (JSP) and provides some unique functions as a web server.

[0037] git: is a distributed version control software.

[0038] Jenkins: is an open source continuous integration tool written in Java.

[0039] Kubernetes (K8s for short): is an open source system for automatically deploying, scaling, and managing "containerized applications."

[0040] HTTP (Hypertext Transfer Protocol): an application layer protocol used for distributed, collaborative and hypermedia information systems.

[0041] Figure 1 The environment architecture diagram of the embodiment of the present application is schematically shown as follows: Figure 1 As shown:

[0042] The client 300 is connected to the server 100 via the network 200. The user can use the client 300 to send instructions to the server 100 via the network 200. When the server 100 receives the instructions, it uses the continuous integration tool to obtain the code of the target software according to the instructions, and then uses the continuous integration tool to compile the code of the target software to obtain the program package of the target software. Then, the continuous integration tool is used to execute the local shell script of the target software to generate a configuration file, and the configuration file is mounted to the Nginx of the Docker cluster. Finally, the server 100 uses the continuous integration tool to deploy the program package of the target software in the Docker cluster. Optionally, when deploying the target software, the server 100 can implement it through a pre-written program. The specific process is, for example, when the pre-written program in the server 100 receives an instruction sent by the user through the client 300 through the network 200, it calls the continuous integration tool according to the instruction to obtain the code of the target software, and then uses the continuous integration tool to compile the code of the target software. After obtaining the program package of the target software, the continuous integration tool is used to execute the local shell script of the target software to generate a configuration file, and the configuration file is mounted to the Nginx of the Docker cluster. Finally, the continuous integration tool is used to deploy the program package of the target software in the Docker cluster.

[0043] In an exemplary embodiment, the server 100 may refer to a data center, such as a single house, or distributed in different geographical locations (for example, in several houses). The server 100 may provide services through one or more networks 200. The network 200 includes various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices and / or the like. The network 200 may include physical links, such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof and / or the like. The network 200 may include wireless links, such as cellular links, satellite links, Wi-Fi links and / or the like. The client 300 may include devices such as mobile devices, tablet devices, laptop computers, smart devices (such as smart clothing, smart watches, smart glasses), virtual reality headsets, gaming devices, set-top boxes, digital streaming devices, robots, vehicle-mounted terminals, smart TVs, TV boxes or e-book readers.

[0044] In related technologies, when software needs to be deployed to an environment for testing, operators are required to manually configure it, which results in low deployment efficiency and is prone to errors.

[0045] The software deployment method provided in the embodiment of the present application can automatically complete software deployment, thereby improving deployment efficiency and reducing the probability of errors.

[0046] The following will introduce the software deployment solution through several embodiments. For ease of understanding, the following will be Figure 1 The server 100 is described as an example execution entity.

[0047] Example 1

[0048] Figure 2 The flowchart of the software deployment method provided in the first embodiment of the present application is schematically shown. Figure 2 As shown, the software deployment method may include the following steps:

[0049] Step S401: Obtain the target software code using a continuous integration tool.

[0050] Continuous integration tools can include Jenkins, Buddy, or TeamCity.

[0051] The target software may specifically be an application or a branch of an application corresponding to a product or project.

[0052] The code of the target software can be stored in a specified location in the network. When the continuous integration tool is used to obtain the code of the target software, the continuous integration tool can obtain the code of the target software according to the storage location corresponding to the target software. For example, the code of the target software can be stored in a git repository. When the continuous integration tool is used to obtain the code of the target software, the continuous integration tool can obtain the code of the target software according to the address of the code of the target software in the git repository. In an exemplary embodiment, Figure 3 As shown, step S401 may further include the following steps:

[0053] Step S4011: Obtain the code address of the target software and push the code address to the continuous integration tool.

[0054] The code address of the target software may include multiple versions of code. When different versions of code need to be obtained, the corresponding version of code can be obtained according to the branch information of the target software.

[0055] In an exemplary embodiment, as Figure 4 As shown, step 4011 may further include the following steps:

[0056] Step S40111: Obtain a query instruction for the target software input by the user through a Web page.

[0057] The web page is specifically a designated web page. After the user enters a query command on the web page, the corresponding query command is sent to the server 100 via the network 200. When the user enters the query command for the target software, the user may enter the name and branch of the target software and other related information. The web page forms the query command for the target software based on the relevant information of the target software.

[0058] For example, the user opens a designated web page through the client 300 , and then enters a query instruction for the target software on the designated web page. The client 300 then sends the query instruction for the target software entered by the user to the server 100 through the network 200 .

[0059] Step S40112: Obtain target data of the target software from a preset database according to the query instruction of the target software, where the target data at least includes a code address.

[0060] The data in the preset database may include target data of multiple software including the target software, so that the user can query the target data of the corresponding software from the preset database. The preset database can be located in the server 100 or connected to the server 100, so that the server 100 can obtain the target data of the target software from the preset database according to the query instruction of the target software. Among them, the target data of the target software, in addition to including the code address of the target software, may also include data such as type parameters and API (application programming interface) address of the target software, so that the continuous integration tool can obtain the data required for deployment during the process of deploying the target software. The target data of the target software can be maintained in advance in the preset database by the user, or the preset database can be obtained from the corresponding network location according to certain rules. The specific setting can be based on actual needs and is not specifically limited here.

[0061] By obtaining the query instruction of the target software input by the user through the Web page, the target data of the target software including at least the code address is obtained from the preset database according to the query instruction of the target software. The code address of the target software can be obtained, and other data required for the deployment of the target software can also be obtained as needed, thereby facilitating the realization of automatic deployment of the target software.

[0062] Step S4012: Use a continuous integration tool to pull the target software code according to the code address.

[0063] In an exemplary embodiment, step S4012 may include: using Jenkins to pull the code of the target software from the git repository according to the address of the git repository.

[0064] That is, the continuous integration tool is Jenkins, and the target software's code address is the address of the Git repository. Since Jenkins supports the execution of Maven projects, as well as arbitrary Shell scripts and Windows batch commands, using Jenkins as a continuous integration tool to deploy the target software can effectively achieve automatic software deployment. Since Git is a distributed version control software that can effectively control software versions, storing the target software's code in a Git repository can effectively control the target software's version. By using Jenkins to pull the target software's code from the Git repository based on its address, the corresponding version of the target software can be pulled as needed, achieving automatic acquisition of the target software's code.

[0065] By obtaining the code address of the target software, pushing the code address to the continuous integration tool, and then using the continuous integration tool to pull the code of the target software according to the code address of the target software, the continuous integration tool can be used to automatically pull the code of the target software, thereby improving the efficiency of software deployment.

[0066] Step S402: Compile the target software code using a continuous integration tool to obtain a program package of the target software.

[0067] When using a continuous integration tool to compile the code of the target software, the continuous integration tool can be used to call other software project construction tools to compile the code of the target software. Currently, software can be divided into Java-type software and Node.js-type software. Since different types of software use different software project construction tools when compiling, when using a continuous integration tool to compile the code of the target software, the type of the target software can be determined first, and then the corresponding software project construction tool can be called according to the type of the target software to compile the code of the target software. The target data of the target software may include the type parameters of the target software, so when determining the type of the target software, the type parameters of the target software can be used to determine the type of the target software.

[0068] In an exemplary embodiment, step S402 may include: when the target software is a Java project, using the continuous integration tool to call Maven to compile the code of the target software to obtain the program package of the target software; when the target software is a Node.js project, using the continuous integration tool to call NPM to compile the code of the target software to obtain the program package of the target software.

[0069] By using the continuous integration tool to call Maven to compile the target software code when the target software is a Java project; and by using the continuous integration tool to call NPM to compile the target software code when the target software is a Node.js project, the corresponding software project construction tool can be called according to the software type of the target software to automatically compile the target software code, thereby realizing automatic packaging of the target software program package and improving the efficiency of software deployment.

[0070] Step S403, use the continuous integration tool to execute the local shell script of the target software to generate a configuration file of the target software, and mount the configuration file to the Nginx of the Docker cluster so that Nginx performs proxy forwarding of the target software according to the configuration file, and the local shell script is obtained according to the configuration information of the target software.

[0071] The target software's configuration information may include information such as the target software's domain name. This allows Nginx to be deployed according to the configuration information and forward the target software's data accordingly. The target software's configuration information can be obtained based on the link address of its corresponding online software (product or project). The link address of the corresponding online software can be obtained by the user querying a preset database. In other words, the target data may also include the link address of the online software.

[0072] After mounting the configuration file to the Nginx of the Docker cluster, since the configuration file records the domain name and other relevant information of the target software, when the Nginx of the Docker cluster receives the corresponding data (such as a request corresponding to the target software), it can perform proxy forwarding of the target software according to the configuration file of the target software.

[0073] In the related technology, after the software is deployed, it is necessary to manually set the port, forwarding path and other Nginx domain name forwarding contents, which has a low configuration efficiency; especially when there are many software to be deployed, the workload of manual operation is relatively large, the requirements for manual operation are high, and it is easy to make mistakes; by using continuous integration tools to execute the local shell script of the target software to generate the configuration file of the target software, and mounting the configuration file to the Nginx of the Docker cluster, the proxy forwarding configuration of the target software can be automatically realized, so that Nginx performs proxy forwarding of the target software according to the configuration file of the target software, thereby improving configuration efficiency and reducing the workload of manual operation and the probability of errors.

[0074] Step S404: Deploy the target software package to the Docker cluster using a continuous integration tool.

[0075] Specifically, the continuous integration tool may be used to send container management commands to the Docker container management interface via the HTTP protocol to achieve Docker container management and software deployment. When the target software package is deployed to the Docker cluster using the continuous integration tool, the target software package may be deployed to the Docker cluster by calling a third-party service using the continuous integration tool. In an exemplary embodiment, the target software package may be deployed to the Docker cluster using the continuous integration tool, which may include: using the continuous integration tool to call Kubernetes to deploy the target software package to the Docker cluster.

[0076] Specifically, a continuous integration tool can be used to call the Kubernetes service to create a container in a Docker cluster, and then the target software package can be deployed into the container created by the Docker cluster. Before using the continuous integration tool to call Kubernetes, the continuous integration tool can be used to transfer the data processed in the previous step to Kubernetes, which then completes the deployment of the target software based on this data. The data processed in the previous step may include: container name, image information, generated domain name information, default host information, hostname information, file mount address, etc.

[0077] When deploying the target software package to the container created by the Docker cluster, you can mount it to the Docker container to instantiate the container and automatically complete the deployment process. In the related art, a new port number is generally created for each software to implement the software deployment process, but this deployment method makes the configuration more complicated and difficult to manage and maintain. By mounting it to the Docker container, since different software are not in the same Docker container, multiple software can use the same port number, which simplifies the configuration and reduces the maintenance workload.

[0078] Since Kubernetes can automatically deploy, expand, and run application containers on host clusters, and can be allocated according to the server's hardware resources, by using continuous integration tools to call Kubernetes to deploy the target software package to the Docker cluster, the target software can be automatically deployed in the Docker cluster and the hardware resources in the Docker cluster can be reasonably used.

[0079] In practice, it is sometimes necessary to deploy multiple software applications to a Docker cluster simultaneously or within a similar timeframe. In this case, asynchronous multithreading can be used to execute steps S401-S403 to complete the simultaneous deployment of multiple applications. Because asynchronous multithreading allows multiple software applications to be deployed simultaneously, it can effectively reduce the time required to deploy multiple applications.

[0080] When using a continuous integration tool to call Kubernetes to deploy the target software package to a Docker cluster, the project type of the target software can be determined first, and then the corresponding deployment can be performed in the Docker cluster based on the project type. Optionally, the target data of the target software obtained by the user from a preset database includes project type parameters, so that the server 100 can determine the project type of the target software based on the project type parameters.

[0081] In an exemplary embodiment, using a continuous integration tool to call Kubernetes to deploy the target software package to a Docker cluster may include: when the target software is a front-end project or a static resource project, using the continuous integration tool to call Kubernetes to deploy the target software package to Nginx in the Docker cluster; when the target software is a back-end project, using the continuous integration tool to call Kubernetes to deploy the target software package to Tomcat in the Docker cluster.

[0082] When the target software is a front-end project or a static resource project, the continuous integration tool is used to call Kubernetes to deploy the target software program to the Nginx of the Docker cluster; when the target software is a back-end project, the continuous integration tool is used to call Kubernetes to deploy the target software package to the Tomcat of the Docker cluster. The corresponding deployment can be carried out in the Docker cluster according to the project type of the target software, thereby realizing automatic deployment of the target software package and improving the efficiency of software deployment.

[0083] The software deployment method provided in the embodiment of the present application obtains the code of the target software by using the continuous integration tool, compiles the code of the target software by using the continuous integration tool to obtain the program package of the target software, and then uses the continuous integration tool to execute the local shell script of the target software to generate the configuration file of the target software, and mounts the configuration file to the Nginx of the Docker cluster, and then uses the continuous integration tool to deploy the program package to the Docker cluster. The continuous integration tool can be used to realize the automatic deployment of the software testing environment, thereby improving the efficiency of the test environment for deploying software and reducing the probability of errors due to manual operation; at the same time, since the configuration file can be automatically generated by executing the local shell script and mounted to the Nginx of the Docker cluster, and Nginx can realize the proxy forwarding of the target software according to the configuration file, the proxy forwarding configuration of the target software can be automatically realized, thereby improving the efficiency of configuration and reducing the workload of manual operation.

[0084] In order to further illustrate the software deployment method provided in Example 1 of the present application, a specific example is given below.

[0085] Figure 5 The following is an example of a schematic diagram of the software deployment method provided in the first embodiment of the present application. The general principles are as follows:

[0086] 1.1. The user operates a web page to call a program on the server 100. The program queries a preset database for data related to the target software and passes the queried data as a parameter to a continuous integration tool (Jenkins is used as an example in the figure).

[0087] 1.2. The program calls Jenkins, and Jenkins calls other third-party services.

[0088] 1.3. Jenkins pulls the latest code of the target software to the local machine from the git repository based on the address of the target software in the previously queried data.

[0089] 1.4. Jenkins calls the software project construction tool (Maven is used as an example in the figure) to compile the source code of the latest code of the target software to obtain the program package of the target software.

[0090] 1.5. Jenkins executes the local shell script to generate the configuration file required by Nginx.

[0091] 1.6. Jenkins calls the Kubernetes service to create a Docker container, mounts the target software package into the created Docker container to instantiate the container, and deploys the target software according to its type. It deploys the front-end project or static resource project into Nginx and the back-end project into Tomcat's Docker service.

[0092] 1.7. Reload the Nginx service to make the deployed environment take effect.

[0093] After completing the software deployment according to the above steps, you can access the software. The access principle diagram can be as follows: Figure 6 As shown, the virtual box corresponds to a domain name, which can include static resource projects (or front-end projects) and back-end projects (services A, B, C, etc. in the figure). The Nginx outside the dotted box is the general reverse proxy server, and the Nginx inside the dotted box is the proxy server for the domain name corresponding to the virtual box, which is the main entrance for all software under the domain name. When accessing the software, the user accesses the Nginx server in Docker, and the Nginx server forwards the user's access request to different software by identifying different hostnames. When forwarding, the request is forwarded through the Nginx configuration file generated when the software is deployed. If Nginx receives an API access, it will forward it to a Tomcat service. If it receives an access to a static resource, it will forward it to a local static folder; if the proxy path is a non-existent path, it will be proxied to the basic application server by default.

[0094] In related technologies, a process similar to the above automatic deployment can be achieved manually, such as Figure 7 As shown, the general process is:

[0095] 1.1. Manually pull the latest code of the target software from the git repository;

[0096] 1.2. Manually use Maven to compile the latest code of the target software to obtain the compiled program package;

[0097] 1.3. Manually create the Nginx configuration file and configure Nginx domain name proxy forwarding;

[0098] 1.4. Manually upload the compiled target and mount it to the container;

[0099] 1.5. Manually call Kubernetes to manage containers.

[0100] By combining it with Figure 5Compared with the corresponding process, the manual deployment process has higher requirements on operators, lower efficiency, and is prone to errors. Especially when a running environment needs to deploy multiple software, the deployment will be more complicated. Figure 5 The corresponding process can realize the automated deployment of software, improve the efficiency of software deployment, reduce the probability of errors, and facilitate the maintenance of deployed software.

[0101] Example 2

[0102] Figure 8 A block diagram of a software deployment apparatus 500 according to a second embodiment of the present application is schematically shown. The software deployment apparatus 500 can be divided into one or more program modules, one or more of which are stored in a storage medium and executed by one or more processors to implement the embodiment of the present application. The program modules referred to in the embodiment of the present application refer to a series of computer program instruction segments that can perform specific functions. The following description will specifically introduce the functions of each program module in this embodiment.

[0103] like Figure 8 As shown, the software deployment device 500 may include an acquisition module 501 , a compilation module 502 , a configuration module 503 , and a deployment module 504 .

[0104] An acquisition module 501 is used to acquire the code of the target software using a continuous integration tool;

[0105] Compilation module 502, used to compile the code of the target software using a continuous integration tool to obtain a program package of the target software;

[0106] Configuration module 503 is used to use the continuous integration tool to execute the local shell script of the target software to generate the configuration file of the target software, and mount the configuration file to the Nginx of the Docker cluster so that Nginx performs proxy forwarding of the target software according to the configuration file, and the local shell script is obtained according to the configuration information of the target software.

[0107] The deployment module 504 is used to deploy the program package to the Docker cluster using a continuous integration tool.

[0108] In an exemplary embodiment, the deployment module 504 is further configured to utilize a continuous integration tool to call Kubernetes to deploy the program package into the Docker cluster.

[0109] In an exemplary embodiment, the deployment module 504 is also used to: when the target software is a front-end project or a static resource project, use the continuous integration tool to call Kubernetes to deploy the program package to the Nginx of the Docker cluster; when the target software is a back-end project, use the continuous integration tool to call Kubernetes to deploy the program package to the Tomcat of the Docker cluster.

[0110] In an exemplary embodiment, the compilation module 502 is also used to: when the target software is a Java project, use the continuous integration tool to call Maven to compile the code of the target software to obtain the program package of the target software; when the target software is a Node.js project, use the continuous integration tool to call NPM to compile the code of the target software to obtain the program package of the target software.

[0111] In an exemplary embodiment, the acquisition module 501 is further configured to: acquire the code address of the target software, push the code address to a continuous integration tool; and use the continuous integration tool to pull the code of the target software according to the code address.

[0112] In an exemplary embodiment, the acquisition module 501 is further used to: acquire a query instruction of the target software input by the user through a web page; and acquire target data of the target software from a preset database according to the query instruction of the target software, where the target data at least includes a code address.

[0113] In an exemplary embodiment, the acquisition module 501 is further configured to: utilize Jenkins to pull the target software code from the git repository according to the address of the git repository.

[0114] Example 3

[0115] Figure 9 The schematic diagram of the hardware architecture of a computer device 600 suitable for the software deployment method according to the third embodiment of the present application is shown. The computer device 600 can be a device that can automatically perform numerical calculations and / or data processing according to pre-set or stored instructions. For example, it can be a rack server, a blade server, a tower server or a cabinet server (including an independent server or a server cluster composed of multiple servers), a gateway, etc. Figure 9 As shown, the computer device 600 includes at least but is not limited to: a memory 601, a processor 602, and a network interface 603 that can communicate with each other via a system bus.

[0116] The memory 601 includes at least one type of computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, magnetic disk, optical disk, etc. In some embodiments, the memory 601 can be an internal storage module of the computer device 600, such as the hard disk or memory of the computer device 600. In other embodiments, the memory 601 can also be an external storage device of the computer device 600, such as a plug-in hard disk equipped on the computer device 600, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, etc. Of course, the memory 601 can also include both the internal storage module of the computer device 600 and its external storage device. In this embodiment, the memory 601 is generally used to store the operating system and various application software installed on the computer device 600, such as the program code of the software deployment method. In addition, the memory 601 can also be used to temporarily store various types of data that have been output or are to be output.

[0117] In some embodiments, the processor 602 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 602 is generally used to control the overall operation of the computer device 600, such as performing control and processing related to data exchange or communication with the computer device 600. In this embodiment, the processor 602 is used to execute program code stored in the memory 601 or process data.

[0118] The network interface 603 may include a wireless network interface or a wired network interface. The network interface 603 is generally used to establish a communication link between the computer device 600 and other computer devices. For example, the network interface 603 is used to connect the computer device 600 to an external terminal via a network, and to establish a data transmission channel and a communication link between the computer device 600 and the external terminal. The network can be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile Communications (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth, or Wi-Fi.

[0119] It should be pointed out that Figure 9 A computer device is shown having only components 601 - 603 , but it should be understood that implementing all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0120] In this embodiment, the software deployment method stored in the memory 601 can also be divided into one or more program modules and executed by one or more processors (processor 602 in this embodiment) to complete the embodiment of the present application.

[0121] Example 4

[0122] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the software deployment method in the embodiment are implemented.

[0123] In this embodiment, the computer-readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk equipped with the computer device, a smart media card (SMC), a secure digital (SD) card, a flash memory card, etc. Of course, the computer-readable storage medium may also include both an internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on the computer device, such as the program code of the software deployment method in the embodiment. In addition, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are about to be output.

[0124] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented using program code executable by the computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be performed in a different order than herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0125] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A software deployment method, characterized in that: include: Use continuous integration tools to obtain the code of the target software; Compiling the target software code using the continuous integration tool to obtain a program package of the target software; Executing a local shell script of the target software using the continuous integration tool to generate a configuration file of the target software, and mounting the configuration file to Nginx in the Docker cluster so that Nginx performs proxy forwarding of the target software according to the configuration file, and the local shell script is obtained according to the configuration information of the target software; The program package is deployed to the Docker cluster using the continuous integration tool.

2. The software deployment method according to claim 1, characterized in that: Deploying the program package to the Docker cluster using the continuous integration tool includes: The continuous integration tool is used to call Kubernetes to deploy the program package to the Docker cluster.

3. The software deployment method according to claim 2, wherein: The method of using a continuous integration tool to call Kubernetes to deploy the program package to a Docker cluster includes: In the case where the target software is a front-end project or a static resource project, using the continuous integration tool to call Kubernetes to deploy the program package to Nginx in the Docker cluster; In the case where the target software is a backend project, the continuous integration tool is used to call Kubernetes to deploy the program package to Tomcat in the Docker cluster.

4. The software deployment method according to any one of claims 1 to 3, characterized in that: The using the continuous integration tool to compile the code of the target software to obtain the program package of the target software includes: In the case where the target software is a Java project, using the continuous integration tool to call Maven to compile the code of the target software to obtain a program package of the target software; In the case that the target software is a Node.js project, the continuous integration tool is used to call NPM to compile the code of the target software to obtain the program package of the target software.

5. The software deployment method according to claim 1, wherein: The method of obtaining the target software code by using a continuous integration tool includes: Obtaining the code address of the target software, and pushing the code address to the continuous integration tool; The continuous integration tool is used to pull the code of the target software according to the code address.

6. The software deployment method according to claim 5, characterized in that: The obtaining of the code address of the target software includes: Obtaining a query instruction for the target software input by a user through a web page; Target data of the target software is acquired from a preset database according to a query instruction of the target software, where the target data at least includes the code address.

7. The software deployment method according to claim 5, characterized in that: The using the continuous integration tool to pull the code of the target software according to the code address includes: Use Jenkins to pull the code of the target software from the git warehouse according to the address of the git warehouse.

8. A software deployment device, characterized in that: include: The acquisition module is used to obtain the code of the target software using continuous integration tools; A compiling module, configured to compile the code of the target software using the continuous integration tool to obtain a program package of the target software; A configuration module is configured to execute a local shell script of the target software using the continuous integration tool to generate a configuration file of the target software, and mount the configuration file to Nginx of the Docker cluster so that Nginx performs proxy forwarding of the target software according to the configuration file. The local shell script is obtained according to the configuration information of the target software; A deployment module is used to deploy the program package to the Docker cluster using the continuous integration tool.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, it is used to implement the steps of the software deployment method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which can be executed by at least one processor to enable the at least one processor to perform the steps of the software deployment method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Test environment deployment method and device

    CN112650662A

  • Continuous integration method and device, computer equipment and storage medium

    CN113703730A