Software deployment method and device
By including configuration file modification scripts in the software installation package, automatically modifying the deployment environment configuration files and verifying reliability, the problem of difficulty in baseline configuration file management is solved, software development and deployment efficiency is improved, and software development and deployment are ensured to ensure that the software runs stably in the deployment environment.
Patent Information
- Application Number
- CN202111341496.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-12
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2041-11-12
AI Technical Summary
During the software development and deployment process, the existing technology is difficult to manage baseline configuration files, high deployment costs and low efficiency, and cannot effectively deal with the complexity problems caused by changes in demand and multi-person collaboration.
By including configuration file modification scripts in the software installation package, the configuration files in the deployment environment are automatically modified, and reliability is ensured by comparing edit distances and baseline configuration files, and software deployment without baseline configuration files is achieved.
It improves software development and deployment efficiency, ensures that the software runs stably in the deployment environment, and solves the problem of difficulty in baseline configuration file management.
Smart Images

Figure CN114003250B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of computer software technology and artificial intelligence technology, and in particular to a software deployment method and device. Background Art
[0002] In the process of software project development, changes in software requirements are an inevitable problem. When software requirements change, in order to maintain the consistency of various configuration components of the software, strict product control must be implemented, mainly baseline configuration management.
[0003] Baseline configuration management is based on baseline configuration files, that is, the software development, software testing, and software deployment processes are all based on baseline configuration files.
[0004] During software deployment, the target server for software deployment needs to be configured according to the baseline configuration file so that the software can run successfully on the target server. The existing technology provides the following two configuration solutions:
[0005] Solution 1 involves directly overwriting the baseline configuration file corresponding to the official software version to the target environment. However, this solution has a limited scope of application. Firstly, to ensure that the target program code can parse the target configuration file, strict baseline configuration file requirements are required, which increases software development and maintenance costs. Secondly, the software development environment and the target environment for software deployment often differ significantly, making the baseline configuration file incomplete and requiring manual deployment. This configuration solution increases maintenance costs and reduces software deployment efficiency.
[0006] Solution 2 replaces variable identifiers in the baseline configuration file corresponding to the official software version with customized values for the target environment before overwriting the target environment. However, this solution also has a limited scope of application. The reasons are: first, strict requirements are imposed on the baseline configuration file, increasing software development and maintenance costs; second, strict formatting requirements for the baseline configuration file only apply to replacing variable identifiers, and operations such as adding rows or deleting identifiers are not possible. Furthermore, this solution cannot be used with complex Extensible Markup Language (XML) and JavaScript Object Notation (JSON) files.
[0007] Furthermore, during parallel development, if software requirements change, multiple developers may need to modify the same baseline configuration file, which can complicate software deployment. For example, when deploying software based on a baseline configuration file, developers may need to review the baseline configuration file multiple times to ensure consistency before deploying the software, significantly increasing software development and deployment costs. Alternatively, multiple deployments may be required based on baseline configuration files modified by different developers, reducing software deployment efficiency.
[0008] In summary, it can be seen that software deployment based on baseline configuration files has problems such as difficult baseline configuration file management, high deployment costs, and low deployment efficiency during software development and long-term operation, and cannot well meet user needs. Summary of the Invention
[0009] The present application provides a software deployment method and device, which can perform software deployment without relying on baseline configuration files, thereby improving the efficiency of software development and deployment.
[0010] In a first aspect, the present application provides a method for software deployment, comprising: obtaining an installation package of a target software, the installation package of the target software including at least one configuration file modification script; modifying a configuration file in a deployment environment based on the at least one configuration file modification script to obtain a modified configuration file; determining whether the reliability of the modified configuration file meets the requirements; if the reliability of the modified configuration file meets the requirements, installing the target software based on the modified configuration file and the installation package of the target software.
[0011] Based on the above technical solution, a configuration file modification script is placed in the software installation package, so that before the target software is installed, the configuration file in the software deployment environment can be automatically modified according to the configuration file modification script. This allows software deployment without an unknown baseline configuration file, solving the problem of difficult baseline configuration file management and improving the efficiency of software development and deployment. In addition, the technical solution provided by this application can also verify the modified configuration file to ensure that the reliability of the modified configuration file meets the requirements, so that the software can run stably in the deployment environment.
[0012] Optionally, before modifying the configuration file in the deployment environment, the above method also includes: backing up the configuration file to obtain a backup configuration file; after determining whether the reliability of the modified configuration file meets the requirements, the above method also includes: if the reliability of the modified configuration file does not meet the requirements, rolling back the modified configuration file based on the backup configuration file.
[0013] Optionally, determining whether the reliability of the modified configuration file meets the requirements includes: determining whether the edit distance between the modified configuration file and the backup configuration file is less than or equal to a first threshold; and / or, when the installation package of the target software also includes a baseline configuration file, determining whether the edit distance between the modified configuration file and the baseline configuration file is less than or equal to a second threshold.
[0014] Optionally, if the reliability of the modified configuration file does not meet the requirements, the method further includes: determining where the configuration file was modified by the configuration file modification script based on the modified configuration file and the backup configuration file; and sending an alarm message, where the alarm message indicates where the configuration file was modified by the configuration file modification script. In this way, if the reliability of the modified configuration file does not meet the requirements, the modified configuration file is compared with the backup configuration file to find where the configuration file was modified by the configuration file modification script, so that relevant personnel can clearly find the problem and then solve the problem in a targeted manner, thereby improving the efficiency of software deployment.
[0015] Optionally, the installation package of the target software is used to install the target software corresponding to the first version number; before obtaining the installation package of the target software, the above method further includes: based on the log file, checking whether the target software corresponding to the first version number has been installed or is being installed; obtaining the installation package of the target software includes: when the target software corresponding to the first version number has not been installed or is not being installed, obtaining the installation package of the target software. Based on the above technical solution, before obtaining the software installation package, based on the log file, checking whether a deployment operation is in progress in the deployment environment; or whether the first version number of the target software has been deployed in the deployment environment. In this way, repeated deployment of the same version number of the same software can be avoided, and deployment confusion caused by performing multiple deployment operations simultaneously in the deployment environment can be avoided.
[0016] In a second aspect, the present application provides a software deployment device, comprising: an acquisition module for acquiring an installation package of a target software, the installation package of the target software including at least one configuration file modification script; a processing module for modifying a configuration file in a deployment environment based on at least one configuration file modification script to obtain a modified configuration file; a judgment module for judging whether the reliability of the modified configuration file meets the requirements; and an installation module for installing the target software based on the modified configuration file and the installation package of the target software if the reliability of the modified configuration file meets the requirements.
[0017] Optionally, the processing module is further configured to back up the configuration file to obtain a backed-up configuration file; if the reliability of the modified configuration file does not meet the requirements, the modified configuration file is rolled back based on the backed-up configuration file.
[0018] Optionally, the judgment module is specifically used to determine whether the edit distance between the modified configuration file and the backup configuration file is less than or equal to a first threshold; and / or, when the installation package of the target software also includes a baseline configuration file, determine whether the edit distance between the modified configuration file and the baseline configuration file is less than or equal to a second threshold.
[0019] Optionally, the processing module is also used to determine where the configuration file is modified by the configuration file modification script based on the modified configuration file and the backup configuration file; the device also includes a notification module for sending an alarm message, and the alarm message is used to indicate where the configuration file is modified by the configuration file modification script.
[0020] Optionally, the acquisition module is further used to check whether the target software corresponding to the first version number has been installed or is being installed based on the log file; when the target software corresponding to the first version number has not been installed or is not being installed, obtain the installation package of the target software.
[0021] In a third aspect, the present application provides a software deployment device, comprising: one or more processors; the processor is used to execute computer program code in a memory, the computer program code including instructions, so that the software deployment device executes any one of the software deployment methods provided in the first aspect above.
[0022] In a fourth aspect, the present application provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a computer, the computer executes any one of the software deployment methods provided in the first aspect.
[0023] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when run on a computer, enables the computer to execute any one of the software deployment methods provided in the first aspect above.
[0024] The descriptions of the second to fifth aspects of this application can refer to the detailed description of the first aspect; and the beneficial effects of the descriptions of the second to fifth aspects can refer to the analysis of the beneficial effects of the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A schematic diagram of the architecture of a software deployment system provided for this application;
[0026] Figure 2 A flowchart of a software deployment method provided in this application;
[0027] Figure 3 A flowchart of another software deployment method provided for this application;
[0028] Figure 4 A flowchart of another software deployment method provided by this application;
[0029] Figure 5 A schematic diagram of the structure of a software deployment device provided in this application;
[0030] Figure 6 A schematic diagram of the structure of another software deployment device provided in this application. DETAILED DESCRIPTION
[0031] The following is a detailed description of a software deployment method and device provided by this application in conjunction with the accompanying drawings.
[0032] The term "and / or" in this article is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0033] The terms "first" and "second" and the like in the specification and drawings of this application are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.
[0034] Furthermore, the terms "including," "having," and any variations thereof, as used in the description of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not limited to the listed steps or units but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to the process, method, product, or apparatus.
[0035] It should be noted that in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0036] In the description of the present application, unless otherwise specified, “plurality” means two or more.
[0037] As described in the background, when deploying software, configuration files in the deployment environment must be modified based on a baseline configuration file to ensure successful software execution on the target server. A baseline configuration file is a formal version of the configuration file determined based on pre-configured configuration items. During software development, deployment, and operation, each modification or change to the software version requires the generation of a new baseline configuration file.
[0038] During software development and long-term operation, changes in requirements are inevitable. Therefore, software deployment based on baseline configuration files will have problems such as difficult baseline configuration file management, high deployment costs, and low deployment efficiency, which cannot meet user needs well.
[0039] In response to the above technical problems, an embodiment of the present application provides a software deployment method and device, which specifically include: obtaining an installation package of the target software, the installation package of the target software includes at least one configuration file modification script, and the configuration file modification script is used to automatically modify the configuration file in the deployment environment; based on the at least one configuration file modification script, modifying the configuration file to obtain a modified configuration file; judging whether the reliability of the modified configuration file meets the requirements; if the reliability of the modified configuration file meets the requirements, installing the target software based on the modified configuration file and the installation package of the target software.
[0040] Based on the technical solution provided by the embodiments of this application, a configuration file modification script is placed in the software installation package, so that before the target software is installed, the configuration file in the software deployment environment can be automatically modified according to the configuration file modification script. In this way, software deployment can be carried out even when the baseline configuration file is unknown, solving the problem of difficult baseline configuration file management and improving the efficiency of software development and deployment. In addition, the technical solution provided by this application can also test the modified configuration file to ensure that the reliability of the modified configuration file meets the requirements, so that the software can run stably in the deployment environment.
[0041] Generally, software deployment is usually divided into two types: manual deployment and automated deployment. Manual deployment means that the deployment personnel need to manually overwrite the official version of the software (i.e., the version of the software officially put into use) to the directory corresponding to the target server, and manually add, delete, modify or search the configuration files in the deployment environment of the target server according to the baseline configuration file. Automated deployment refers to deploying the official version of the software, baseline configuration files and other related files to the target server through a software automation deployment tool. In some embodiments of the present application, a software automation deployment tool is used for software deployment.
[0042] See also Figure 1 , is a schematic diagram of the architecture of a software deployment system applicable to the embodiment of this application. Figure 1 As shown, the software deployment system includes a terminal 10 and a target server 20 , and the terminal 10 can establish a connection with the target server 20 via a network (wired network or wireless network).
[0043] The terminal 10 is a device used by software developers, who can log in to the target server 20 through the terminal 10 and then control the target server 20 to install and deploy the software.
[0044] In some embodiments, a software automation deployment tool is deployed on the terminal 10. The software automation deployment tool can receive a software deployment request from the target server 20 and automatically execute the software deployment operation according to the software deployment request. In addition, before executing the software deployment operation, the terminal 10 can also modify the configuration file of the target server 20 according to the configuration file modification script.
[0045] Exemplarily, the terminal 10 may be a mobile phone, a tablet computer, a laptop computer, a desktop computer, a portable computer, etc., which is not limited in the embodiments of the present application.
[0046] The target server 20 may execute the operation instruction issued by the terminal to modify the configuration file of the software deployment environment, so as to realize the download, installation and operation of the target software.
[0047] In some embodiments, the target server 20 may be a server with a front-end project built on it; or, the target server 20 may be a content delivery network (CDN) server.
[0048] In some embodiments, the target server 20 may be a single server, or a server cluster consisting of multiple servers, which is not limited in the embodiments of the present application.
[0049] The embodiments provided in this application are described in detail below with reference to the accompanying drawings.
[0050] like Figure 2 As shown, the embodiment of the present application provides a software configuration method, which is applied to Figure 1 In the target server 20 of the software deployment system shown, the method includes:
[0051] S101: Obtain an installation package of target software, where the installation package of the target software includes at least one configuration file modification script.
[0052] The above-mentioned configuration file modification scripts are scripts written by developers according to development specifications, and include operations based on dimensions such as rows, keywords, fuzzy keywords, columns, nodes, XML, and JSON. Configuration file modification scripts are used to automatically modify configuration files in the deployment environment by locating, replacing, adding, and deleting strings.
[0053] The configuration file includes one or more configuration items, such as a program project, an Internet protocol (IP) address, or a running path.
[0054] The target software is the software that needs to be deployed on the target server. Because the development environment of the target software differs from the deployment environment on the target server, the target software can be successfully deployed on the target server by modifying the configuration files in the target server's deployment environment.
[0055] Optionally, when the target software is developed in parallel by multiple developers, the installation package of the target software may include one or more configuration file modification scripts, each configuration file modification script being used to modify a corresponding configuration file.
[0056] For example, assuming each developer independently develops a functional module of the target software, and there are no interdependencies between the functional modules, each functional module can be independently distributed to the target server for deployment. To modify the configuration file corresponding to that functional module, each developer only needs to write a configuration file modification script corresponding to that functional module and distribute the modified configuration file independently. In this case, the target software installation package can contain only one configuration file modification script.
[0057] For example, suppose three developers are developing the target software in parallel: Developer A develops functional module A1, Developer B develops functional module B1, and Developer C develops functional module C1. Functional modules A1, B1, and C1 have no dependencies on each other. To ensure the successful operation of each functional module of the target software on the target server, modifications to the target server's configuration files may be required. In this case, Developer A can write only a configuration file modification script for functional module A1 and independently send it to the target server. Developer B can write only a configuration file modification script for functional module B1 and independently send it to the target server. Developer C can write only a configuration file modification script for functional module C1 and independently send it to the target server.
[0058] Another example is to assume that each developer independently develops a functional module, but there are interdependencies between the functional modules and they need to be executed sequentially. Then, when modifying the configuration file, after each developer completes the configuration file modification script corresponding to the functional module, he or she must also put the configuration file modification scripts corresponding to the previous one or more functional modules into the target software installation package in the order of execution. At this time, the target software installation package needs to contain multiple configuration file modification scripts.
[0059] For example, suppose three developers are developing the target software in parallel. Developer A develops functional module A1, Developer B develops functional module B1, and Developer C develops functional module C1. Functional modules A1, B1, and C1 are interdependent and need to be executed in the order A1-B1-C1. To ensure the successful operation of each functional module of the target software on the target server, modifications to the target server's configuration files may be required. In this case, Developer A can simply write a configuration file modification script corresponding to Functional Module A1 and send it independently to the target server. After Developer B completes the configuration file modification script corresponding to Functional Module B1, he or she must also arrange the configuration file modification script corresponding to Functional Module A1 before the configuration file modification script corresponding to Functional Module B1 and send both configuration file modification scripts to the target server. After Developer C completes the configuration file modification script corresponding to Functional Module C1, he or she must also arrange the configuration file modification scripts corresponding to Functional Module A1 and Functional Module B1 before the configuration file modification script corresponding to Configuration File A1 and send all three configuration file modification scripts to the target server.
[0060] In some embodiments, a deployer can remotely log in to a target server via a terminal and instruct the target server to download the target software installation package from a software database. The target server can then obtain the target software installation package. In this way, the terminal, through the software automation deployment tool deployed on it, automatically controls the target server to deploy the target software, eliminating the need for manual operation by the deployer.
[0061] Exemplarily, in response to a login request from a terminal carrying an account and password, the target server verifies the account and password carried in the login request; if the account and password are verified, the target server allows the terminal to log in to the target server, so that the deployment personnel can operate the target server through the terminal. Optionally, when logging in remotely, a secure shell (SSH) protocol can be used between the terminal and the target server.
[0062] In some embodiments, the target software installation package is used to install the target software corresponding to a first version number. The first version number may be the latest version of the target software. Based on this, optionally, before obtaining the target software installation package, the following steps are further included:
[0063] Step 1: Based on the log file, check whether the target software corresponding to the first version number has been installed or is being installed.
[0064] The log file is used to record the software installation status in the target server's deployment environment. For example, a start marker may be recorded in the log file when the software installation begins, and an end marker may be recorded in the log file when the software installation is complete. Furthermore, the log file may also record the version and model of each software installed in the deployment environment.
[0065] In this way, by checking the version model of the software installed in the deployment environment recorded in the log file, it is possible to determine whether the target software corresponding to the first version number has been installed in the deployment environment; or, by checking whether the start mark and end mark of the target software corresponding to the first version number recorded in the log file are complete, it is possible to determine whether the deployment environment is installing the target software corresponding to the first version number.
[0066] Accordingly, step S101 may be specifically implemented as: when the target software corresponding to the first version number is not installed or is not being installed, obtaining the installation package of the target software.
[0067] It should be understood that if the target software corresponding to the first version number has already been installed in the deployment environment, then there is no need to reinstall it. In other words, there is no need to obtain the target software installation package at this time. If the target software corresponding to the first version number is already installed in the deployment environment, then repeating the deployment operation at this time will cause deployment confusion in the deployment environment. Therefore, there is no need to obtain the target software installation package.
[0068] In some embodiments, after the deployment personnel remotely log in to the target server through a terminal, dual authentication is required between the target server and the target software. That is, verification is required to verify whether the target server needs to install the target software and whether the target server has permission to install the target software. For example, both the target software installation package and the target server have identification information. The target server determines whether the target software needs to be installed by identifying the identification information of the target software installation package; correspondingly, the target software installation package determines whether the target server has permission to install the target software by identifying the identification information of the target server.
[0069] After the double authentication, the target server executes the following steps S102-S104. Thus, by performing double authentication between the target server and the target software, it is possible to avoid target software deployment errors that affect the normal operation of the target server.
[0070] S102: Modify a configuration file in the deployment environment based on at least one configuration file modification script to obtain a modified configuration file.
[0071] Exemplarily, the configuration file modification script may include the following functions: find(·) function for finding and locating a string, insert(·) function for inserting a specified object into a specified position, replace(·) function for replacing a specified string in the text with another string, and delete(·) function for deleting a specified string.
[0072] According to the above configuration file modification script, operations such as string positioning, string addition, string modification, string deletion or string replacement can be completed to modify the configuration file and obtain the modified configuration file.
[0073] In some embodiments, before modifying the configuration file, the method further includes: backing up the configuration file to obtain a backed-up configuration file.
[0074] In some embodiments, each modification operation of the configuration file by the configuration file modification script may also be recorded in a log file.
[0075] It should be understood that the purpose of the configuration file modification script modifying the configuration file and then deploying the target software based on the modified configuration file is to make the configuration items in the deployment environment of the target software on the target server basically consistent with the configuration items in the development environment when the developer developed the target software, thereby ensuring that the target software can be installed on the target server and that the target server can run the target software normally.
[0076] S103: Determine whether the reliability of the modified configuration file meets the requirements.
[0077] Optionally, step S103 may be implemented in at least one of the following ways:
[0078] Implementation method 1: determining whether the reliability of the modified configuration file meets the requirement by judging whether the edit distance between the modified configuration file and the backup configuration file is less than or equal to a first threshold.
[0079] The reliability of the modified configuration file is determined to meet the requirements when the edit distance between the modified configuration file and the backup configuration file is less than or equal to a first threshold. Because the edit distance between the modified configuration file and the backup configuration file reflects the difference between the modified configuration file and the backup configuration file, the reliability of the modified configuration file is determined to meet the requirements only when the configuration file modification script makes minor changes to the configuration file and the boundary distance between the modified configuration file and the backup configuration file is less than or equal to the first threshold.
[0080] The first threshold can be determined based on experimental tests, simulations, expert experience, etc.
[0081] Exemplarily, the edit distance between the modified configuration file and the backup configuration file may be determined according to the following formula (1).
[0082]
[0083] Wherein, Lev represents the Levenshtein Distance algorithm, a represents the string in the backup configuration file, b represents the string in the modified configuration file, and Lev a,b (i,j) represents the distance between the i-th character in string a and the j-th character in string b.
[0084] When min(i, j) = 0, that is, one of i or j has a value of 0, indicating that one of string a and string b is an empty string, then converting from string a to string b only requires max(i, j) single-character editing operations. Therefore, the edit distance is max(i, j), which is the maximum value of i and j.
[0085] Implementation method 2: when the installation package of the target software also includes a baseline configuration file, whether the reliability of the modified configuration file meets the requirement is determined by judging whether the edit distance between the modified configuration file and the baseline configuration file is less than or equal to a second threshold.
[0086] The modified configuration file is determined to meet reliability requirements when the edit distance between the modified configuration file and the baseline configuration file is less than or equal to a second threshold. Since the edit distance between the modified configuration file and the baseline configuration file reflects the difference between the modified configuration file and the baseline configuration file, and the baseline configuration file is the official version of the configuration file, the smaller the difference between the modified configuration file and the official version, the better. Therefore, the modified configuration file is determined to meet reliability requirements only when the edit distance between the modified configuration file and the baseline configuration file is less than or equal to the second threshold.
[0087] The second threshold can be determined based on experimental tests, simulations, expert experience, etc.
[0088] Exemplarily, the edit distance between the modified profile and the baseline profile may be determined according to the above formula (1).
[0089] Wherein, Lev represents the Levenshtein Distance algorithm, a represents the string in the modified configuration file, b represents the string in the baseline configuration file, and Leva,b (i,j) represents the distance between the i-th character in string a and the j-th character in string b.
[0090] S104: If the reliability of the modified configuration file meets the requirement, the target software is installed based on the modified configuration file and the installation package of the target software.
[0091] In some embodiments, when the edit distance between the modified configuration file and the backup file is less than or equal to a first threshold, and / or the edit distance between the modified configuration file and the baseline configuration file is less than or equal to a second threshold, it is determined that the reliability of the modified configuration file meets the requirements.
[0092] In some embodiments, a software automation deployment tool is deployed on the terminal, which can automatically execute the installation operation of the target software on the target server. During the installation of the target software, the terminal can view the installation progress of the software on the target server and control the start or stop of the installation operation by controlling the software automation deployment tool.
[0093] based on Figure 2 The provided technical solution offers at least the following beneficial effects: By placing a configuration file modification script within the software installation package, the target software can automatically modify the configuration file in the software deployment environment based on the configuration file modification script before installation. This allows software deployment without an unknown baseline configuration file, resolving the difficulty of managing baseline configuration files and improving the efficiency of software development and deployment. Furthermore, the technical solution provided by this application can also verify the modified configuration file to ensure that its reliability meets requirements, enabling the software to run stably in the deployment environment.
[0094] Optional, based on Figure 2 The embodiment shown, as Figure 3 As shown, when the reliability of the modified configuration file does not meet the requirement, the software deployment method may further include the following step S105:
[0095] S105: If the reliability of the modified configuration file does not meet the requirement, the modified configuration file is rolled back based on the backup configuration file.
[0096] In some embodiments, when the edit distance between the modified configuration file and the backup file is greater than a first threshold; or when the edit distance between the modified configuration file and the baseline configuration file is greater than a second threshold, it is determined that the reliability of the modified configuration file does not meet the requirements.
[0097] The rollback operation is the act of restoring a program or data to its last correct state when an error occurs in the program or data. In an embodiment of the present application, the rollback operation on the modified configuration file based on the backup configuration file means overwriting (or replacing) the modified configuration file whose reliability does not meet the requirements with the backup configuration file.
[0098] The technical solution provided in the embodiment of the present application brings at least the following beneficial effects: when the reliability of the modified configuration file does not meet the requirements, the modified configuration file is rolled back based on the backup configuration file. In this way, through the rollback operation, the modified configuration file whose reliability does not meet the requirements can be discarded, and then steps S102-S103 are re-executed based on the backup configuration file until a modified configuration file whose reliability meets the requirements is obtained.
[0099] Optional, based on Figure 3 The embodiment shown, as Figure 4 As shown, when the reliability of the modified configuration file does not meet the requirements, the software deployment method may further include the following steps S106-S107:
[0100] S106: If the reliability of the modified configuration file does not meet the requirement, determine where the configuration file is modified by the configuration file modification script based on the modified configuration file and the backup configuration file.
[0101] As a possible implementation, a longest common subsequence (LCS) dynamic programming algorithm may be used to determine where the configuration file is modified by the configuration file modification script based on the modified configuration file and the backup configuration file.
[0102] For example, select a string text1 from the modified configuration file and a string text2 from the backup configuration file. Assume that the length of string text1 is m and the length of string text2 is n. Create a two-dimensional array dp with m+1 rows and n+1 columns, where dp[i][j] represents the length of the longest common subsequence of strings text1[0:i] and text2[0:j].
[0103] Consider the boundary case of dynamic programming: when i = 0, text1[0:i] is empty. The length of the longest common subsequence of the empty string and any string is 0. Therefore, for any 0≤j≤n, dp[0][j] = 0; when j = 0, text2[0:j] is empty. Similarly, for any 0≤i≤n, dp[i][0] = 0. Therefore, the boundary case of dynamic programming is: when i = 0 or j = 0, dp[i][j] = 0.
[0104] When i>0 and j>0, consider the calculation of dp[i][j]:
[0105] When text1[i-1]=text2[j-1], the two identical characters are called common characters. Consider the longest common subsequence of text1[0:i-1] and text2[0:j-1], and add one more character (i.e., the common character) to get the longest common subsequence of text1[0:i] and text2[0:j], so dp[i][j]=dp[i-1][j-1]+1.
[0106] When text1[i-1]≠text2[j-1], consider the following two items: the longest common subsequence of text1[0:i-1] and text2[0:j]; the longest common subsequence of text1[0:i] and text2[0:j-1]. To obtain the longest common subsequence of text1[0:i] and text2[0:j], the larger of the two items should be taken, so dp[i][j] = max{dp[i-1][j], dp[i][j-1]}.
[0107] From this, we can get the state transfer equation shown in formula (2):
[0108]
[0109] According to the above formula (2), the final calculated dp[m][n] is the length of the longest common subsequence of the character strings text1 and text2.
[0110] According to the length of the longest common subsequence of the strings text1 and text2, the longest common subsequence of the strings text1 and text2 is determined, and then by excluding the longest common subsequence of the strings text1 and text2, the place where the configuration file is modified by the configuration file modification script can be obtained.
[0111] S107: The target server sends an alarm message to the terminal.
[0112] The above-mentioned warning information is used to indicate where the configuration file modification script modifies the configuration file.
[0113] In some embodiments, the terminal receives the alarm information to learn where the configuration file modification script modifies the configuration file, and then checks where the configuration file modification script modifies the configuration file to find out the problem that causes the reliability of the modified configuration file to fail to meet the requirements.
[0114] In some embodiments, after finding the problem that causes the reliability of the modified configuration file to not meet the requirements, a rollback operation can be performed on each modification operation of the configuration file based on the configuration file modification script recorded in the log file to solve the problem that causes the reliability of the modified configuration file to not meet the requirements.
[0115] The technical solution provided in the embodiments of the present application at least brings the following beneficial effects: when the reliability of the modified configuration file does not meet the requirements, the configuration file modification script is determined based on the modified configuration file and the backup configuration file, so that the deployment personnel can find out the problem that causes the reliability of the modified configuration file to not meet the requirements, and then solve the problem in a targeted manner, so that the target software can be successfully deployed in the deployment environment.
[0116] It should be noted that the present embodiment does not limit the execution order of step S105 and steps S106-S107. For example, step S105 may be executed first, followed by steps S106-S107; or, steps S106-S107 may be executed first, followed by step S105; or, steps S105 and S106-S107 may be executed simultaneously.
[0117] For ease of understanding, the following further introduces a software deployment method provided in an embodiment of the present application by taking three developers each responsible for parallel development and deployment of a functional module of the target software as an example.
[0118] If the three functional modules of the target software have no dependencies on each other, the configuration files corresponding to the functional modules that each developer is responsible for can be sent to the target server separately. Therefore, the software deployment steps performed by each developer are the same:
[0119] 1. Developers write configuration file modification scripts corresponding to the functional modules they are responsible for according to development specifications;
[0120] 2. The tester tests the configuration file modification script. After the test is successful, the configuration file modification script is placed into the installation package of the target software corresponding to the first version number;
[0121] 3. Sending the installation package of the target software corresponding to the first version number to the version library, wherein the installation package of the target software corresponding to the first version number includes a configuration file modification script;
[0122] 4. Log in to the target server and obtain the installation package of the target software corresponding to the first version number from the version library;
[0123] 5. Perform dual authentication between the target server and the target software. If the authentication between the target server and the target software is successful, back up the configuration files in the current target server.
[0124] 6. Based on the log file, check whether the target software corresponding to the first version number has been installed or is being installed on the target server;
[0125] 7. When the target software corresponding to the first version number is not installed or is not being installed on the target server, modify the configuration file on the target server by locating, replacing, adding, deleting, or other modification operations such as character strings according to the configuration file modification script to obtain a modified configuration file; each modification operation of the configuration file by the configuration file modification script is recorded in a log file;
[0126] 8. Use the edit distance algorithm to determine whether the reliability of the modified configuration file meets the requirements based on the backup configuration file or the baseline configuration file;
[0127] 9. If the reliability of the modified configuration file does not meet the requirements, roll back the modified configuration file based on the backup configuration file; or, based on the modified configuration file and the backup configuration file, determine where the configuration file is modified by the configuration file modification script, and send an alarm message to the terminal;
[0128] 10. When the reliability of the modified configuration file meets the requirements, the target software is installed based on the modified configuration file and the installation package of the target software.
[0129] It can be seen that the above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to achieve the above functions, the embodiment of the present application provides hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in combination with the modules and algorithm steps of each example described in the embodiment disclosed herein, the embodiment of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0130] In the embodiments of the present application, the functional modules of the network nodes can be divided according to the above-mentioned method examples. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated modules can be implemented in the form of hardware or software functional modules. Optionally, the division of modules in the embodiments of the present application is schematic and is only a logical functional division. In actual implementation, other division methods can be used.
[0131] like Figure 5 Figure 3 is a schematic diagram of the structure of a software deployment device provided in an embodiment of the present application. This device can perform software deployment without relying on baseline configuration files, improving the efficiency of software development and deployment. The software deployment device 300 includes an acquisition module 301, a processing module 302, a determination module 303, and an installation module 304. In some embodiments, the software deployment device 300 may also include a notification module 305.
[0132] The acquisition module 301 is used to acquire the installation package of the target software, where the installation package of the target software includes at least one configuration file modification script.
[0133] The processing module 302 is configured to modify the configuration file in the deployment environment based on at least one configuration file modification script to obtain a modified configuration file.
[0134] The judgment module 303 is used to judge whether the reliability of the modified configuration file meets the requirements.
[0135] The installation module 304 is configured to install the target software based on the modified configuration file and the installation package of the target software if the reliability of the modified configuration file meets the requirement.
[0136] In some embodiments, the processing module 302 is further configured to back up the configuration file to obtain a backup configuration file; if the reliability of the modified configuration file does not meet the requirements, the modified configuration file is rolled back based on the backup configuration file.
[0137] In some embodiments, the above-mentioned judgment module 303 is specifically used to determine whether the edit distance between the modified configuration file and the backup configuration file is less than or equal to a first threshold; and / or, when the installation package of the target software also includes a baseline configuration file, determine whether the edit distance between the modified configuration file and the baseline configuration file is less than or equal to a second threshold.
[0138] In some embodiments, the processing module 302 is further configured to determine, based on the modified configuration file and the backup configuration file, where the configuration file modification script has modified the configuration file. The notification module 305 is configured to send an alarm message indicating where the configuration file modification script has modified the configuration file.
[0139] In some embodiments, the acquisition module 301 is further used to check whether the target software corresponding to the first version number has been installed or is being installed based on the log file; when the target software corresponding to the first version number has not been installed or is not being installed, obtain the installation package of the target software.
[0140] In the case of implementing the functions of the above-mentioned integrated modules in the form of hardware, the embodiment of the present invention provides another possible structural diagram of the software deployment device involved in the above-mentioned embodiment. Figure 6 As shown, the software deployment apparatus includes: a processor 402 , a communication interface 403 , and a bus 404 . Optionally, the software deployment apparatus may further include a memory 401 .
[0141] Processor 402 may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 402 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field-programmable gate array, or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. It may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 402 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, or a combination of a DSP and a microprocessor.
[0142] The communication interface 403 is used to connect to other devices via a communication network, such as Ethernet, wireless access network, wireless local area network (WLAN), etc.
[0143] The memory 401 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0144] As a possible implementation, memory 401 may exist independently of processor 402. Memory 401 may be connected to processor 402 via bus 404 to store instructions or program codes. When processor 402 calls and executes the instructions or program codes stored in memory 401, the communication method provided in the embodiment of the present invention can be implemented.
[0145] In another possible implementation, the memory 401 may also be integrated with the processor 402 .
[0146] The bus 404 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0147] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and brevity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional modules as needed, that is, the internal structure of the software deployment device can be divided into different functional modules to complete all or part of the functions described above.
[0148] The embodiment of the present application also provides a computer-readable storage medium. All or part of the processes in the above-mentioned method embodiment can be completed by computer instructions to the relevant hardware, and the program can be stored in the above-mentioned computer-readable storage medium. When the program is executed, it may include the processes of the above-mentioned method embodiments. The computer-readable storage medium can be the memory of any of the above-mentioned embodiments. The above-mentioned computer-readable storage medium can also be an external storage device of the above-mentioned software deployment device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the above-mentioned software deployment device. Furthermore, the above-mentioned computer-readable storage medium can also include both the internal storage unit of the above-mentioned software deployment device and an external storage device. The above-mentioned computer-readable storage medium is used to store the above-mentioned computer program and other programs and data required by the above-mentioned software deployment device. The above-mentioned computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.
[0149] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program product is run on a computer, the computer is enabled to execute any one of the software deployment methods provided in the above embodiments.
[0150] The above is only a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in the present application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A software deployment method, characterized in that: The method comprises: Obtaining an installation package of target software, wherein the installation package of the target software includes at least one configuration file modification script; Backing up the configuration file to obtain a backed-up configuration file; Modifying the configuration file in the deployment environment based on the at least one configuration file modification script to obtain a modified configuration file; Determining whether an edit distance between the modified configuration file and the backup configuration file is less than or equal to a first threshold; and / or, If the installation package of the target software also includes a baseline configuration file, determining whether an edit distance between the modified configuration file and the baseline configuration file is less than or equal to a second threshold; the edit distance reflects the difference between the files; and the baseline configuration file is a configuration file of an official version; If the reliability of the modified configuration file meets the requirement, installing the target software based on the modified configuration file and the installation package of the target software; If the reliability of the modified configuration file does not meet the requirement, determining where the configuration file is modified by the configuration file modification script based on the modified configuration file and the backup configuration file; Sending an alarm message, where the alarm message is used to indicate where the configuration file modification script modifies the configuration file.
2. The method according to claim 1, characterized in that Before modifying the configuration file in the deployment environment, the method further includes: After determining whether the reliability of the modified configuration file meets the requirements, the method further includes: If the reliability of the modified configuration file does not meet the requirement, a rollback operation is performed on the modified configuration file based on the backup configuration file.
3. The method according to any one of claims 1 to 2, characterized in that The target software installation package is used to install the target software corresponding to the first version number; Before obtaining the installation package of the target software, the method further includes: Based on the log file, checking whether the target software corresponding to the first version number has been installed or is being installed; The step of obtaining the target software installation package includes: When the target software corresponding to the first version number is not installed or is not being installed, an installation package of the target software is obtained.
4. A software deployment device, characterized in that: include: An acquisition module, configured to acquire an installation package of a target software, wherein the installation package of the target software includes at least one configuration file modification script; a processing module, configured to modify the configuration file in the deployment environment based on the at least one configuration file modification script to obtain a modified configuration file; The processing module is further configured to back up the configuration file to obtain a backed-up configuration file; a judgment module, specifically configured to judge whether an edit distance between the modified configuration file and the backup configuration file is less than or equal to a first threshold; and / or, In a case where the installation package of the target software further includes a baseline configuration file, determining whether an edit distance between the modified configuration file and the baseline configuration file is less than or equal to a second threshold; An installation module, configured to install the target software based on the modified configuration file and the installation package of the target software if the reliability of the modified configuration file meets the requirement; The processing module is further configured to determine, based on the modified configuration file and the backup configuration file, where the configuration file is modified by the configuration file modification script if the reliability of the modified configuration file does not meet the requirement; The device further comprises a notification module, which is used to send an alarm message, wherein the alarm message is used to indicate where the configuration file modification script modifies the configuration file.
5. The device according to claim 4, characterized in that The processing module is further configured to roll back the modified configuration file based on the backup configuration file if the reliability of the modified configuration file does not meet the requirement.
6. The device according to any one of claims 4 to 5, characterized in that The target software installation package is used to install the target software corresponding to the first version number; The acquisition module is further configured to check, based on the log file, whether the target software corresponding to the first version number has been installed or is being installed; and to obtain the installation package of the target software when the target software corresponding to the first version number has not been installed or is not being installed.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium includes computer-executable instructions. When the computer-executable instructions are executed on a computer, the computer executes the software deployment method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Software automatic deployment method and system
CN111399861A
Front-end framework updating method and device, equipment and storage medium
CN113254040A