Service deployment method, device, electronic device and storage medium

By setting mutable environment static variables in the service deployment file and adapting to parameter adjustments of different deployment environments, the problem that service projects under the vue framework need to be repeatedly developed for different deployment environments is solved, and more efficient service deployment is achieved.

CN114968267BActive Publication Date: 2025-03-25BOE TECHNOLOGY GROUP CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110218050.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-26
Publication Date
2025-03-25
Estimated Expiration
2041-02-26

AI Technical Summary

Technical Problem

Service projects developed under the vue framework need to be repetitively developed for different deployment environments, resulting in increased service deployment costs and reduced efficiency.

Method used

By setting mutable environment static variables in the service deployment file, adaptively adjusting the environment static variables according to the parameters of the required deployment environment to ensure that the service program code runs normally in different deployment environments.

Benefits of technology

Reduces the cost of service deployment, improves the deployment efficiency of service deployment files in different deployment environments, and avoids the development of dedicated service deployment files for different front-end deployment environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114968267B_ABST
    Figure CN114968267B_ABST
Patent Text Reader

Abstract

The service deployment method, device, electronic device and storage medium provided by the present application are applied to the field of computer technology. The method includes: obtaining a service deployment file, the service deployment file includes at least: environment static variables and service program code; changing the environment static variables to adapt to the deployment environment parameters of the front end; adding the changed environment static variables and service program code to the network service container; starting the network service container to execute the service program code in the deployment environment of the front end. This solution sets changeable environment static variables in the service deployment file, so that the environment static variables are adaptively adjusted according to the parameters of the required deployment environment during service deployment, so that the service program code can run normally in the deployment environment, without the need to develop service deployment files for different front-end deployment environments, reducing the cost of service deployment and improving the deployment efficiency of service deployment files in different deployment environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular, relates to a service deployment method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of network technology, more and more network service providers are transforming to a more efficient network service architecture to achieve rapid development and deployment of services. The front-end and back-end separated development framework has become the mainstream direction of service system development due to its lightweight and high efficiency.

[0003] Vue is widely used as a progressive development framework for building user interfaces. This development framework is not only easy to use, but also provides various third-party libraries or project integration functions, which is very suitable for the development of large-scale network service systems.

[0004] However, since the service projects developed under the Vue framework need to be compiled first and then deployed on the front end, and some variables in the same service project are different in different deployment environments, it is necessary to repeatedly develop the same service project each time to adapt to different deployment environments, which greatly increases the cost of service deployment and reduces the efficiency of service deployment. Summary of the invention

[0005] In view of this, the embodiments of the present application propose a service deployment method, device, electronic device and storage medium, which are used to solve the problem in the prior art that when deploying services, deployment files need to be specially developed for the same service to adapt to different front-end deployment environments, which increases the cost required for service deployment and reduces the efficiency of service deployment.

[0006] The first aspect of the present application provides a service deployment method, which is applied to a front end, and the method comprises:

[0007] Obtain a service deployment file, the service deployment file at least including: environment static variables and service program code;

[0008] Modify the environment static variables according to the deployment environment parameters of the front end;

[0009] Adding the changed environment static variables and the service program code to the network service container;

[0010] The network service container is started to execute the service program code in the deployment environment of the front end.

[0011] Optionally, the deployment environment parameters include at least: the network address and domain name of the front end, and the environment static variables include at least: a service access identifier; and the deployment environment parameters adapted to the front end are used to change the environment static variables, including:

[0012] Generate an access identifier of the front end according to the network address and domain name;

[0013] The service access identifier is changed to the access identifier of the front end.

[0014] Optionally, after starting the network service container, the method further includes:

[0015] Upon receiving a service request sent by the client according to the service access identifier, executing the service program code through the network service container to obtain service information;

[0016] The service information is sent to the client.

[0017] Optionally, executing the service program code through the network service container to obtain service information includes:

[0018] The service program code is executed by the network service container so that the network service container obtains service information from a backend interface address, where the backend interface address is obtained based on a reverse proxy policy of the network service container or the environment static variable.

[0019] Optionally, before starting the network service container, the method further includes:

[0020] receiving container adjustment information input for the network service container;

[0021] The reverse proxy policy of the network service container is changed according to the container adjustment information.

[0022] Optionally, obtaining the service deployment file includes:

[0023] Receiving a service deployment data packet sent by a deployment end, wherein the deployment end is communicatively connected with at least two of the front ends;

[0024] Decapsulate the service deployment data packet to obtain a service deployment file.

[0025] Optionally, adding the changed environment static variables and the service program code to the network service container includes:

[0026] The changed environment static variables and the service program code are copied to a static directory of a network service container, wherein the network service container is pre-built after the front-end deployment environment is generated.

[0027] According to a second aspect of the present application, a service deployment device is provided, which is applied to a front end, and the device includes:

[0028] An acquisition module is configured to acquire a service deployment file, wherein the service deployment file includes at least: environment static variables and service program code;

[0029] An update module configured to change the environment static variables in accordance with the deployment environment parameters of the front end;

[0030] A deployment module configured to add the changed environment static variables and the service program code to a network service container;

[0031] The startup module is configured to start the network service container to execute the service program code in the deployment environment of the front end.

[0032] Optionally, the deployment environment parameters include at least: the network address and domain name of the front end, and the environment static variables include at least: a service access identifier; and the update module is further configured to:

[0033] Generate an access identifier of the front end according to the network address and domain name;

[0034] The service access identifier is changed to the access identifier of the front end.

[0035] Optionally, the device further comprises:

[0036] The service provider module is configured as follows:

[0037] Upon receiving a service request sent by the client according to the service access identifier, executing the service program code through the network service container to obtain service information;

[0038] The service information is sent to the client.

[0039] Optionally, the service providing module is further configured to:

[0040] The service program code is executed by the network service container so that the network service container obtains service information from a backend interface address, where the backend interface address is obtained based on a reverse proxy policy of the network service container or the environment static variable.

[0041] Optionally, the deployment module is further configured to:

[0042] receiving container adjustment information input for the network service container;

[0043] The reverse proxy policy of the network service container is changed according to the container adjustment information.

[0044] Optionally, the acquisition module is further configured to:

[0045] Receiving a service deployment data packet sent by a deployment end, wherein the deployment end is communicatively connected with at least two of the front ends;

[0046] Decapsulate the service deployment data packet to obtain a service deployment file.

[0047] Optionally, the deployment module is further configured to:

[0048] The changed environment static variables and the service program code are copied to a static directory of a network service container, wherein the network service container is pre-built after the front-end deployment environment is generated.

[0049] According to the third aspect of the present application, an electronic device is provided, comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the service deployment method described in the first aspect.

[0050] According to a fourth aspect of the present application, a computer non-volatile readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the service deployment method described in the first aspect is implemented.

[0051] With respect to the prior art, this application has the following advantages:

[0052] The present application provides a service deployment method, device, electronic device and storage medium. The solution sets changeable environment static variables in the service deployment file, thereby adaptively adjusting the environment static variables according to the parameters of the required deployment environment during service deployment, so that the service program code can run normally in the deployment environment. There is no need to develop service deployment files for different front-end deployment environments, which reduces the cost of service deployment and improves the deployment efficiency of service deployment files in different deployment environments.

[0053] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0055] Figure 1 It is a flow chart of the steps of a service deployment method provided by an embodiment of the present application;

[0056] Figure 2 is a flowchart of another service deployment method provided by an embodiment of the present application;

[0057] Figure 3 This is a flowchart of the steps of another service deployment method provided in an embodiment of the present application;

[0058] Figure 4 It is a schematic diagram of the principle of a service deployment method provided in an embodiment of the present application;

[0059] Figure 5 It is a structural block diagram of a service deployment device provided in an embodiment of the present application;

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

[0061] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0062] Figure 1 The present invention provides a flowchart of a service deployment method, which is applied to the front end. The method includes:

[0063] Step 101, obtaining a service deployment file, wherein the service deployment file at least includes: environment static variables and service program code.

[0064] In the embodiment of the present application, the front end refers to a server for obtaining service information from the back end in response to the service request of the client and providing it to the client. The service architecture with separated front and back ends can effectively reduce the load pressure of the server. The service deployment file refers to the program file required for deploying the service at the front end, which contains the service program code describing the service front end operation logic. The environment static variable refers to the environment configuration information required by the service program code at runtime. It should be noted that in the prior art, the environment configuration information is directly written into the service program code when the service deployment file is compiled, so the service deployment file is adapted to the deployment environment information contained therein and can only be deployed on the corresponding front-end server, and the deployment environment for different front-end servers cannot be realized. The environment information must be specially developed and adjusted for different deployment environments. The embodiment of the present application sets the environment deployment information in the service deployment file in the form of configurable variables, so that it can adapt to different deployment environments to achieve dynamic adjustment of the environment deployment information.

[0065] In actual applications, you can set variable deployment environment variables by adding static configuration files in the public directory of the service deployment file. The static files that set the deployment environment variables do not need to be compiled for different deployment environments during development. After the service deployment file is compiled, you can directly copy it to the service deployment file as a static deployment file.

[0066] In actual applications, the deployment environment of the front-end server in the embodiment of the present application can be built based on architectures such as vue (a progressive Java Script architecture for building user interfaces) and node (a Java Script architecture based on the V8 engine), so the service deployment file can also be developed based on the same architecture as the environment construction architecture in the front-end server.

[0067] Step 102: modify the environment static variables to adapt to the deployment environment parameters of the front end.

[0068] In the embodiment of the present application, the deployment environment parameters are parameter information related to the deployment environment, such as: the type, version, device model, function interface address, etc. of the deployment environment. The front-end server develops the service deployment file, and then calls the local deployment environment parameters to adaptively change the environment static variables. Specifically, the front-end server can be pre-set with a change strategy for changing the environment static variables according to the deployment environment parameters, for example: adding the deployment environment function interface address to the response call function address in the environment static variables, or adapting the memory size of the deployment environment to the data transmission upper limit value in the environment static variables, etc. The specific can be determined according to actual needs and is not limited here.

[0069] Step 103: Add the changed environment static variables and the service program code to the network service container.

[0070] In the embodiment of the present application, a network service container (web container) refers to a service program for accommodating and running service program codes, such as a Tomcat container in JAVA, an nginx proxy service container, etc. A front-end server can be provided with multiple network service containers, so that the same front-end server can provide multiple network servers at the same time. The place where the technical solution in the present application is executed can be in the network service container, that is, parameter collection and deployment are performed in the network service container.

[0071] After the environment static variables are changed, the changed environment static variables and service program codes can be directly added to the static directory of the network service container, thereby completing the setting of the service deployment file on the front end.

[0072] Step 104, start the network service container to execute the service program code in the front-end deployment environment.

[0073] In the embodiment of the present application, after the network service container has added the service deployment file, the network service container can be started, so that the network service container executes the service program code. During the operation of the service program code, the changed environment static variables can be directly extracted from the static file of the network service container. Since the environment static variables can adapt to the deployment environment parameter adjustment of the front end, the service program code can run normally in the deployment environment of the front end, and there will be no situation where the environment static variables are incompatible with the current deployment environment, causing the service program code to fail to run normally, thereby realizing one-time compilation and multiple deployment of the service deployment file, and no longer needing to adapt to different front-end deployment environments to develop dedicated service deployment files. It should be noted that the embodiment of the present application uses static variables to set environment variables in the service deployment file instead of dynamic variables, because dynamic variables require the front-end server and the back-end server to interact to obtain the true value of the dynamic variable, and before the service is deployed at the front end, the front-end server cannot interact with the back-end server, so that the value of the environment variable cannot be obtained during the deployment process, and the purpose of adaptive adjustment of the environment variable during the deployment process of the embodiment of the present application cannot be achieved. Furthermore, the same is true for obtaining the changed environment static variables from the static files of the network service container. Since the network service container cannot interact with the backend server before the service deployment is completed, if the changed environment static variables exist in the dynamic file, then before the service deployment is completed, since the network service container cannot interact with the backend server, the changed environment static variables cannot be obtained, thereby failing to achieve the purpose of adaptively adjusting the environment variables during the service deployment process as required by the embodiment of the present application.

[0074] A service deployment method provided by an embodiment of the present application sets changeable environment static variables in a service deployment file, thereby adaptively adjusting the environment static variables according to the parameters of the required deployment environment during service deployment, so that the service program code can run normally in the deployment environment. There is no need to develop service deployment files for different front-end deployment environments, thereby reducing the cost of service deployment and improving the deployment efficiency of service deployment files in different deployment environments.

[0075] Figure 2 It is a flowchart of another service deployment method provided by an embodiment of the present application, which is applied to the front end, and the method includes:

[0076] Step 201, receiving a service deployment data packet sent by a deployment end, wherein the deployment end is communicatively connected with at least two of the front ends.

[0077] In the embodiment of the present application, the deployment end is a server for distributing service deployment data packets. Developers can develop and build service deployment data packets on the deployment end, and can also publish the service deployment data packets on the deployment end after the service deployment data packets are built. Each time a service deployment is required, the service deployment data packets can be sent to multiple front ends that need to be deployed through the deployment end, thereby realizing large-scale deployment of service deployment data packets.

[0078] Step 202: decapsulate the service deployment data package to obtain a service deployment file, which at least includes: environment static variables and service program code.

[0079] In an embodiment of the present application, by encapsulating the service deployment file into a service deployment data packet, the amount of data transmission required for service deployment can be effectively reduced, thereby reducing the data transmission pressure on the deployment end when performing large-scale service deployment.

[0080] Optionally, the deployment environment parameters include at least: the network address and domain name of the front end, and the environment static variables include at least: a service access identifier.

[0081] Step 203: Generate an access identifier of the front end according to the network address and domain name.

[0082] In the embodiment of the present application, the access identifier is identification information used to instruct the client to send a service request to the front end when service information is needed, such as information with identification function such as URL (uniform resource locator). For web page services, when obtaining web page data, the client usually generates a web page address from the network address and domain name of the web page service, that is, the access identifier in the embodiment of the present application, so that the client can resolve the domain name in the web page address to obtain the network address, so as to send a service request carrying the access identifier to the front end.

[0083] Step 204: Change the service access identifier to the access identifier of the front end.

[0084] In the embodiment of the present application, the service access identifier is used to indicate the front-end server that provides service information. It can be understood that the service access identifier needs to indicate the front-end server. However, since the environment static variables in the embodiment of the present application are not developed separately for a certain front-end server, the service access identifier in the environment static variables is the initial value of the service access identifier such as localhost. The initial value of the service access identifier does not indicate the front-end server, and it needs to be changed to adapt to the access identifier of the front-end server required to be deployed for the service before it can be used normally. The environment static variables can be set with a service access identifier for setting changes, so as to make adaptive changes according to the access identifier of the front end required to be deployed, so that the network service container provides service information to the client when receiving a service request.

[0085] The embodiment of the present application changes the environment static variables according to the network address and domain name of the front end, so that the service deployment file can be normally deployed in the front end with different network addresses and domain names, thereby reducing the cost of service deployment and improving the efficiency of service deployment.

[0086] Step 205 , copying the changed environment static variables and the service program code to a static directory of a network service container, wherein the network service container is pre-built after the front-end deployment environment is generated.

[0087] In the embodiment of the present application, the network service container is pre-generated by the front end when building the deployment environment according to the container construction logic of the deployment environment. The specific method can refer to the relevant prior art and will not be repeated here. The embodiment of the present application realizes service deployment by directly copying the changed environment static variables and service program code to the static directory of the network service container, without the need for the front end to rebuild the network service container, thereby improving the efficiency of service deployment.

[0088] Step 206, start the network service container to execute the service program code in the front-end deployment environment.

[0089] This step can refer to the detailed description of step 104 and will not be described again here.

[0090] Step 207: upon receiving a service request sent by the client according to the service access identifier, the service program code is executed through the network service container to obtain service information.

[0091] Step 208: Send the service information to the client.

[0092] In an embodiment of the present application, the front-end server receives a service request carrying a service access identifier sent by the client. The network service container claims the service request based on the service access identifier and starts executing the service program code to obtain service information. The service information can be generated by the network service container, or it can be extracted by the network service container from the front-end server or obtained from other servers. As long as the service information can be obtained, it can be set according to actual needs and is not limited here.

[0093] Optionally, step 206 may include: executing the service program code through the network service container so that the network service container obtains service information from a backend interface address, where the backend interface address is obtained based on a reverse proxy policy of the network service container or the environment static variable.

[0094] In the embodiment of the present application, the reverse proxy strategy refers to the strategy of the network service container to obtain service information from servers other than the local server, such as obtaining service information from the backend server 1 for the service request sent by the client 1, and obtaining service information from the backend server 2 for the service request sent by the client 2; it can also be a data transmission strategy in the reverse proxy process, such as the timeout retransmission, packet return confirmation and other transmission configurations when the network service container sends a service information acquisition request to the backend server. The specific reverse proxy strategy can be set according to actual needs and is not limited here. Each time the network service container receives a service request, it can determine the backend interface address based on the reverse proxy strategy, and can also extract the backend interface address from the environment static variables. This allows developers to adjust the backend interface address by configuring the reverse proxy strategy of the network service container or configuring the environment static variables, so that the service information acquisition device can be flexibly set, which improves the flexibility of service information acquisition.

[0095] Optionally, refer to Figure 3 , before step 205, the method further includes:

[0096] Step 209: Receive container adjustment information input for the network service container.

[0097] Step 210: Change the reverse proxy policy of the network service container according to the container adjustment information.

[0098] In the embodiment of the present application, the container adjustment information is information used to configure parameters of the network service container, which can be input by the user or automatically generated by the system. It can be set according to actual needs and is not limited here.

[0099] Specifically, refer to Figure 4 A schematic diagram showing the principles of a service deployment method provided in an embodiment of the present application is shown.

[0100] Among them, the build server can be the deployment end in the embodiment of the present application, and environment 1 to environment N can be different deployment environments of the front end in the embodiment of the present application.

[0101] Step S1, the build server can first obtain the source code of the application service program developed based on the development framework such as vue, html, css, js, etc. through the git tool, and use the git pull command on the build server to obtain the latest code;

[0102] Step S2, the build server builds the service program code of the application through the npm build command;

[0103] Step S3, the build server performs code obfuscation on the compiled service program code and the file containing the environment static variables, and then compiles and generates a service deployment file;

[0104] Step S4, the construction server packages the generated service deployment file to obtain a service deployment data package;

[0105] Step S5, the construction server distributes the service deployment data packets to different deployment environments of the front end;

[0106] Step S6, the front ends in different deployment environments 1 to N obtain service deployment files by decompressing service deployment data;

[0107] Step S7, the front end configures the environment static variables in the service deployment file according to the parameters of its own deployment environment to perform personalized configuration to adapt to the deployment environment;

[0108] Step S8, adding the configured service deployment file to the network service (web) container;

[0109] Step S9, start the container to complete the service deployment.

[0110] Before the network service container is started, the reverse proxy policy in the network service container can be changed through the container adjustment information, so that the network service container can adapt to different network services to adjust the reverse proxy policy. For example, for the same network service, only some network service containers are temporarily developed, and the reverse proxy policy can be set to disabled to display that some network service containers suspend service. Or for the same network service, different backend servers can be assigned to different network service containers to provide data support, etc. The specific settings can be based on actual needs and are not limited here.

[0111] The embodiment of the present application can conveniently manage service deployment by configuring the reverse proxy policy before starting the network service container.

[0112] Another service deployment method provided by an embodiment of the present application sets changeable environment static variables in the service deployment file, thereby adaptively adjusting the environment static variables according to the parameters of the required deployment environment during service deployment, so that the service program code can run normally in the deployment environment. There is no need to develop service deployment files for different front-end deployment environments, which reduces the cost of service deployment and improves the deployment efficiency of service deployment files in different deployment environments.

[0113] Figure 5 The embodiment of the present application provides a structural block diagram of a service deployment device 30, which is applied to the front end, and the device includes:

[0114] The acquisition module 301 is configured to acquire a service deployment file, wherein the service deployment file at least includes: environment static variables and service program code;

[0115] An updating module 302 is configured to modify the environment static variables according to the deployment environment parameters of the front end;

[0116] A deployment module 303 is configured to add the changed environment static variables and the service program code to the network service container;

[0117] The startup module 304 is configured to start the network service container to execute the service program code in the front-end deployment environment.

[0118] Optionally, the deployment environment parameters at least include: the network address and domain name of the front end, and the environment static variables at least include: a service access identifier; the update module 303 is further configured to:

[0119] Generate an access identifier of the front end according to the network address and domain name;

[0120] The service access identifier is changed to the access identifier of the front end.

[0121] Optionally, the device further comprises:

[0122] The service provider module is configured as follows:

[0123] Upon receiving a service request sent by the client according to the service access identifier, executing the service program code through the network service container to obtain service information;

[0124] The service information is sent to the client.

[0125] Optionally, the service providing module is further configured to:

[0126] The service program code is executed by the network service container so that the network service container obtains service information from a backend interface address, where the backend interface address is obtained based on a reverse proxy policy of the network service container or the environment static variable.

[0127] Optionally, the deployment module 303 is further configured to:

[0128] receiving container adjustment information input for the network service container;

[0129] The reverse proxy policy of the network service container is changed according to the container adjustment information.

[0130] Optionally, the acquisition module 301 is further configured to:

[0131] Receiving a service deployment data packet sent by a deployment end, wherein the deployment end is communicatively connected with at least two of the front ends;

[0132] Decapsulate the service deployment data packet to obtain a service deployment file.

[0133] Optionally, the deployment module 303 is further configured to:

[0134] The changed environment static variables and the service program code are copied to a static directory of a network service container, wherein the network service container is pre-built after the front-end deployment environment is generated.

[0135] The service deployment device provided in the embodiment of the present application has a functional module corresponding to the execution service deployment method, and can execute the embodiment of the present application. Figures 1 to 4 The service deployment method provided can achieve the same beneficial effects.

[0136] In another embodiment provided by the present application, an electronic device is also provided, which may include: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the program, each process of the above-mentioned service deployment method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. For example, Figure 6 As shown, the electronic device may specifically include: a processor 401, a storage device 402, a display screen 403 with a touch function, an input device 404, an output device 405, and a communication device 406. The number of processors 401 in the electronic device may be one or more. Figure 6 A processor 401 is taken as an example. The processor 401, storage device 402, display screen 403, input device 404, output device 405 and communication device 406 of the electronic device can be connected via a bus or other means.

[0137] In another embodiment provided in the present application, a computer non-volatile readable storage medium is provided, in which instructions are stored. When the instructions are executed on a computer, the computer executes the service deployment method described in any one of the above embodiments.

[0138] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the service deployment method described in any one of the above embodiments.

[0139] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" 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 other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0140] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0141] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A service deployment method, characterized in that: Applied to the front end, the method comprises: Obtain a service deployment file, the service deployment file at least including: environment static variables and service program code; wherein the environment static variables are variables in a static configuration file added to the public directory of the service deployment file, and the static configuration file is directly copied to the public directory of the service deployment file after the service deployment file is compiled; Modify the environment static variables according to the deployment environment parameters of the front end; Adding the changed environment static variables and the service program code to the network service container; The network service container is started to execute the service program code in the deployment environment of the front end.

2. The method according to claim 1, characterized in that The deployment environment parameters at least include: the network address and domain name of the front end, and the environment static variables at least include: a service access identifier; the deployment environment parameters adapted to the front end change the environment static variables, including: Generate an access identifier of the front end according to the network address and domain name; The service access identifier is changed to the access identifier of the front end.

3. The method according to claim 1 or 2, characterized in that: After starting the network service container, the method further includes: Upon receiving a service request sent by the client according to the service access identifier, executing the service program code through the network service container to obtain service information; The service information is sent to the client.

4. The method according to claim 3, characterized in that The executing the service program code through the network service container to obtain service information includes: The service program code is executed by the network service container so that the network service container obtains service information from a backend interface address, where the backend interface address is obtained based on a reverse proxy policy of the network service container or the environment static variable.

5. The method according to claim 1 or 2, characterized in that: Before starting the network service container, the method further includes: receiving container adjustment information input for the network service container; The reverse proxy policy of the network service container is changed according to the container adjustment information.

6. The method according to claim 1, characterized in that The obtaining of the service deployment file includes: Receiving a service deployment data packet sent by a deployment end, wherein the deployment end is communicatively connected with at least two of the front ends; Decapsulate the service deployment data packet to obtain a service deployment file.

7. The method according to claim 1, characterized in that The step of adding the changed environment static variables and the service program code to the network service container includes: The changed environment static variables and the service program code are copied to a static directory of a network service container, wherein the network service container is pre-built after the deployment environment of the front end is generated.

8. A service deployment device, characterized in that: Applied to the front end, the device comprises: an acquisition module configured to acquire a service deployment file, the service deployment file comprising at least: environment static variables and service program code; wherein the environment static variables are variables in a static configuration file added to a public directory of the service deployment file, and the static configuration file is directly copied to the public directory of the service deployment file after the service deployment file is compiled; An update module configured to change the environment static variables in accordance with the deployment environment parameters of the front end; A deployment module configured to add the changed environment static variables and the service program code to a network service container; The startup module is configured to start the network service container to execute the service program code in the deployment environment of the front end.

9. An electronic device, characterized in that: It comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the service deployment method as claimed in any one of claims 1 to 7.

10. A computer non-transitory readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the service deployment method described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Application deployment method and device

    CN106610853A