YAML-based automated deployment method, system, electronic device, and storage medium

By using YAML configuration files and secure communication protocols in pure command line mode, automated deployment in GUI-free Linux environments is achieved, solving the problem that existing technology cannot be deployed in GUI-free environments, and improving the security and simplicity of deployment.

CN115811475BActive Publication Date: 2025-04-01SUZHOU TEKTRONIX NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211458400.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-16
Publication Date
2025-04-01
Estimated Expiration
2042-11-16

AI Technical Summary

Technical Problem

Existing automated deployment technologies often rely on graphical user interfaces, cannot be deployed in a GUI-free Linux environment, and require a client to be installed on the target server, increasing security risks.

Method used

Adopt an automated deployment method based on YAML, and obtain and parse configuration files through the main server in pure command line mode, connect to the target server, and transmit deployment service data to achieve service deployment. This method does not require additional software to be installed on the target server, has few dependencies, is easy to configure, and supports setting encryption parameters in the configuration file for improved security.

Benefits of technology

It realizes automated deployment in a GUI-free Linux environment, expands the scope of application, improves the security of the deployment process, and simplifies the configuration process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115811475B_ABST
    Figure CN115811475B_ABST
Patent Text Reader

Abstract

The present application provides a YAML-based automated deployment method, system, electronic device and storage medium, including starting the main server in pure command line mode, the main server obtains and parses the first configuration file to obtain the deployment server data; the main server connects to the target server based on the deployment server data and the secure communication protocol; after the main server detects the deployment command, it obtains and parses the second configuration file to obtain the deployment service data to transmit to the target server, the first configuration file and the second configuration file are files written based on the YAML specification; the target server obtains the deployment file and deploys the deployment file to the target server based on the deployment service data to realize the deployment of the target service. It realizes automated deployment of services in pure command line mode, with a wide range of applications; it has better service orchestration capabilities, and encryption parameters are set in the configuration file to improve security; it does not need to install other software on the server to be deployed, and the configuration is simple.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of operation and maintenance technology, and in particular to an automatic deployment method, system, electronic device and storage medium based on YAML. Background Art

[0002] With the development of the Internet economy, more and more services are being developed, and ultimately the services we develop need to be deployed on servers so that they can be run on any computer. Therefore, automated deployment technology has been valued in the field of operation and maintenance technology.

[0003] However, most of the existing deployment technologies for servers are based on web pages, which require accessing specific pages in a browser; if there is no graphical user interface (GUI) in the Linux environment, server deployment will not be possible. At the same time, existing deployment technologies usually require the installation of a client on the target server, which is cumbersome and may cause new security vulnerabilities to a certain extent.

[0004] Therefore, there is an urgent need for an automated deployment method with wider applicability and higher security to solve the above-mentioned technical problems of the prior art. Summary of the invention

[0005] In order to solve the deficiencies of the prior art, the main purpose of this application is to provide a YAML-based automated deployment method, system, electronic device and storage medium to solve the above-mentioned technical problems of the prior art.

[0006] In order to achieve the above objectives, the present application provides a YAML-based automated deployment method in the first aspect, the method comprising:

[0007] In pure command line mode, start the main server, and the main server obtains and parses the first configuration file to obtain the deployment server data, wherein the first configuration file is a file written based on the YAML specification and contains the deployment server data;

[0008] The main server is connected to the target server based on the deployment server data and the secure communication protocol;

[0009] After the main server detects the deployment command, it obtains and parses the second configuration file to obtain the deployment service data, and transmits the deployment service data to the target server, wherein the second configuration file is a file containing the deployment service data written based on the YAML specification;

[0010] The target server obtains the deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data to implement the deployment of the target service.

[0011] In some embodiments, the parsing process of the first configuration file and the second configuration file includes:

[0012] Querying a version declaration and determining a parsing grammar based on the version declaration;

[0013] Checking the syntax specifications of the first configuration file and the second configuration file based on the parsing grammar;

[0014] If it is detected that variables exist in the first configuration file and the second configuration file, the variable values ​​are replaced by using the variable application.

[0015] In some embodiments, the deployment file is stored in a file server, and obtaining the deployment file includes:

[0016] The file server verifies the legitimacy of the logged-in user based on the received download request from the target server and then issues a token to the target server;

[0017] When the target server sends a download request to the file server again, the file server verifies whether the token exists;

[0018] If the token exists, the verification is successful and the deployment file corresponding to the download request is returned to the target server.

[0019] In some embodiments, the method further includes maintaining security and confidentiality of parameters in the first configuration file and the second configuration file, and the security and confidentiality process includes:

[0020] The file server generates an encryption key based on a preset password and a randomly generated salt;

[0021] The file server encrypts the parameters of the first configuration file and the second configuration file based on an encryption key and a symmetric encryption algorithm;

[0022] After obtaining the encrypted first configuration file and the second configuration file, the main server uses the preset password and salt to restore the encryption key and decrypts the encrypted parameters according to the encryption key.

[0023] In some embodiments, before the target server obtains the deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data to implement the deployment of the target service, the method further includes:

[0024] The target server detects the running status of the original service according to the preset rules and process ID;

[0025] If the original service is in operation, the target server stops operating the original service;

[0026] The target server backs up the original service to a preset location so as to call the original service when the target service fails.

[0027] In some embodiments, the target server obtains a deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data, further comprising:

[0028] After the deployment file is deployed to the target server, the target server is started and the service version currently running on the target server is queried;

[0029] If the service version is consistent with the target service version, the deployment is successful;

[0030] If the service version is inconsistent with the target service version, the deployment fails and the failure information is printed for correction.

[0031] In some embodiments, the method further comprises:

[0032] The parsed first configuration file and second configuration file are converted into structures and stored in the main server.

[0033] In a second aspect, the present application provides a YAML-based automated deployment system, the system comprising:

[0034] A configuration module is used to start the main server in pure command line mode, and use the main server to obtain and parse a first configuration file to obtain deployment server data, wherein the first configuration file is a file containing deployment server data written based on the YAML specification;

[0035] The configuration module is further used to connect the main server with the target server using the main server based on the deployment server data and the secure communication protocol;

[0036] A deployment module, configured to detect a deployment command using the master server and, after detecting the deployment command, obtain and parse a second configuration file to obtain deployment service data, wherein the second configuration file is a file containing deployment service data written based on the YAML specification;

[0037] The deployment module is further configured to utilize the target server to obtain a deployment file corresponding to the target service and deploy the deployment file to the target server based on the received deployment service data to implement the deployment of the target service.

[0038] In a third aspect, the present application provides an electronic device, the electronic device comprising:

[0039] one or more processors;

[0040] and a memory associated with the one or more processors, the memory being used to store program instructions, the program instructions when read and executed by the one or more processors performing the following operations:

[0041] In pure command line mode, start the main server, and the main server obtains and parses the first configuration file to obtain the deployment server data, wherein the first configuration file is a file written based on the YAML specification and contains the deployment server data;

[0042] The main server is connected to the target server based on the deployment server data and the secure communication protocol;

[0043] After the main server detects the deployment command, it obtains and parses the second configuration file to obtain the deployment service data, and transmits the deployment service data to the target server, wherein the second configuration file is a file containing the deployment service data written based on the YAML specification;

[0044] The target server obtains the deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data to implement the deployment of the target service.

[0045] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program enables a computer to perform the following operations:

[0046] In pure command line mode, start the main server, and the main server obtains and parses the first configuration file to obtain the deployment server data, wherein the first configuration file is a file written based on the YAML specification and contains the deployment server data;

[0047] The main server is connected to the target server based on the deployment server data and the secure communication protocol;

[0048] After the main server detects the deployment command, it obtains and parses the second configuration file to obtain the deployment service data, and transmits the deployment service data to the target server, wherein the second configuration file is a file containing the deployment service data written based on the YAML specification;

[0049] The target server obtains the deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data to implement the deployment of the target service.

[0050] The beneficial effects achieved by this application are:

[0051] The present application provides an automated deployment method based on YAML, including starting a main server in pure command line mode, the main server obtaining and parsing a first configuration file to obtain deployment server data, wherein the first configuration file is a file containing deployment server data written based on the YAML specification; the main server connects to a target server based on the deployment server data and a secure communication protocol; after the main server detects the deployment command, it obtains and parses a second configuration file to obtain deployment service data, and transmits the deployment service data to the target server, wherein the second configuration file is a file containing deployment service data written based on the YAML specification; the target server obtains the deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data to realize the deployment of the target service. The automated deployment of services in pure command line mode is realized, and the scope of application is wide; in addition, the present application compiles configuration files based on the YAML specification, has better service orchestration capabilities, can define dependencies between services, and can further set encryption parameters in the configuration file to improve the security of the entire automated deployment process; and there is no need to install other software in the server to be deployed, with less dependence and simple configuration. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work, among which:

[0053] Figure 1 This is a first schematic diagram of the automated deployment method provided in an embodiment of the present application;

[0054] Figure 2 This is a second schematic diagram of the automated deployment method provided in an embodiment of the present application;

[0055] Figure 3 This is an architecture diagram of the automated deployment system provided in the embodiment of the present application;

[0056] Figure 4 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0058] It should be understood that in the description of the present application, unless the context clearly requires otherwise, words such as "include", "comprises", and the like in the entire specification and claims should be interpreted as inclusive rather than exclusive or exhaustive; that is, the meaning of "including but not limited to".

[0059] It should also be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.

[0060] It should be noted that the terms "S1", "S2", etc. are only used for the purpose of describing the steps, and do not specifically refer to the order or sequence, nor are they used to limit the present application. They are only for the convenience of describing the method of the present application, and cannot be understood as indicating the order of the steps. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present application.

[0061] According to the background technology, the traditional automated deployment method is usually based on a graphical user interface, which needs to be implemented by accessing a specific web page in a browser. Therefore, in a Linux environment without a graphical user interface, automated deployment cannot be performed. To solve the above technical problems, the present application provides an automated deployment method based on YAML, so as to automatically deploy the service to the corresponding target server without entering the web page interface.

[0062] Embodiment 1

[0063] The present application embodiment provides an automated deployment method; specifically, Figure 1 As shown, the process of implementing service automatic deployment by applying the method disclosed in this embodiment includes:

[0064] S10. Connect the main server and the target server to implement server configuration.

[0065] The connection process between the master server and the target server includes:

[0066] S11. In pure command line mode, start the main server, and the main server obtains and parses the first configuration file to obtain deployment server data.

[0067] After logging in to the main server, you can start the automatic deployment through the shell command; after the main server starts the automatic deployment, it reads the first configuration file corresponding to the target server, that is, the hosts.yml file, and parses the first configuration file. The main server is the main server for executing the automatic deployment, and the automatic deployment software needs to be used to implement the function of deploying the corresponding service in the target server; in addition, the above-mentioned first configuration file is a file written in accordance with the YAML (YAML A in 't Markup Language, another markup language) specification, which is used to describe the information of the server to be deployed. When compiling the first configuration file, it is necessary to specify the IP, port, user name and password of the server to be deployed. After the first configuration file is compiled, it is stored in the file server. The syntax of YAML is similar to other high-level languages, and it can simply express data forms such as lists, hash tables, and scalars; it uses blank symbols for indentation and a large number of features that rely on appearance, which is particularly suitable for expressing or editing data structures, various configuration files, dumping debugging content, and file outlines; and it has a sophisticated syntax that can represent relational model data. Because YAML uses blank characters and line breaks to separate data, it is particularly suitable for operations with grep / Python / Perl / Ruby.

[0068] Specifically, the main server analyzes the first configuration file including:

[0069] A1. According to the version declaration stored in the first line of the first configuration file, the corresponding parsing syntax is determined, such as version 1.6. Different versions correspond to different parsing syntaxes.

[0070] A2. After determining the parsing grammar, perform a grammar check on the first configuration file according to the corresponding parsing grammar.

[0071] A3. Check whether there are variables in the first configuration file. If there are variables, replace the variable reference with the variable value. For example, if the variable is defined as val:x=1 and the variable reference is 22${x}99, the value after replacing the variable reference with the variable value is 22199. If the variable is a system environment variable, read the environment variable. The environment variable name must be uppercase and start with TS_, such as TS_X. If it does not meet this specification, the variable is an illegal variable.

[0072] A4. Check whether there is parameter encryption. If there is parameter encryption, decrypt the parameters according to the pre-set symmetric encryption algorithm (PEB, PasswordBased Encryption) and encryption parameters.

[0073] Specifically, when the first configuration file is compiled, the file server generates an encryption key based on the password entered by the user (i.e., the preset password) and the randomly generated salt; the file server encrypts some parameters of the first configuration file based on the encryption key and the symmetric encryption algorithm. After receiving the first configuration file, the main server detects whether there are encryption parameters in the first configuration file. If so, the encryption key is restored based on the preset password and salt, and the encryption parameters are decrypted based on the restored encryption key. Among them, the salt can prevent dictionary attacks or pre-calculated attacks. It is a random information itself, and the same random information is extremely unlikely to be used twice; the salt is attached to the password, and the constructed encryption key is obtained through iterative calculation by the symmetric encryption algorithm. Preferably, in an embodiment of the present application, the salt can use the md5 value of a fixed string, such as md5 ("stringNoOneKnows"), to enhance security.

[0074] Preferably, if the judgment grammar is defined in the first configuration file, the main server will execute the corresponding process according to the judgment logic specified by the judgment grammar.

[0075] After parsing is completed, the parsing result (i.e., deployment server data) obtained by parsing the first configuration file is converted into a structure and stored in the memory of the main server for subsequent calls. If any of the above steps goes wrong, the automated deployment is stopped immediately, and an error message is printed in the command line. For example, if the parsing variable is wrong, the error message "Parsing variable x error: undefined variable x" is printed. It is worth noting that the above steps A1-A4 do not limit the order of implementation, but are only for illustration.

[0076] S12. The main server connects to the target server based on the parsed deployment server data and the secure communication protocol (SSH, SecureShell).

[0077] Specifically, if the server connected to is not the target server corresponding to the first configuration file (that is, the server configuration is incorrect) or cannot be connected, an error prompt is displayed, such as unable to connect to server 127.0.0.1 and incorrect username or password; if the target server is configured correctly, the command line will display a successful server connection, for example, server 127.0.0.1 is connected successfully.

[0078] S20. After the server configuration is successful, the main server, after detecting the deployment command, obtains and parses the second configuration file to obtain the deployment service data, and then transmits the deployment service data to the target server.

[0079] Specifically, after detecting the presence of a deployment command input, such as "tsdp deploy-fservices.yml", the main server downloads the second configuration file, namely services.yml, from the file server and parses the second configuration file to obtain the deployment service data. The second configuration file is a file written in accordance with the YAML specification, which is used to describe the information required to deploy the service on the server. During compilation, it is necessary to specify the deployment service data such as the service download address, service deployment location, and service startup command, and the compilation is completed and stored in the file server.

[0080] The parsing process of the second configuration file by the main server is the same as that of the first configuration file by the main server, so the same steps will not be repeated; the difference in parsing the second configuration file is that there will be some new syntax in the second configuration file, such as command (cmd) and dependency (depend); at this time, if the main server detects that there is a "command" in the second configuration file, the main server will execute the corresponding command in the target server, for example, CMD: cp. / nginx.conf / opt / nginx / , this command is to copy the nginx.conf document to the / opt / nginx / directory, then the main server will copy the nginx.conf document to the / opt / nginx / directory of the target server; if the main server detects that "dependency" is used in the second configuration file, it means that there is a dependency relationship between the services, so it is necessary to deploy the upstream service first, and then deploy the downstream service. For example, service B depends on service A. When deploying the service, server A must be deployed first, and service B must be deployed after service A is successfully started. In addition, preferably, if environment variables are used in the second configuration file, the main server needs to set the corresponding environment variables in the target server. The main server parses the second configuration file in the same process as the first configuration file. After the parsing is completed, the parsing result (i.e., the deployment server data) obtained by parsing the first configuration file is converted into a structure and stored in the memory of the main server for subsequent calls; if any step fails, the automated deployment is stopped immediately and an error prompt is printed in the command line.

[0081] S30: The target server downloads the deployment file corresponding to the target service from the file server, and deploys the target service on the target server based on the downloaded deployment file and the deployment service data.

[0082] The target server downloads the deployment file to the specific location specified in the deployment service data, and preferably sets the environment variable into the target server when there is an environment variable in the second configuration file. Start the new target server where the deployment file is deployed, and save the service process id; if the target service is successfully started, the target server will print the startup success information in the command line, that is, query the current version of the target service through the query version interface, for example: http: / / 0.0.0.1 / api / version, if the version obtained by the query is consistent with the version of the target service to be deployed, it means that the new service is deployed successfully; if the target service fails to start, it rolls back to the previous version of the target service (i.e., the original service). Preferably, the target service after startup can also be monitored. According to the service name specified by name web, the main server can find the target server deployed by the target service and the server connection information (i.e., query the parsing results stored in the main server memory), and then connect to the target server where the target service is located, and obtain the service process id according to the service name (saved when the server starts the service), and obtain the service status according to the service process id (such as using the command kill-0pid to judge the service status).

[0083] It is understandable that before deploying the target service to the target server, it is also necessary to detect whether the old version of the original service corresponding to the target service is running. Since the process id of the service will be recorded in the file when the service is started, the process id (PID, Process Identifier) ​​can be used to find out whether the original service is started. The command "kill-0pid" is used to determine whether the target service is running. Kill-0 will not send any signal to the process, but will perform an error check. If the process exists, it will return 0, and if it does not exist, it will return 1. Therefore, the process id of the original service can be queried according to the command and the original server can be determined according to the return value. Whether it is running; if there is no PID file, you can try to find the PID through the Linux command. If the original service is in operation, the target server stops the original service; if the original service has stopped, go directly to the subsequent steps. In addition, the target server backs up the original service file to a preset location (i.e., a backup folder) to achieve the aforementioned step in which the target service fails to start and rolls back to the previous version of the target service. Preferably, the original service file can be renamed, plus time, such as web-20221101.zip.

[0084] Preferably, when obtaining files from a file server, token authentication can be used to increase security. Specifically: the file server verifies the legitimacy of the user logging into the target server based on the received download request from the target server and then issues a token to the target server; when the target server sends a download request to the file server again, the file server verifies whether the token exists; if the token exists, the verification is successful and the deployment file corresponding to the download request is returned to the target server; if the token does not exist, it means that the target server does not have permission to download the file.

[0085] Compared with the traditional automated deployment method, this application does not need to be operated in the web interface, and can implement the deployment of services in pure command line mode, that is, it can be deployed in a Linux system without a GUI. In addition, this application compiles configuration files based on the YAML specification, has better service orchestration capabilities, can define dependencies between services, and can further set encryption parameters in the configuration files to improve the security of the entire automated deployment process; in addition, there is no need to install other software on the server to be deployed, with less dependencies and simple configuration.

[0086] Embodiment 2

[0087] Corresponding to the above-mentioned embodiment 1, the embodiment of the present application also provides an automated deployment method based on YAML, such as Figure 2 As shown, the details are as follows:

[0088] 2100. In pure command line mode, start the main server, and the main server obtains and parses a first configuration file to obtain deployment server data, wherein the first configuration file is a file written based on the YAML specification and contains the deployment server data;

[0089] 2200. The main server is connected to the target server based on the deployment server data and the secure communication protocol;

[0090] 2300. After detecting the deployment command, the primary server obtains and parses a second configuration file to obtain deployment service data, and transmits the deployment service data to the target server, wherein the second configuration file is a file containing the deployment service data and is written based on the YAML specification;

[0091] Preferably, the parsing process of the first configuration file and the second configuration file includes:

[0092] 2310. Query the version declaration and determine the parsing syntax according to the version declaration;

[0093] 2320. Checking syntax specifications of the first configuration file and the second configuration file based on the parsed syntax;

[0094] 2330. If it is detected that variables exist in the first configuration file and the second configuration file, the variable values ​​are replaced by using the variable application.

[0095] Preferably, the method further comprises maintaining security and confidentiality of parameters in the first configuration file and the second configuration file, and the security and confidentiality process comprises:

[0096] 2340. The file server generates an encryption key according to a preset password and a randomly generated salt;

[0097] 2350 The file server encrypts the parameters of the first configuration file and the second configuration file based on the encryption key and the symmetric encryption algorithm;

[0098] 2360. After obtaining the encrypted first configuration file and the second configuration file, the main server uses the preset password and salt to restore the encryption key and decrypts the encrypted parameters according to the encryption key.

[0099] Preferably, the method further comprises:

[0100] 2370. Convert the parsed first configuration file and second configuration file into structures and store them in the main server.

[0101] 2400. The target server obtains a deployment file corresponding to a target service and deploys the deployment file to the target server based on the received deployment service data to implement deployment of the target service.

[0102] Preferably, the deployment file is stored in a file server, and obtaining the deployment file includes:

[0103] 2410. The file server verifies the legitimacy of the logged-in user based on the received download request from the target server and then issues a token to the target server;

[0104] 2420. When the target server sends a download request to the file server again, the file server verifies whether the token exists.

[0105] 2430. If the token exists, the verification is successful and the deployment file corresponding to the download request is returned to the target server.

[0106] Preferably, before the target server obtains the deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data to implement the deployment of the target service, the method further includes:

[0107] 2440. The target server detects the running status of the original service according to the preset rules and process ID;

[0108] 2450. If the original service is in a running state, the target server stops running the original service;

[0109] 2460. The target server backs up the original service to a preset location so as to call the original service when the target service fails.

[0110] Preferably, the target server obtains the deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data, further comprising:

[0111] 2470. After the deployment file is deployed to the target server, the target server is started and the service version currently running on the target server is queried;

[0112] 2480. If the service version is consistent with the target service version, the deployment is successful;

[0113] 2490. If the service version is inconsistent with the target service version, the deployment fails and the failure information is printed for correction.

[0114] Embodiment 3

[0115] like Figure 3 As shown, corresponding to the above-mentioned embodiment 1 and embodiment 2, the embodiment of the present application provides a storage optimization system based on a network card, and the system includes:

[0116] The configuration module 310 is used to start the main server in pure command line mode, and use the main server to obtain and parse a first configuration file to obtain deployment server data, wherein the first configuration file is a file containing deployment server data written based on the YAML specification;

[0117] The configuration module 310 is further used to connect the main server with the target server based on the deployment server data and the secure communication protocol using the main server;

[0118] A deployment module 320 is used to detect a deployment command using the main server and, after detecting the deployment command, obtain and parse a second configuration file to obtain deployment service data, wherein the second configuration file is a file containing deployment service data written based on the YAML specification;

[0119] The deployment module 320 is further configured to use the target server to obtain a deployment file corresponding to the target service and deploy the deployment file to the target server based on the received deployment service data to implement the deployment of the target service.

[0120] In some embodiments, the configuration module 310 is also used to parse the first configuration file and the second configuration file using the main server: query the version declaration and determine the parsing syntax based on the version declaration; check the syntax specifications of the first configuration file and the second configuration file based on the parsing syntax; if variables are detected in the first configuration file and the second configuration file, use the variables to replace the variable values.

[0121] In some embodiments, the deployment file is stored in a file server, and the deployment module 320 is also used to obtain the deployment file: after the file server receives the download request from the target server, the file server is controlled to verify the legitimacy of the logged-in user and then issue a token to the target server; when the target server sends a download request to the file server again, the file server is controlled to verify whether the token exists; if the token exists, the verification is successful and the deployment file corresponding to the download request is returned to the target server.

[0122] In some embodiments, the configuration module 310 is also used to ensure the security and confidentiality of the parameters in the first configuration file and the second configuration file, and the security and confidentiality process includes: using the file server to generate an encryption key according to a preset password and a randomly generated salt; the file server encrypts the parameters of the first configuration file and the second configuration file based on the encryption key and a symmetric encryption algorithm; after the main server obtains the encrypted first configuration file and the second configuration file, it uses the preset password and salt to restore the encryption key and decrypts the encrypted parameters according to the encryption key.

[0123] In some embodiments, the deployment module 320 is also used to use the target server to detect the running status of the original service according to preset rules and process ID; if the original service is in a running state, control the target server to stop running the original service; and use the target server to back up the original service to a preset location so that the original service can be called when the target service fails.

[0124] In some embodiments, the deployment module 320 is also used to start the target server and query the service version currently running on the target server after deploying the deployment file to the target server; detect whether the service version is consistent with the target service version; if the service version is consistent with the target service version, the deployment is successful; if the service version is inconsistent with the target service version, the deployment fails and prints the failure information for correction.

[0125] In some embodiments, the configuration module 310 is further used to convert the parsed first configuration file and second configuration file into a structure and store the structure in the main server.

[0126] Embodiment 4

[0127] Corresponding to all the above embodiments, an embodiment of the present application provides an electronic device, including:

[0128] One or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions, the program instructions when read and executed by the one or more processors, performing the following operations:

[0129] In pure command line mode, start the main server, and the main server obtains and parses the first configuration file to obtain the deployment server data, wherein the first configuration file is a file written based on the YAML specification and contains the deployment server data;

[0130] The main server is connected to the target server based on the deployment server data and the secure communication protocol;

[0131] After the main server detects the deployment command, it obtains and parses the second configuration file to obtain the deployment service data, and transmits the deployment service data to the target server, wherein the second configuration file is a file containing the deployment service data written based on the YAML specification;

[0132] The target server obtains the deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data to implement the deployment of the target service.

[0133] in, Figure 4 The architecture of the electronic device is exemplarily shown, which may include a processor 410, a video display adapter 411, a disk drive 412, an input / output interface 413, a network interface 414, and a memory 420. The processor 410, the video display adapter 411, the disk drive 412, the input / output interface 413, the network interface 414, and the memory 420 may be communicatively connected via a bus 430.

[0134] Among them, the processor 410 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solution provided in this application.

[0135] The memory 420 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage devices, dynamic storage devices, etc. The memory 420 can store an operating system 421 for controlling the execution of the electronic device 400, and a basic input and output system (BIOS) 422 for controlling the low-level operations of the electronic device 400. In addition, a web browser 423, a data storage management system 424, and an icon font processing system 425, etc. can also be stored. The above-mentioned icon font processing system 425 can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present application. In short, when the technical solution provided in the present application is implemented by software or firmware, the relevant program code is stored in the memory 420 and is called and executed by the processor 410.

[0136] The input / output interface 413 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0137] The network interface 414 is used to connect to a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).

[0138] The bus 430 comprises a pathway for transmitting information between the various components of the device (eg, the processor 410, the video display adapter 411, the disk drive 412, the input / output interface 413, the network interface 414, and the memory 420).

[0139] In addition, the electronic device 400 can also obtain information on specific collection conditions from the virtual resource object collection condition information database for use in condition judgment, etc.

[0140] It should be noted that, although the above device only shows a processor 410, a video display adapter 411, a disk drive 412, an input / output interface 413, a network interface 414, a memory 420, a bus 430, etc., in the specific implementation process, the device may also include other components necessary for normal execution. In addition, it can be understood by those skilled in the art that the above device may also only include components necessary for implementing the solution of the present application, and does not necessarily include all the components shown in the figure.

[0141] Embodiment 5

[0142] Corresponding to all the above embodiments, the embodiments of the present application further provide a computer-readable storage medium, characterized in that it stores a computer program, and the computer program enables the computer to operate as follows:

[0143] In pure command line mode, start the main server, and the main server obtains and parses the first configuration file to obtain the deployment server data, wherein the first configuration file is a file written based on the YAML specification and contains the deployment server data;

[0144] The main server is connected to the target server based on the deployment server data and the secure communication protocol;

[0145] After the main server detects the deployment command, it obtains and parses the second configuration file to obtain the deployment service data, and transmits the deployment service data to the target server, wherein the second configuration file is a file containing the deployment service data written based on the YAML specification;

[0146] The target server obtains the deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data to implement the deployment of the target service.

[0147] It can be seen from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., including several instructions for enabling a computer device (which can be a personal computer, a cloud service end, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.

[0148] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.

[0149] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. The YAML-based automated deployment method is characterized by: The method comprises: In pure command line mode, start the main server, and the main server obtains and parses the first configuration file to obtain the deployment server data, wherein the first configuration file is a file written based on the YAML specification and contains the deployment server data; The main server is connected to the target server based on the deployment server data and the secure communication protocol; After the main server detects the deployment command, it obtains and parses the second configuration file to obtain the deployment service data, and transmits the deployment service data to the target server, wherein the second configuration file is a file containing the deployment service data written based on the YAML specification; The target server obtains the deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data to implement the deployment of the target service; The deployment file is stored in a file server, and obtaining the deployment file includes: The file server verifies the legitimacy of the logged-in user based on the received download request from the target server and then issues a token to the target server; When the target server sends a download request to the file server again, the file server verifies whether the token exists; If the token exists, the verification is successful and the deployment file corresponding to the download request is returned to the target server.

2. The method according to claim 1, characterized in that The parsing process of the first configuration file and the second configuration file includes: Querying a version declaration and determining a parsing grammar based on the version declaration; Checking the syntax specifications of the first configuration file and the second configuration file based on the parsing grammar; If it is detected that variables exist in the first configuration file and the second configuration file, the variable values ​​are replaced by using the variable application.

3. The method according to claim 1, characterized in that The method further includes maintaining security and confidentiality of parameters in the first configuration file and the second configuration file, wherein the security and confidentiality process includes: The file server generates an encryption key based on a preset password and a randomly generated salt; The file server encrypts the parameters of the first configuration file and the second configuration file based on an encryption key and a symmetric encryption algorithm; After obtaining the encrypted first configuration file and the second configuration file, the main server uses the preset password and salt to restore the encryption key and decrypts the encrypted parameters according to the encryption key.

4. The method according to any one of claims 1 to 3, characterized in that: Before the target server obtains the deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data to implement the deployment of the target service, the method further includes: The target server detects the running status of the original service according to the preset rules and process ID; If the original service is in operation, the target server stops operating the original service; The target server backs up the original service to a preset location so as to call the original service when the target service fails.

5. The method according to claim 4, characterized in that The target server obtains the deployment file corresponding to the target service and deploys the deployment file to the target server based on the received deployment service data, further comprising: After the deployment file is deployed to the target server, the target server is started and the service version currently running on the target server is queried; If the service version is consistent with the target service version, the deployment is successful; If the service version is inconsistent with the target service version, the deployment fails and the failure information is printed for correction.

6. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: The parsed first configuration file and second configuration file are converted into structures and stored in the main server.

7. An automated deployment system, characterized in that: The system comprises: A configuration module is used to start the main server in pure command line mode, and use the main server to obtain and parse a first configuration file to obtain deployment server data, wherein the first configuration file is a file containing deployment server data written based on the YAML specification; The configuration module is further used to connect the main server with the target server using the main server based on the deployment server data and the secure communication protocol; A deployment module, configured to detect a deployment command using the master server and, after detecting the deployment command, obtain and parse a second configuration file to obtain deployment service data, wherein the second configuration file is a file containing deployment service data written based on the YAML specification; The deployment module is further used to use the target server to obtain a deployment file corresponding to the target service and deploy the deployment file to the target server based on the received deployment service data to implement the deployment of the target service; The deployment file is stored in a file server, and the deployment module is also used to obtain the deployment file: after the file server receives a download request from the target server, the file server is controlled to verify the legitimacy of the logged-in user and then issue a token to the target server; when the target server sends a download request to the file server again, the file server is controlled to verify whether the token exists; if the token exists, the verification is successful and the deployment file corresponding to the download request is returned to the target server.

8. An electronic device, characterized in that: The electronic device comprises: one or more processors; And a memory associated with the one or more processors, the memory is used to store program instructions, and when the program instructions are read and executed by the one or more processors, the method according to any one of claims 1-6 is executed.

9. A computer-readable storage medium, characterized in that: The computer program stores a computer program, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Automatic version deployment method and device, computer equipment and storage medium

    CN110275872A