Microservice publishing method, device, system and computer-readable storage medium
Through the microservice release method that works collaboratively with the management end and the client, the problems of high resource consumption and complex operations in the microservice release method are solved, and unified management and one-click release for different customers are realized, reducing the possibility of errors and improving the possibility of errors. efficiency and safety.
Patent Information
- Application Number
- CN202211091371.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-07
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2042-09-07
AI Technical Summary
The existing microservice release method leads to inefficiency in the case of high resource consumption, complex operations and unintuitive version management. Especially when small projects are incubated from large projects, the communication costs of development and operation and maintenance personnel increase, and errors may be Increased sex.
Provide a microservice publishing method, through the collaborative work of the management end and the client, unified management of service releases of different customers, realizing one-click release, reducing resource consumption and simplifying operations. The management side generates microservice issuance instructions, sends file storage information to the client, the client performs permission verification and service release operations, and the management side detects abnormal periodic heartbeat.
It realizes unified service management for different customers, reduces resource consumption and operation complexity, improves the convenience and security of microservice release, and simplifies version management and rollback operations.
Smart Images

Figure CN115955506B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of microservice technology, and in particular to a microservice publishing method, device, system and computer-readable storage medium. Background Art
[0002] The microservice architecture is split according to business functions, and the same business functions are placed in a microservice project, which reduces the coupling of services and facilitates development and maintenance by developers. There are usually two ways to publish microservices: one is to manually upload locally generated microservice files to the server and start and stop microservices through the command line; the other is to consume additional resources to deploy a set of service publishing tools, based on the code repository branch, pull the latest code, and execute a series of service publishing intermediate processes, such as code specifications, code vulnerability scanning, unit testing, etc., and then execute the compilation and packaging command to obtain the target file, and then execute the corresponding service startup command, back up the target file, etc., and finally complete the service release.
[0003] However, since many small projects may be based on the partial functions of a larger project and deploy a set of services separately, it may be in a cloud environment or on a client company server. Server resources are often limited and only enough to deploy application services, and the code repository is on an intranet server. At this time, the release of services is often done by dedicated developers or operation and maintenance personnel through command line execution commands. The service version is not convenient to view, and the version rollback operation is not intuitive and prone to misoperation. In addition, some small projects hatched from large projects often have few developers. If the deployers and developers are separated, the number of links for each release of a version will increase, the communication cost will increase, and the efficiency will be reduced. In addition, if developers are allowed to operate completely by themselves, higher requirements will be placed on developers, and permissions will be difficult to control, and the possibility of errors will increase. Therefore, the existing microservice release method has problems such as high resource consumption and complex operation. Summary of the invention
[0004] The purpose of this application is to provide a microservice publishing method, device, system and computer-readable storage medium, which can uniformly manage the service publishing to different customers and realize one-click publishing of microservices, thereby reducing resource consumption and making the operation simple and convenient.
[0005] To achieve the above objectives:
[0006] In a first aspect, an embodiment of the present application provides a microservice publishing method, which is applied to a microservice publishing system, wherein the microservice publishing system includes a management end and at least one client, and the method includes the following steps:
[0007] The management end sends a microservice publishing request to a client corresponding to the target customer in response to a microservice publishing instruction generated on the management interface for the target customer, wherein the microservice publishing request includes file storage information of the target microservice to be published;
[0008] After receiving the microservice publishing request, the client obtains the target microservice file according to the file storage information of the target microservice, and performs a service publishing operation based on the target microservice file.
[0009] Optionally, before the management terminal responds to the microservice publishing instruction for the target customer generated on the management interface, the management terminal further includes:
[0010] The management terminal obtains user login information, and displays service operation items that the user has operation authority for on the management interface according to the user login information.
[0011] Optionally, before the client receives the microservice publishing request, the process further includes:
[0012] The client receives the target microservice file sent by the management end, and performs permission verification based on the key pair pre-issued by the management end. If the verification is successful, the target microservice file is stored, and the file storage information of the target microservice file is sent to the management end;
[0013] The management end receives and records the file storage information of the target microservice file.
[0014] Optionally, the method further comprises:
[0015] The client performs pre-operations and / or post-operations for service release for the target microservice; the pre-operations include at least one of the following: backing up the current microservice file corresponding to the target microservice, stopping the target microservice, and clearing cached data; the post-operations include at least one of the following: outputting a service release reminder message; refreshing cached data.
[0016] Optionally, the method further comprises:
[0017] The management end periodically sends heartbeat packets to the client, and performs abnormality detection on the client according to the heartbeat packet reception status.
[0018] In a second aspect, an embodiment of the present application provides a microservice publishing method, which is applied to a management end, and the method includes:
[0019] Responding to a microservice publishing instruction for a target customer generated in a management interface;
[0020] A microservice publishing request is sent to a client corresponding to the target customer, wherein the microservice publishing request includes file storage information of the target microservice to be published.
[0021] Optionally, the method further includes: acquiring user login information, and displaying service operation items for which the user has operation authority on the management interface according to the user login information.
[0022] Optionally, the method further comprises:
[0023] Sending the target microservice file to the client;
[0024] Receive and record the file storage information of the target microservice file sent by the client.
[0025] Optionally, the method further comprises:
[0026] Heartbeat packets are periodically sent to the client, and abnormality detection is performed on the client according to the reception status of the heartbeat response packets.
[0027] In a third aspect, an embodiment of the present application provides a microservice publishing method, which is applied to a client, and the method includes:
[0028] Receive a microservice publishing request sent by a management end; the microservice publishing request includes file storage information of a target microservice to be published;
[0029] The target microservice file is acquired according to the file storage information of the target microservice, and a service publishing operation is performed based on the target microservice file.
[0030] Optionally, the method further comprises:
[0031] The target microservice file sent by the management end is received, and permission verification is performed based on the key pair pre-issued by the management end. If the verification passes, the target microservice file is stored, and the file storage information of the target microservice file is sent to the management end.
[0032] Optionally, the method further comprises:
[0033] Execute pre-operations and / or post-operations for service release for the target microservice; the pre-operations include at least one of the following: backing up the current microservice file corresponding to the target microservice, stopping the target microservice, and clearing cached data; the post-operations include at least one of the following: outputting a service release reminder message; refreshing cached data.
[0034] In a fourth aspect, an embodiment of the present application provides a microservice publishing system, comprising a management end and at least one client; wherein the management end and the client are respectively used to execute the corresponding microservice publishing method described in any one of the second aspect and the third aspect.
[0035] In a fifth aspect, an embodiment of the present application provides a microservice publishing device, comprising: a processor and a memory storing a computer program, and when the processor runs the computer program, the steps of the above-mentioned microservice publishing method are implemented.
[0036] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned microservice publishing method are implemented.
[0037] The microservice publishing method, device, system and computer-readable storage medium provided in the embodiments of the present application are applied to a microservice publishing system, wherein the microservice publishing system includes a management end and at least one client; the management end responds to a microservice publishing instruction for a target customer generated in a management interface, and sends a microservice publishing request to a client corresponding to the target customer, wherein the microservice publishing request includes file storage information of the target microservice to be published; after receiving the microservice publishing request, the client obtains the target microservice file according to the file storage information of the target microservice, and performs a service publishing operation based on the target microservice file. In this way, the service publishing for different customers can be uniformly managed, and one-click publishing of microservices can be realized, which reduces resource consumption and is simple and convenient to operate. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 Schematic diagram of the process of microservice publishing method provided in the embodiment of the present invention Figure 1 ;
[0039] Figure 2 Schematic diagram of the process of microservice publishing method provided in the embodiment of the present invention Figure 2 ;
[0040] Figure 3 Schematic diagram of the process of microservice publishing method provided in the embodiment of the present invention Figure 3 ;
[0041] Figure 4 A schematic diagram of the architecture of a microservice publishing system provided in an embodiment of the present invention;
[0042] Figure 5 A schematic diagram of a user authority system in an embodiment of the present invention;
[0043] Figure 6A schematic diagram of the structure of a microservice publishing device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0045] It should be noted that, in this article, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element. In addition, components, features, and elements with the same name in different embodiments of the present application may have the same meaning or different meanings, and their specific meanings need to be determined by their explanation in the specific embodiment or further combined with the context of the specific embodiment.
[0046] It should be understood that, although the terms first, second, third, etc. may be used to describe various information in this article, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this article, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein can be interpreted as "at the time of..." or "when..." or "in response to determination". Furthermore, as used in this article, the singular forms "one", "one" and "the" are intended to also include plural forms, unless there is an opposite indication in the context. It should be further understood that the terms "comprising", "including" indicate that there are described features, steps, operations, elements, components, projects, kinds, and / or groups, but do not exclude the existence, occurrence or addition of one or more other features, steps, operations, elements, components, projects, kinds, and / or groups. The terms "or" and "and / or" used herein are interpreted as inclusive, or mean any one or any combination. Thus, “A, B, or C” or “A, B and / or C” means “any of the following: A; B; C; A and B; A and C; B and C; A, B, and C.” An exception to this definition will occur only when a combination of elements, functions, steps, or operations are inherently mutually exclusive in some manner.
[0047] It should be understood that, although the various steps in the flowchart in the embodiment of the present application are displayed in sequence according to the indication of the arrows, these steps are not necessarily performed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and it can be performed in other orders. Moreover, at least a portion of the steps in the figure may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and their execution order is not necessarily performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0048] It should be noted that, in this article, step codes such as S101, S102, etc. are used for the purpose of expressing the corresponding content more clearly and concisely, and do not constitute a substantial limitation on the sequence. When implementing the step, those skilled in the art may execute S102 first and then S101, etc., but these should all be within the scope of protection of this application.
[0049] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0051] See also Figure 1 , a microservice publishing method provided in an embodiment of the present application is applied to a microservice publishing system, wherein the microservice publishing system includes a management end and at least one client; the microservice publishing method provided in an embodiment of the present application includes:
[0052] Step S101: In response to a microservice publishing instruction for a target customer generated in a management interface, the management end sends a microservice publishing request to a client corresponding to the target customer, wherein the microservice publishing request includes file storage information of the target microservice to be published.
[0053] Optionally, the management end may be a computer or other intelligent terminal used by management personnel or technical personnel, and the management end may provide and display a management interface, through which the microservices corresponding to different customers can be managed, such as publishing microservices, deleting microservices, etc. The client may be a computer or other intelligent terminal on the client side. It can be understood that based on the needs of different customers, small projects hatched from large projects can be deployed to corresponding customers in the form of microservices, and at the same time, corresponding menus can be displayed in the management interface for the number of projects and microservices deployed to the customer. For example, if customer A has two projects and each project has two microservices, customer A information can be displayed in the customer menu, and the above two microservices can be displayed in the project menu of customer A. It should be noted that the management interface may provide an operation menu for different microservices for different customers, and the operation menu may include service operation items such as publishing (or modifying) and deleting. When the user enters an operation in the management interface to select a microservice for the target customer to be published, the management end obtains the microservice publishing instruction for the target customer generated in the management interface, and sends a microservice publishing request to the client corresponding to the target customer, and the microservice publishing request includes the file storage information of the target microservice to be published. Optionally, the target customer is the customer to which the microservice to be released belongs, and the management end can determine the registration address of the client corresponding to the target customer based on the identification information such as the name of the target customer and the registration address of each client on the management end, and then send a microservice release request to the client corresponding to the target customer. It should be noted that the microservice release in this embodiment can also be called service release.
[0054] In one embodiment, before the management terminal responds to the microservice publishing instruction for the target customer generated in the management interface, it also includes: the management terminal obtains the user login information, and displays the service operation items that the user has the operation authority on the management interface according to the user login information. It can be understood that different operation permissions can be set for different users, and the operation permissions can be classified according to customers, projects, services, and operations. If customer permissions are assigned, all services and all operations under the customer have permissions. For example, some users can only manage all services under customer A, while other users can only manage all services under customer B, or some users can only manage project C of customer A, while other users can only manage project D of customer A; or some users can only view microservices, while other users can only publish microservices. Optionally, after obtaining the user login information, the management terminal can determine the user's operation permissions according to the user login information, and then display the service operation items that the user has the operation authority on the management interface. For example, assuming that it is determined that the user only has the operation authority for customer A according to the user login information, only the service operation items for customer A, such as publishing, deleting, etc., can be displayed on the management interface. In this way, the service operation items displayed on the management interface are determined according to the user's operation authority, which improves the security of management and further reduces resource consumption.
[0055] In one embodiment, before the client receives the microservice publishing request, the method further includes:
[0056] The client receives the target microservice file sent by the management end, and performs permission verification based on the key pair pre-issued by the management end. If the verification is successful, the target microservice file is stored, and the file storage information of the target microservice file is sent to the management end;
[0057] The management end records the file storage information of the target microservice file.
[0058] Optionally, after determining the file corresponding to the target microservice to be released, i.e., the target microservice file, the management end may first send the target microservice file to the client corresponding to the target client. Correspondingly, the client receives the target microservice file sent by the management end, and performs permission verification based on the key pair pre-issued by the management end. If the verification is successful, the target microservice file is stored, and the file storage information of the target microservice file is sent to the management end. Optionally, the target microservice file is sent after being encrypted by the management end. The client uses the key pair to perform permission verification on the target microservice file. If the verification is successful, the target microservice file is decrypted, and the target microservice file is stored according to the project, service name, receiving time, and remarks to which the target microservice belongs. The key pair is issued to the client by the management end according to preset rules when the client registers with the management end. Optionally, the client may store the target microservice file on a local disk, or may store the target microservice file on an object storage server such as an NFS file server, AWS server, etc. That is to say, the storage address and storage method of the target microservice file may be set according to actual conditions. At the same time, the file storage information may include but is not limited to the project to which the target microservice belongs, the service name, the receiving time, the remarks, the storage address, the storage method, etc. After the management end receives the file storage information of the target microservice file sent by the client, it records the file storage information of the target microservice file, so as to inform the client of the file storage information when the target microservice needs to be released later, and realize the unified information management by the management end. In this way, after the authority verification is passed, the client stores the target microservice file and uploads the corresponding file storage information to the management end, which improves the security of microservice release and the convenience of information management.
[0059] Step S102: After receiving the microservice publishing request, the client obtains the target microservice file according to the file storage information of the target microservice, and performs a service publishing operation based on the target microservice file.
[0060] Optionally, after receiving the microservice publishing request sent by the management end, the client can obtain the target microservice file according to the file storage information of the target microservice in the microservice publishing request, and perform a service publishing operation based on the target microservice file, thereby publishing the target microservice.
[0061] In summary, in the microservice publishing method provided in the above embodiment, different customers can be managed in a unified manner through the management end. Each customer side only needs to deploy microservices to achieve the management service publishing effect, which greatly reduces resource costs. It can uniformly manage service publishing for different customers and realize one-click publishing of microservices, which reduces resource consumption and is simple and convenient to operate.
[0062] In one embodiment, the method further comprises:
[0063] The client performs pre-operations and / or post-operations for service release for the target microservice; the pre-operations include at least one of the following: backing up the current microservice file corresponding to the target microservice, stopping the target microservice, and clearing cached data; the post-operations include at least one of the following: outputting a service release reminder message; refreshing cached data.
[0064] Optionally, before executing the service publishing operation based on the target microservice file, the client may perform pre-operations for service publishing for the target microservice, such as backing up the current microservice file corresponding to the target microservice, stopping the target microservice, clearing cached data, etc. After executing the service publishing operation based on the target microservice file, the client may perform post-operations for service publishing for the target microservice, such as outputting a service publishing reminder message; refreshing cached data, etc. Optionally, the backing up of the current microservice file corresponding to the target microservice is to ensure that the historical service version can be rolled back later, that is, after the management end executes the service publishing operation based on the target microservice file, if the current microservice file corresponding to the target microservice needs to be reused for service publishing later, the corresponding operation can be implemented through the backed-up current microservice file corresponding to the target microservice. In this way, by performing pre-operations and / or post-operations for service publishing for the target microservice, the convenience of microservice publishing is improved.
[0065] In one embodiment, the method further comprises:
[0066] The management end periodically sends heartbeat packets to the client, and performs abnormality detection on the client according to the heartbeat packet reception status.
[0067] Optionally, in order to maintain a list of healthy clients and to provide early warning when an abnormality occurs, the management end may periodically send a heartbeat packet to the client based on the registered address of the client, and perform abnormality detection on the client according to the heartbeat packet reception situation. Optionally, the heartbeat packet reception situation may include whether a heartbeat response packet fed back by the client is received, and whether the interval duration of the heartbeat response packet fed back by the client meets the preset duration requirement. Optionally, when an abnormality is detected in the client, an alarm message may be output to notify the user to handle it in time. In this way, the convenience and timeliness of managing microservices for different clients are improved.
[0068] See also Figure 2 , is a microservice publishing method provided in an embodiment of the present application. The microservice publishing method can be executed by a microservice publishing device provided in an embodiment of the present application. The microservice publishing device can be implemented in software and / or hardware. In this embodiment, the microservice publishing device is used as a management end as an example. The microservice publishing method provided in this embodiment includes:
[0069] Step S201: responding to a microservice publishing instruction for a target customer generated in a management interface.
[0070] Optionally, the management end may be a computer or other intelligent terminal used by management personnel or technical personnel. The management end may provide and display a management interface, through which the microservices corresponding to different customers can be managed, such as publishing microservices, deleting microservices, etc. Based on the needs of different customers, small projects hatched from large projects can be deployed to corresponding customers in the form of microservices. At the same time, corresponding menus can be displayed in the management interface for the number of projects and microservices deployed to the customer. For example, if customer A has two projects and each project has two microservices, customer A information can be displayed in the customer menu, and the above two microservices can be displayed in the project menu of customer A. It should be noted that the management interface may provide an operation menu for different microservices for different customers, and the operation menu may include service operation items such as publishing (also modification) and deleting. When the user enters an operation in the management interface to select a microservice for the target customer to be published, the management end obtains the microservice publishing instruction for the target customer generated in the management interface.
[0071] In one embodiment, the method further includes: obtaining user login information, and displaying service operation items for which the user has operation authority on the management interface according to the user login information. It can be understood that different operation authorities can be set for different users, and the operation authority can be classified according to customers, projects, services, and operations. If customer authority is assigned, all services and all operations under the customer are authorized. For example, some users can only manage all services under customer A, while other users can only manage all services under customer B, or some users can only manage project C of customer A, while other users can only manage project D of customer A; or some users can only view microservices, while other users can only publish microservices. Optionally, after obtaining the user login information, the management end can determine the user's operation authority according to the user login information, and then display the service operation items for which the user has operation authority on the management interface. For example, assuming that it is determined according to the user login information that the user only has operation authority for customer A, only service operation items for customer A, such as publishing, deleting, and other operation items, can be displayed on the management interface. In this way, the service operation items displayed on the management interface are determined according to the user's operation authority, which improves the security of management and further reduces resource consumption.
[0072] In one embodiment, the method further comprises:
[0073] Sending the target microservice file to the client;
[0074] Receive and record the file storage information of the target microservice file sent by the client.
[0075] Optionally, after determining the file corresponding to the target microservice to be released, i.e., the target microservice file, the management end may first send the target microservice file to the client corresponding to the target client. After receiving the file storage information of the target microservice file sent by the client, the management end records the file storage information of the target microservice file, so as to inform the client of the file storage information when the target microservice needs to be released later, and realize the unified information management by the management end. The file storage information may include but is not limited to the project to which the target microservice belongs, the service name, the receiving time, the remarks, the storage address, the storage method, etc. In this way, the convenience of information management is improved.
[0076] Step S202: Send a microservice publishing request to a client corresponding to the target customer, wherein the microservice publishing request includes file storage information of the target microservice to be published.
[0077] Optionally, the management end sends a microservice publishing request to the client corresponding to the target customer, and the microservice publishing request includes file storage information of the target microservice to be published. Optionally, the target customer is the customer to which the microservice to be published belongs, and the management end can determine the registration address of the client corresponding to the target customer based on the identification information such as the name of the target customer and the registration address of each client on the management end, and then send the microservice publishing request to the client corresponding to the target customer.
[0078] In summary, in the microservice publishing method provided in the above embodiment, different customers can be managed in a unified manner through the management end. Each customer side only needs to deploy microservices to achieve the management service publishing effect, which greatly reduces resource costs. It can uniformly manage service publishing for different customers and realize one-click publishing of microservices, which reduces resource consumption and is simple and convenient to operate.
[0079] In one embodiment, the method further comprises:
[0080] A heartbeat packet is periodically sent to the client, and an abnormality detection is performed on the client according to the reception status of the heartbeat packet.
[0081] Optionally, in order to maintain a list of healthy clients and to provide early warning when an abnormality occurs, the management end may periodically send a heartbeat packet to the client based on the client's registered address, and perform abnormality detection on the client based on the heartbeat packet reception situation. Optionally, the heartbeat packet reception situation may include whether a heartbeat response packet is received, and whether the interval duration of the received heartbeat response packet meets the preset duration requirement. Optionally, when an abnormality is detected in the client, an alarm message may be output to promptly notify the user to handle it. In this way, the convenience and timeliness of managing microservices for different clients are improved.
[0082] See also Figure 3 , is a microservice publishing method provided in an embodiment of the present application. The microservice publishing method can be executed by a microservice publishing device provided in an embodiment of the present application. The microservice publishing device can be implemented in software and / or hardware. In this embodiment, the microservice publishing device is taken as a client as an example. The microservice publishing method provided in this embodiment includes:
[0083] Step S301: receiving a microservice publishing request sent by a management end; the microservice publishing request includes file storage information of a target microservice to be published.
[0084] Optionally, the client may be a computer or other intelligent terminal on the client side.
[0085] In one embodiment, the method further comprises:
[0086] The target microservice file sent by the management end is received, and permission verification is performed based on the key pair pre-issued by the management end. If the verification passes, the target microservice file is stored, and the file storage information of the target microservice file is sent to the management end.
[0087] Optionally, after determining the file corresponding to the target microservice to be released, i.e., the target microservice file, the management end may first send the target microservice file to the client corresponding to the target client. Correspondingly, the client receives the target microservice file sent by the management end, and performs permission verification based on the key pair pre-issued by the management end. If the verification is successful, the target microservice file is stored, and the file storage information of the target microservice file is sent to the management end. Optionally, the target microservice file is sent after being encrypted by the management end. The client uses the key pair to perform permission verification on the target microservice file. If the verification is successful, the target microservice file is decrypted, and the target microservice file is stored according to the project, service name, receiving time, and remarks to which the target microservice belongs. The key pair is issued to the client by the management end according to preset rules when the client registers with the management end. Optionally, the client can store the target microservice file on a local disk, or store the target microservice file on an object storage server such as an NFS file server or an AWS server. In other words, the storage address and storage method of the target microservice file can be set according to actual conditions. At the same time, the file storage information may include but is not limited to the project to which the target microservice belongs, the service name, the receiving time, the remarks, the storage address, the storage method, etc. In this way, after the authority verification is passed, the client stores the target microservice file and uploads the corresponding file storage information to the management end, which improves the security of microservice publishing and the convenience of information management.
[0088] Step S302: acquiring a target microservice file according to the file storage information of the target microservice, and performing a service publishing operation based on the target microservice file.
[0089] Optionally, after receiving the microservice publishing request sent by the management end, the client can obtain the target microservice file according to the file storage information of the target microservice in the microservice publishing request, and perform a service publishing operation based on the target microservice file, thereby publishing the target microservice.
[0090] In summary, in the microservice publishing method provided in the above embodiment, different customers can be managed in a unified manner through the management end. Each customer side only needs to deploy microservices to achieve the management service publishing effect, which greatly reduces resource costs. It can uniformly manage service publishing for different customers and realize one-click publishing of microservices, which reduces resource consumption and is simple and convenient to operate.
[0091] In one embodiment, the method further comprises:
[0092] Execute pre-operations and / or post-operations for service release for the target microservice; the pre-operations include at least one of the following: backing up the current microservice file corresponding to the target microservice, stopping the target microservice, and clearing cached data; the post-operations include at least one of the following: outputting a service release reminder message; refreshing cached data.
[0093] Optionally, before executing the service publishing operation based on the target microservice file, the client may perform pre-operations for service publishing for the target microservice, such as backing up the current microservice file corresponding to the target microservice, stopping the target microservice, clearing cached data, etc. After executing the service publishing operation based on the target microservice file, the client may perform post-operations for service publishing for the target microservice, such as outputting a service publishing reminder message; refreshing cached data, etc. Optionally, the backing up of the current microservice file corresponding to the target microservice is to ensure that the historical service version can be rolled back later, that is, after the management end executes the service publishing operation based on the target microservice file, if the current microservice file corresponding to the target microservice needs to be reused for service publishing later, the corresponding operation can be implemented through the backed-up current microservice file corresponding to the target microservice. In this way, by performing pre-operations and / or post-operations for service publishing for the target microservice, the convenience of microservice publishing is improved.
[0094] Based on the same inventive concept as the aforementioned embodiment, an embodiment of the present application further provides a microservice publishing system, comprising a management end and at least one client; wherein the management end and the client are respectively used to execute the corresponding microservice publishing method described in the aforementioned embodiment.
[0095] Based on the same inventive concept as the above-mentioned embodiment, the above-mentioned embodiment is described in detail below through a specific example.
[0096] See also Figure 4, which is the overall architecture diagram of the microservice publishing system provided in this embodiment, mainly includes two modules: the management end, which provides a unified management platform for service publishers. This platform is deployed within the company, and the deployment nodes are scalable. It is responsible for unified communication with customer nodes and unified authority management of service publishers, including menu authority, data authority, operation authority, etc.; the client is responsible for receiving management node scheduling, receiving service files, performing service file backup storage, service publishing, historical service version rollback, monitoring service publishing events, performing service publishing pre-operations and service publishing post-operations. Among them, different customers n correspond to customer nodes n, and n is a positive integer.
[0097] Among them, the management node deployment and main function implementation include:
[0098] The management node is deployed within the company. The management node can be deployed as a single node, or additional service nodes can be registered with the service registration center based on the number of customer nodes, and the unified gateway agent can be used to achieve the purpose of horizontal expansion.
[0099] The management node maintains the heartbeat of the client node, sends heartbeat packets to the client node regularly through the client node registration address, maintains the list of healthy nodes, and can issue early warnings if there are any abnormalities. Through the operation of the service publisher, the information is passed to the corresponding client node, and the client node responds to the corresponding operation event and makes a processing.
[0100] See also Figure 5 , is a diagram of the user authority system. From top to bottom, they are customers, projects, services, and operation types, which are classified according to the tree structure. The maximum authority can be assigned according to the customer. If the customer authority is assigned, all services and all operations under the customer have authority. The minimum authority can be assigned according to the specific operation of a certain customer and a certain service.
[0101] Customer node deployment and main function implementation include:
[0102] The client node is deployed in the client company. Its main functions are to receive service files, back up service files, execute service release and service rollback operations, and respond to operation events.
[0103] The service file is passed from the management node to the customer node through the Restful API interface call. The customer node performs permission verification through the pre-issued key pair. If the verification is passed, the service file is stored according to the project, service name, time, remarks and other information. The storage address can be stored on the local disk, or NFS file server, AWS S3, Huawei obs and other object storage servers according to the customer's situation, and the result is returned to the management node for record management.
[0104] Service publishing and rollback are based on the file address in the management node request parameter. The client node finds the target file and then executes the customized service publishing operation. For example, Java service executes the corresponding startup command, and static resources are stored in the specified proxy directory, etc. You can also customize the pre- and post-service publishing operations according to customer needs, such as clearing the Redis cache, refreshing the CDN cache, sending service publishing message reminders, etc.
[0105] In summary, in the microservice publishing method provided in this embodiment, the project service publishing scheme deployed to customers is uniformly managed, the management node can be deployed in a distributed manner, the customer node can be deployed in a single node or in a distributed manner depending on the resource situation, and the customer node and the management node can communicate using the Restful API interface to achieve the following effects: 1) One management service can uniformly manage different customer project nodes, and the customer project node only needs to deploy one microservice to achieve the management service publishing effect, greatly reducing resource costs; 2) The service publishing performance effect is fast and simple, with one-click publishing, one-click rollback, authority control, and operation supervision and auditing; 3) The unified management service can customize the special needs of different customer service releases based on the publishing events. In other words, the use of a low-resource-consuming microservice publishing method with unified management can reduce the customer server resource requirements and achieve the purpose of unified management of multiple customer projects. The historical version of the service can be quickly published and rolled back based on the stored service files.
[0106] Based on the same inventive concept as the above embodiments, the present invention provides a microservice publishing device, such as Figure 6 As shown, the device includes: a processor 310 and a memory 311 storing a computer program; wherein, Figure 6 The processor 310 shown in the figure is not used to indicate that the number of the processor 310 is one, but is only used to indicate the positional relationship of the processor 310 relative to other devices. In actual applications, the number of the processor 310 may be one or more; similarly, Figure 6 The memory 311 shown in the figure has the same meaning, that is, it is only used to refer to the position relationship of the memory 311 relative to other devices. In practical applications, the number of memories 311 can be one or more. When the processor 310 runs the computer program, the microservice publishing method applied to the above device is implemented.
[0107] The device may also include: at least one network interface 312. The various components in the device are coupled together via a bus system 313. It is understood that the bus system 313 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 313 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 6 Various buses are labeled as bus system 313.
[0108] The memory 311 may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. The nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM); the magnetic surface memory may be a disk memory or a tape memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAM bus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 311 described in the embodiments of the present invention is intended to include but is not limited to these and any other suitable types of memories.
[0109] The memory 311 in the embodiment of the present invention is used to store various types of data to support the operation of the device. Examples of these data include: any computer program used to operate on the device, such as an operating system and an application; contact data; phone book data; messages; pictures; videos, etc. Among them, the operating system includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application program may include various applications, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. Here, the program that implements the method of the embodiment of the present invention may be included in the application program.
[0110] Based on the same inventive concept as the above-mentioned embodiment, this embodiment further provides a computer storage medium, in which a computer program is stored. The computer storage medium may be a ferromagnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); it may also be various devices including one or any combination of the above memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc. When the computer program stored in the computer storage medium is executed by the processor, the microservice publishing method applied to the above-mentioned device is implemented. For the specific steps implemented when the computer program is executed by the processor, please refer to Figure 1-3 The description of the illustrated embodiment will not be repeated here.
[0111] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0112] In this document, the terms "comprises," "comprising," or any other variations thereof, are intended to cover a non-exclusive inclusion of elements other than those listed and may also include additional elements not expressly listed.
[0113] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A microservice publishing method, characterized in that: Applied to a microservice publishing system, the microservice publishing system includes a management end and at least one client; the method includes: The management end sends the target microservice file to the client corresponding to the target customer, and receives and records the file storage information of the target microservice file sent by the client; The client receives the target microservice file sent by the management end, and performs permission verification based on the key pair pre-issued by the management end. If the verification is successful, the target microservice file is stored locally, and the file storage information of the target microservice file is sent to the management end; The management end sends a microservice publishing request to a client corresponding to the target customer in response to a microservice publishing instruction generated on the management interface for the target customer, wherein the microservice publishing request includes file storage information of the target microservice to be published; After receiving the microservice publishing request, the client obtains the target microservice file from the local according to the file storage information of the target microservice, and performs a service publishing operation based on the target microservice file.
2. The method according to claim 1, characterized in that Before the management terminal responds to the microservice publishing instruction for the target customer generated on the management interface, the management terminal also includes: The management terminal obtains user login information, and displays service operation items that the user has operation authority for on the management interface according to the user login information.
3. The method according to any one of claims 1 to 2, characterized in that The method further comprises: The client performs pre-operations and / or post-operations for service release for the target microservice; the pre-operations include at least one of the following: backing up the current microservice file corresponding to the target microservice, stopping the target microservice, and clearing cached data; the post-operations include at least one of the following: outputting a service release reminder message; refreshing cached data.
4. The method according to any one of claims 1 to 2, characterized in that The method further comprises: The management end periodically sends heartbeat packets to the client, and performs abnormality detection on the client according to the heartbeat packet reception status.
5. A microservice publishing method, applied to a management end, characterized in that: The method comprises: Sending a target microservice file to a client corresponding to a target customer, and receiving and recording file storage information of the target microservice file sent by the client; Responding to a microservice publishing instruction for the target customer generated in the management interface; A microservice publishing request is sent to a client corresponding to the target customer, wherein the microservice publishing request includes file storage information of the target microservice to be published, so that after receiving the microservice publishing request, the client obtains the target microservice file from the local according to the file storage information of the target microservice, and performs a service publishing operation based on the target microservice file.
6. A microservice publishing method, applied to a client, characterized in that: The method comprises: Receive the target microservice file sent by the management end, and perform permission verification based on the key pair pre-issued by the management end. If the verification is successful, store the target microservice file locally and send the file storage information of the target microservice file to the management end; Receive a microservice publishing request sent by the management end; the microservice publishing request includes file storage information of a target microservice to be published; The target microservice file is acquired according to the file storage information of the target microservice, and a service publishing operation is performed based on the target microservice file.
7. A microservice publishing system, characterized in that: It includes a management end and at least one client; wherein the management end and the client are respectively used to execute the corresponding microservice publishing method described in any one of claims 1-6.
8. A microservice publishing device, characterized in that: include: A processor and a memory storing a computer program, wherein when the processor runs the computer program, the steps of the microservice publishing method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a processor, the steps of the microservice publishing method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Application program deployment method and device, computer equipment and storage medium
CN114968276A
