CN115718606A - Method and system for automatic and continuous integration and deployment of server - Google Patents

Method and system for automatic and continuous integration and deployment of server Download PDF

Info

Publication number
CN115718606A
CN115718606A CN202211515665.7A CN202211515665A CN115718606A CN 115718606 A CN115718606 A CN 115718606A CN 202211515665 A CN202211515665 A CN 202211515665A CN 115718606 A CN115718606 A CN 115718606A
Authority
CN
China
Prior art keywords
file
deployment
server
script
hash value
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
Application number
CN202211515665.7A
Other languages
Chinese (zh)
Inventor
陈勇
叶玎玎
骆晓广
张金银
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Bizhi Technology Co ltd
Original Assignee
Hangzhou Bizhi Technology Co ltd
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 Hangzhou Bizhi Technology Co ltd filed Critical Hangzhou Bizhi Technology Co ltd
Priority to CN202211515665.7A priority Critical patent/CN115718606A/en
Publication of CN115718606A publication Critical patent/CN115718606A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method and a system for automatic continuous integration and deployment of a server, which comprises the following steps: s1, after encoding is completed by a developer, constructing by using a tool depending on current software, forming an independent packed file, and extracting an installation command; s2, uploading a CD script of the software on a server which needs to be deployed by a client enterprise; s3, configuring the running of the CD program, and appointing a packed file position and an installation command in the step S1 through parameterized instruction input; s4, running a CD script by using a command of the current server operating system, automatically pulling a file and executing an installation command for deploying target software, and automatically completing the installation of a program required by the target software and running the target software by using the CD script; and S5, continuously monitoring and operating the CD program, automatically detecting the hash value of the target file at intervals, comparing the hash value with the hash value of the currently deployed file, and executing the step S4 again to finish continuous integration if the change of the file is detected.

Description

Method and system for automatic continuous integration and deployment of server
Technical Field
The invention relates to the field of computer software development, in particular to a method and a system for automatic continuous integration and deployment of a server.
Background
The software development process comprises the following steps: requirement, design, coding, construction, test, release and operation. The method is characterized in that each link needs to be handed over and is realized by the mutual cooperation of different teams, and at the present of rapid change of software requirements, in order to accelerate the software development process and ensure the execution accuracy of each process, the automatic software development process is divided into four steps: continuous Integration (CI) → continuous delivery → Continuous Deployment (CD) → continuous operation and monitoring.
One of the currently common solutions is to use Jenkins (an open source CI tool that provides a friendly operating interface). Generally, after a developer submits new codes to a code library, the code library management is automatically completed, build is automatically performed, automatic packaging is performed, automatic testing is performed, and software is automatically released. Next, the CD component is to deploy the software product to the customer site. For Jenkins, deep cooperation and related use with various systems (such as a code management platform, a test platform, a server management platform and the like) inside an enterprise are needed. In the software deployment in the actual scene, there are many exceptional cases, such as for an enterprise purchasing a third party application, or requiring privatized deployment, or depending on the intranet of the enterprise itself to access each system. Existing tools do not work well or easily in tandem between enterprises.
A traditional deployment method is shown in fig. 1, where other management servers control a deployment server, and this method is limited to a network environment, and the servers to be deployed are all managed uniformly by one enterprise, and for internet product providers and users, under the condition of private deployment, the servers cannot be managed uniformly by external personnel. Meanwhile, when a third-party enterprise provides the same software product to many enterprises, daily maintenance, use, upgrade, etc. of the software of each enterprise may consume a lot of repeated manpower. The invention mainly aims at the problems, provides a scheme for automatic continuous integration and deployment of the server, solves the problem that the server cannot be uniformly managed by external personnel in an actual common scene, shortens the repeated labor in the software delivery process, reduces the continuous integration/delivery application threshold, improves the version delivery efficiency and reduces the operation and maintenance cost.
Disclosure of Invention
Aiming at the problems in the prior art, the invention aims to realize a method and a system for automatic continuous integration and deployment of a server, and the scheme of installing an operating system level script on a deployment server of a software user enterprise enables the software to be continuously integrated/deployed without limitation and complex network environment inside the enterprise, additional server configuration and installation of additional management programs among cooperative enterprises to be avoided, meanwhile, a large amount of repeated manual labor is automated by the programs, the efficiency is improved, and the cost is reduced.
In order to achieve the above object, the present invention provides a method for automatic and continuous integration and deployment of a server, wherein the method comprises the following steps:
s1, after the developer finishes coding, constructing by using a tool depending on the current software, forming an independent packed file, and extracting an installation command, wherein the part is finished in a third-party enterprise;
s2, uploading a CD script of the software on a server which needs to be deployed by a client enterprise;
and S3, configuring the running of the CD program, and specifying the position of the packed file and an installation command in the step S1 through parameterized instruction input. When the CD program runs, the packaged file in the S1 is taken according to the configured packaged file position and the installation command, and the installation command is correspondingly executed;
s4, using the command of the current server operating system to run a CD script, automatically pulling a file according to the position of the packed file in the step S3 and executing an installation command for deploying target software, wherein the CD script automatically starts to execute according to a predetermined series of commands, completes the installation required by the target software, automatically configures the system environment required by the target software and finally runs the target software;
and S5, continuously running and monitoring the CD program, automatically detecting the hash value of the target file at intervals (according to the interval time configured for the CD program in the step S3), comparing the hash value with the hash value of the currently deployed file, and executing the step S4 again to finish continuous integration if the change of the file is detected.
Further, in step S2, the CD script obtains the network location of the packaged file according to the configuration, downloads the packaged file based on the location, stores the downloaded packaged file in the specified directory of the current server, and then executes a series of conventional deployment tasks such as decompressing, creating and storing the directory, and generating a backup file.
Further, in step S3, if the enterprise only has internal network access, the file location in the internal network environment is provided, and if not, the file location in the public network is provided. The file location uses a network link of http protocol.
Further, the CD script may be started and executed by executing a 'script-name.sh' command on the deployment server.
Further, in step S5, when the remote operation is deployed, an http request is sent to the server to trigger the script execution.
Further, the method for detecting the hash value of the file is that an etag field in an http protocol is utilized, the function of the field is equal to the hash value of the file, an http request is initiated according to the position of the provided network file, information of a remote file is obtained by analyzing the etag field in a http network request header, the hash value of the currently deployed file is extracted and compared, if the etag field is inconsistent with the etag field in the http network request header, the remote file is updated, and then a deployment command is operated;
the script is automatically and continuously monitored, which is a method for calling a timing task of an operating system level, executes a command 'crontab-e', opens a system file, adds the script and the execution time, and then automatically executes the command at intervals.
Further, the server that the client side enterprise needs to be subsidized is one or more servers running the Linux operating system, and the CD script of the software is uploaded through a corresponding system management tool 'command line tool'.
Further, the monitoring method is that a certain network port specified by the current server is monitored, and when the network port receives the network traffic, a corresponding program is triggered.
Furthermore, the packed file is a final product constructed by different development languages and tools corresponding to different commands and methods.
In another aspect, the present invention provides a system for automatic and continuous integration and deployment of a server, where the system is configured to implement the method for automatic and continuous integration and deployment of a server according to the present invention.
The beneficial effect of this technique lies in: according to the scheme, the deployment server actively acquires and deploys the required software, is always under the management of the enterprise headquarter, and allows external personnel to control the deployment capability and convenience; the invention ensures that the software is not limited to the complex internal network environment of the enterprise, does not need additional server configuration, does not need to install additional management programs among cooperative enterprises, and does not need a third-party enterprise to consume a large amount of manpower to carry out repeated operation, maintenance and upgrading work of the software by installing the operating system-level script on the deployment server of the enterprise of the software user while continuously integrating/deploying the software. An automated, low-cost, privatized product deployment scheme is implemented.
Drawings
FIG. 1 is a diagram illustrating a conventional deployment in the prior art;
FIG. 2 is a schematic diagram illustrating a deployment method of a method and system for automated continuous integration and deployment of a server according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method and system for continuous integration and deployment of server automation according to an embodiment of the present invention.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplification of description, but do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
The following describes in detail a specific embodiment of the present invention with reference to fig. 2 to 3. It should be understood that the detailed description and specific examples, while indicating the present invention, are given by way of illustration and explanation only, not limitation.
The traditional deployment mode is that other management servers control the deployment server, and the mode is limited by network environment and the like, the servers to be deployed are uniformly managed under one enterprise, for internet product providers and users, the servers cannot be handed to external personnel for uniform management under the condition of private deployment.
As shown in fig. 2, the client-side enterprises ABC are independent of each other, and provide software, codes, programs, systems, and the like by third-party enterprises in a unified manner, and provide infrastructures such as servers by enterprise ABC, and the third-party enterprises are deployed to the servers of the respective enterprises to run. Therefore, the server and the system are still controlled by the ABC of the client side enterprise, and meanwhile, the requirement of continuous updating and deployment of the third-party enterprise can be met.
The invention discloses a method and a system for automatic continuous integration and deployment of a server, wherein the method comprises the following steps:
s1, after the developer finishes coding, constructing and packaging into independent files by using tools on which the current software depends, and extracting installation commands. Different development languages and tools correspond to different commands and methods, but the constructed final product (namely the packed file) is consistent with the invention, and the invention only needs the final packed file. Each piece of software generates a separate file and installation command as development is completed, which is done in a third party enterprise (the company to which the developer belongs). Taking a front-end engineering example in which a front end and a back end are separated and a Vue framework is used, using vscode as a development tool, and executing a 'Vue-cli-servicebuilt' command, a packaged file is generated, and the file contents are as follows:
Figure BDA0003971861200000061
Figure BDA0003971861200000071
this example is a static file used by a general website. The corresponding install/run command is 'services startinginx' (here using the Nginx tool as a run carrier).
S2, on servers to be deployed in client enterprises (enterprise a, enterprise B, and enterprise C in fig. 2), at this time, one or more servers running a Linux operating system are generally used, and relevant professionals upload a CD script (a script generally refers to shellscript, which is a text file used by a computer program, in Unix and all Unix-like systems (i.e., systems used by servers), such as Linux, freeBSD, and other operating systems, where shellscript exists, and a series of commands can be executed at an operating system level) through a corresponding system management tool, generally a "command line tool"; the CD script is as follows:
Figure BDA0003971861200000072
Figure BDA0003971861200000081
the script acquires the network position of the packed file according to the configuration, downloads the packed file based on the position, stores the packed file in the specified directory of the current server, and executes a series of conventional deployment tasks such as decompressing, creating and storing the directory, generating a backup file and the like.
S3, configuring the running of the CD program, and designating the position and the installation command of the packed file in the step S1 through parameterized instruction input, wherein when the CD program runs, the packed file in the step S1 is taken according to the configured position and the installation command of the packed file, and the installation command is correspondingly executed; at the moment, if the enterprise ABC only limits the internal network access, the file position under the internal network environment is provided, otherwise, the file position of the public network can be provided; compared with the traditional deployment scheme, the invention can support software deployment based on an enterprise external network, thereby taking figure 2 as an example, a third-party enterprise can provide a uniform network link of an installation package, simultaneously support software deployment of enterprise ABC and the like, simultaneously, once the content of a file is updated, the enterprise ABC can monitor and update the file to the latest version for automatic continuous integration, thereby greatly reducing the repetitive work of the third-party enterprise, reducing the cost of a software delivery process, shortening the delivery cycle of the software and simultaneously improving the software use efficiency of the enterprise ABC. The parameterized instruction mainly depends on the configured parameters supported by the current CD program, and taking the CD attached in step S2 as an example, the parameters are "project" and "env", which respectively correspond to "project name" and "specified environment" that need to be deployed currently; as described in the code above, the network location of the packaged file is specified and downloaded from this location.
S4, using the command of the current server operating system to run the CD script, automatically pulling the file according to the position of the packed file in the step S3 and executing the installation command for deploying the target software, wherein the process does not need human intervention, the CD script automatically starts to execute according to a predetermined series of commands, and generally, the operation is to complete the dependent installation required by the target software, automatically configure the system environment required by the target software and finally run the target software; if the CD script in step S2 needs to execute the 'script-name.sh' command on the deployment server, the script can be started and executed. The script is a script which can be executed by an operating system of the server without installing any other dependence, namely, the script is not dependent on other software to be installed in the invention. The command of the operating system itself is referred to as a sh command, i.e., the shellscript described above in S2.
S5, the CD program continuously runs and monitors (generally in a mode of monitoring a certain network port appointed by a current server and triggering a corresponding program when the network port receives network traffic), and automatically detects the hash value of a target file (a method for creating a small digital fingerprint from any data through a hash function) at intervals (according to the interval configured for the CD program in the step S3); the invention reduces the continuous integration/delivery application threshold, improves the software delivery efficiency, reduces the operation and maintenance cost, and eliminates the barriers of the software privatization deployment on network difference, enterprise limitation and deployment modes of different software
As shown in fig. 3, the process of continuous deployment of the system is schematic, and the third-party enterprise completes basic development and packaging of the system, and uploads the file to a location designated by the client-side enterprise ABC. Inside the enterprise, the system is deployed to the server and runs by executing the S2-S4 scripts, and the CD scripts continuously monitor whether the system is updated or not for continuous integration through the step S5.
When the remote operation deployment is carried out, the server is triggered to execute the script after monitoring the signal by sending an http request to the server. For example, executing a ` curl ` https:// host.xxx.com: 8080/"" command on the remote operator computer will send an httpget request to the deployment server, where it triggers script execution by listening to port http traffic, such as the following (file name ` list.sh `)
Figure BDA0003971861200000091
Figure BDA0003971861200000101
After starting by the command of shlisten.
Figure BDA0003971861200000102
The method for detecting the hash (hash) value of the file utilizes an etag field in an http protocol, wherein the function of the etag field is equal to the hash value of the file, and the specific method comprises the following steps:
Figure BDA0003971861200000103
Figure BDA0003971861200000111
as for the code in line 2, the hash value of the remote file is obtained, the code in line 8 is compared, if the hash value of the remote file is not consistent with the hash value of the current deployment file, it is indicated that the remote file is updated, and then a deployment command is executed, that is, the code in line 12 shows. The execution results are as follows:
Figure BDA0003971861200000112
the script is automatically and continuously monitored, is a method for calling a system-level timing task, executes a command 'crontab-e', opens a system file, adds the script and the execution time, and then automatically executes the command at intervals. For example, a task of detecting whether the deployment file is updated or not is set to be automatically executed every ten minutes, and the code is as follows:
*/10****/path/compare.sh
according to the scheme of installing the operating system level script on the deployment server of the software user enterprise, the software is continuously integrated/deployed, and meanwhile, the software is not limited by a complex internal network environment of the enterprise, additional server configuration is not needed, additional management programs do not need to be installed among cooperative enterprises, and a third party enterprise does not need to consume a large amount of manpower to conduct repeated operation, maintenance and upgrading work of the software. This is an automated, low-cost, privatized product deployment solution.
The technical advantage of the invention is that the scheme can be normally used by using the functions of the server operating system without additional server configuration; the method does not depend on a complex network environment, and even a system used by an enterprise intranet can be normally deployed by using the scheme; when a plurality of enterprises cooperate with each other, the third-party enterprise (i.e., the software providing company) and the client-side enterprise ABC (i.e., the actual software using company) can continuously integrate/deploy software delivered by the third-party enterprise while maintaining the original system in the client-side enterprise ABC to operate as it is. The third-party enterprise can uniformly manage and automatically upgrade delivery software, so that the operation and maintenance cost is reduced, and the delivery efficiency is improved.
In the description herein, references to the description of the terms "embodiment," "example," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Moreover, various embodiments or examples and features thereof described in this specification may be combined or combined without creating inconsistencies by those skilled in the art.
Although embodiments of the present invention have been shown and described, it will be understood that the embodiments are illustrative and not restrictive, and that modifications, changes, substitutions and variations may be made by those skilled in the art without departing from the scope of the present invention.

Claims (10)

1. A method for automated continuous integration and deployment of servers, the method comprising the steps of:
s1, after completing coding, a developer uses a tool on which current software depends to construct and form an independent packed file, and extracts an installation command; this part is done within the third party enterprise;
s2, uploading a CD script of the software on a server which needs to be deployed by a client enterprise;
s3, configuring the running of the CD program, and designating the position and the installation command of the packed file in the step S1 through parameterized instruction input, wherein when the CD program runs, the packed file in the step S1 is taken according to the configured position and the installation command of the packed file, and the installation command is correspondingly executed;
s4, using the command of the current server operating system to run a CD script, automatically pulling the file according to the position of the packed file in the step S3 and executing an installation command for deploying the target software, wherein the CD script automatically starts to be executed according to a predetermined series of commands, completes the installation required by the target software, automatically configures the system environment required by the target software and finally runs the target software;
and S5, the CD program continuously runs and monitors, the hash value of the target file is automatically detected at set intervals, the hash value is compared with the hash value of the currently deployed file, and if the change of the file is detected, the step S4 is executed again to complete continuous integration.
2. The method according to claim 1, wherein in step S2, the CD script obtains a network location of the packaged file according to the configuration, downloads the packaged file based on the network location, stores the downloaded packaged file in a specified directory of the current server, and then performs a series of conventional deployment tasks such as decompressing, creating and storing the directory, and generating a backup file.
3. The method for the automated continuous integration and deployment of the server according to claim 1 or 2, wherein in step S3, the file location in the intranet environment is provided if the enterprise only has intranet access, and the file location in the public network is provided if the enterprise is not limited, and the file location uses a network link of http protocol.
4. The method of claim 3, wherein the CD script is started and executed by executing a 'sh script-name.sh' command on the deployment server.
5. The method for automated server continuous integration and deployment according to claim 4, wherein in step S5, when the deployment is operated remotely, by sending an http request to the server, the server triggers the script to execute after monitoring the http request.
6. The method for the automated continuous integration and deployment of the server according to claim 5, wherein the method for detecting the hash value of the file utilizes etag field in http protocol, and the function of the etag field is equal to the hash value of the file; initiating an http request according to the position of the provided network file, acquiring information of the remote file by analyzing an etag field in a http network request header, extracting a hash value of the currently deployed file, comparing the hash value with the hash value of the currently deployed file, if the hash value is consistent with the hash value of the currently deployed file, not operating, if the hash value is inconsistent with the hash value of the currently deployed file, indicating that the remote file is updated, and then running a deployment command; and then the script automatically and continuously monitors, which is a method for calling a timing task of an operating system level, executes a command 'crontab-e', opens a system file, adds the script and the execution time, and then automatically executes the command at intervals.
7. The method of claim 1, wherein in step S2, the server that the client enterprise needs to subsidize is one or more servers running Linux operating systems, and the CD script of the software is uploaded through a corresponding system management tool "command line tool".
8. The method according to claim 1, wherein in step S5, the monitoring method is to monitor a network port specified by the current server, and when the network port receives network traffic, trigger a corresponding program.
9. The method for the automatic continuous integration and deployment of the server according to claim 1, wherein the packaged files correspond to different commands and methods for different development languages and tools, and are constructed into finished final products.
10. A system for automatic continuous integration and deployment of servers, characterized in that, the system is used for realizing the method for automatic continuous integration and deployment of servers according to any one of claims 1-9.
CN202211515665.7A 2022-11-30 2022-11-30 Method and system for automatic and continuous integration and deployment of server Pending CN115718606A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211515665.7A CN115718606A (en) 2022-11-30 2022-11-30 Method and system for automatic and continuous integration and deployment of server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211515665.7A CN115718606A (en) 2022-11-30 2022-11-30 Method and system for automatic and continuous integration and deployment of server

Publications (1)

Publication Number Publication Date
CN115718606A true CN115718606A (en) 2023-02-28

Family

ID=85257031

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211515665.7A Pending CN115718606A (en) 2022-11-30 2022-11-30 Method and system for automatic and continuous integration and deployment of server

Country Status (1)

Country Link
CN (1) CN115718606A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115904419A (en) * 2023-03-03 2023-04-04 杭州比智科技有限公司 Method and device for installing application software based on automatic script
CN116389254A (en) * 2023-06-05 2023-07-04 天津金城银行股份有限公司 Resource version control method, popup confirmation method, device, equipment and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115904419A (en) * 2023-03-03 2023-04-04 杭州比智科技有限公司 Method and device for installing application software based on automatic script
CN116389254A (en) * 2023-06-05 2023-07-04 天津金城银行股份有限公司 Resource version control method, popup confirmation method, device, equipment and medium

Similar Documents

Publication Publication Date Title
CN115718606A (en) Method and system for automatic and continuous integration and deployment of server
CN110572436B (en) Multi-place cross-cluster server deployment method and system
CN107729066B (en) Automatic construction and release method and device based on SVN (singular value decomposition) resource library
US8819670B2 (en) Automated software installation with interview
CN110768833A (en) Application arrangement and deployment method and device based on kubernets
KR100596298B1 (en) System and method for the automatic installation and configuration of an operating system
US8640098B2 (en) Offline configuration and download approach
CN111506322A (en) Automatic integrated construction development deployment platform and method
CN112437140B (en) Method and device for remotely exporting TBOX log
EP3035644A2 (en) Determined configuration update for edge components
US11237949B2 (en) Systems and methods for on-demand container-based development environments
CN113721931B (en) Automatic service deployment method, system and computer readable storage medium
CN111026411A (en) Software remote deployment management method and management machine
CN109558147A (en) A kind of continuous integrating platform construction method based on Jenkins and Gitlab
CN111147272A (en) Single server and multi-server operation platform upgrading method
CN111651352B (en) Warehouse code merging method and device
EP2137614A1 (en) On-line configuration management system and method
CN113326053A (en) Robot management system and method
CN116820493A (en) Mirror image file deployment method, system, equipment and storage medium
US10318284B2 (en) System and method of generating and managing computing tasks
CN112130889A (en) Resource management method and device, storage medium and electronic device
US9207928B2 (en) Computer-readable medium, apparatus, and methods of automatic capability installation
US20100281294A1 (en) Method of managing operations for administration, maintenance and operational upkeep, management entity and corresponding computer program product
CN115357258B (en) Application deployment method and device, storage medium and electronic device
CN115080076B (en) Cloud mobile phone software management method

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