A solution, device, storage medium and equipment for front-end private cloud deployment
By obtaining the Host address of the proxy server from the Config.Json configuration file and calling the API interface, the problem of the front-end obtaining environment configuration information in a private cloud deployment environment is solved, and real-time dynamic Host address acquisition is achieved, which improves efficiency and reduces maintenance costs.
Patent Information
- Application Number
- CN201910268099.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-04-03
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2039-04-03
Smart Images

Figure CN111787036B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a solution, device, storage medium and equipment for front-end private cloud deployment. Background Art
[0002] In front-end development, for public cloud deployment products, the target environment is fixed. Developers only need to write fixed environment configuration information into the front-end directory in advance. When the front-end switches the environment, it can read the corresponding environment configuration information from the directory.
[0003] However, in the current environment, for private deployment products (To B platform-level products), the target environment is unknown, and how the front-end obtains the environment configuration information of the target environment has become a big problem. Summary of the invention
[0004] In view of the above problems, the present invention is proposed to provide a solution, device, storage medium and equipment for front-end private cloud deployment that overcomes the above problems or at least partially solves the above problems.
[0005] According to one aspect of the present invention, a solution for front-end private cloud deployment is provided, including:
[0006] Receive the user's access request, and obtain the Host address of the proxy server in the current environment from the preset Config.Json configuration file according to the access request;
[0007] The corresponding API interface is determined according to the path information corresponding to the access request and the Host address, and the API interface is called to send the access request to the proxy server.
[0008] Optionally, before receiving the user's access request and obtaining the Host address of the proxy server in the current environment from a preset Config.Json configuration file according to the access request, the method further includes:
[0009] Create a Config.Json configuration file in the local directory, monitor and read the Host address of the proxy server in the current environment through the Shell deployment script, and write the read Host address into the Config.Json configuration file.
[0010] Optionally, after determining a corresponding API interface according to the path information corresponding to the access request and the Host address, and calling the API interface to send the access request to the proxy server, the method further includes:
[0011] Receive the data returned by the API interface and render the data on the browser page to display to the user.
[0012] Optionally, the proxy server is an Nginx server.
[0013] Optionally, the API interface is a REST-style API interface.
[0014] According to another aspect of the present invention, a solution for front-end private cloud deployment is also provided, including:
[0015] An acquisition module is configured to receive an access request from a user and obtain the Host address of the proxy server in the current environment from a preset Config.Json configuration file according to the access request;
[0016] The calling module is configured to determine a corresponding API interface according to the path information corresponding to the access request and the Host address, and call the API interface to send the access request to the proxy server.
[0017] Optionally, the above device further includes:
[0018] Create a module and configure it to create a Config.Json configuration file in the local directory. Use the shell deployment script to monitor and read the host address of the proxy server in the current environment, and write the read Host address into the Config.Json configuration file.
[0019] Optionally, the above device further includes:
[0020] The rendering module is configured to receive the data returned by the API interface and render the data on a browser page to display it to the user.
[0021] Optionally, the proxy server is an Nginx server.
[0022] Optionally, the API interface is a REST-style API interface.
[0023] According to another aspect of the present invention, a computer storage medium is provided, wherein the computer storage medium stores a computer program code, and when the computer program code runs on a computing device, the computing device executes any of the above-mentioned solutions for front-end private cloud deployment.
[0024] According to yet another aspect of the present invention, there is further provided a computing device, comprising:
[0025] processor;
[0026] a memory storing computer program code;
[0027] When the computer program code is executed by the processor, it causes the computing device to execute any of the above-mentioned solutions for front-end private cloud deployment.
[0028] In the embodiment of the present invention, after the front end receives the user's access request, it can obtain the Host address of the proxy server in the current environment from the preset Config.Json configuration file, and then determine the corresponding API interface according to the path information corresponding to the access request and the Host address, and call the API interface to send the access request to the proxy server. Based on the technical solution proposed in the embodiment of the present invention, under the premise of ensuring data security and service availability, the front end can obtain the Host address information of the proxy server in the current environment in real time and dynamically, thereby improving work efficiency and reducing maintenance costs.
[0029] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below.
[0030] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] 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 invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0032] Figure 1 A schematic diagram of a process for a solution to front-end private cloud deployment according to an embodiment of the present invention is shown;
[0033] Figure 2 A schematic diagram of a process for a solution to front-end private cloud deployment according to a preferred embodiment of the present invention is shown;
[0034] Figure 3 A schematic flow chart of a solution for front-end private cloud deployment according to another preferred embodiment of the present invention is shown;
[0035] Figure 4 It shows a structural block diagram of a solution device for front-end private cloud deployment according to an embodiment of the present invention;
[0036] Figure 5It shows a structural block diagram of a solution device for front-end private cloud deployment according to a preferred embodiment of the present invention;
[0037] Figure 6 A structural block diagram of a solution for front-end private cloud deployment according to another preferred embodiment of the present invention is shown. DETAILED DESCRIPTION
[0038] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0039] It should be noted that the technical features in the embodiment and optional embodiments of the present invention can be combined with each other under the premise of no conflict.
[0040] In order to solve the above problems, the embodiment of the present invention proposes a solution for front-end private cloud deployment. Figure 1 FIG. 1 is a flow chart showing a solution for front-end private cloud deployment according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0041] Step S102: receiving the user's access request, and obtaining the Host address of the proxy server in the current environment from the preset Config.Json configuration file according to the access request;
[0042] Step S104: determine the corresponding API interface according to the path information corresponding to the access request and the Host address, and call the API interface to send the access request to the proxy server.
[0043] In the embodiment of the present invention, after the front end receives the user's access request, it can obtain the Host address of the proxy server in the current environment from the preset Config.Json configuration file, and then determine the corresponding API interface according to the path information corresponding to the access request and the Host address, and call the API interface to send the access request to the proxy server. Based on the technical solution proposed in the embodiment of the present invention, under the premise of ensuring data security and service availability, the front end can obtain the Host address information of the proxy server in the current environment in real time and dynamically, thereby improving work efficiency and reducing maintenance costs.
[0044] Specifically, it is known that the above Host address is IP+port number, and the API interface address is IP+port number+path. The path in the API address is determined by the type of access request. After receiving the user's access request, the front end will generate the corresponding path information in real time according to the access request through the preset code. In one example, if the user inputs a login request, the front end will search for a configuration file with a preset file name of Config.Json in the directory after receiving the user's request, and then obtain the Host address of the proxy server of the current environment. The Host address found is 10.0.0.1:8000, 10.0.0.1 is the IP, and 8000 is the port number. According to the determined Host address and the path information generated by the login request, the corresponding API interface can be determined to be 10.0.0.1:8000 / login. Calling this API interface can send the user's access request to the proxy server for processing.
[0045] In another example, if the user clicks on a search request, the front end will also search for a configuration file with a preset file name of Config.Json in the directory after receiving the user's request, and then obtain the Host address of the proxy server in the current environment. The Host address found is 10.0.0.1:8000, where 10.0.0.1 is the IP and 8000 is the port number. Based on the determined Host address and the path information generated by the search request, the corresponding API interface can be determined to be 10.0.0.1:8000 / search. Calling this API interface can send the user's access request to the proxy server for processing.
[0046] Figure 2 FIG. 1 is a flow chart showing a solution for front-end private cloud deployment according to a preferred embodiment of the present invention. Figure 2 As shown, before step S102, the method further includes: step S100: creating a Config.Json configuration file in a local directory, monitoring and reading the Host address of the proxy server in the current environment through a Shell deployment script, and writing the read Host address into the Config.Json configuration file.
[0047] Among them, the configuration file named Config.Json is created before the program runs. The Config.Json configuration file in this embodiment is mainly used to store the Host address of the proxy server in the current environment, so that when the front end receives the user's access request, it can read the Host address of the proxy server in the current environment from the configuration file named Config.Json.
[0048] The above-mentioned Shell deployment script is similar to the batch processing under Windows / Dos, that is, it is pre-placed into a file with various commands, and a program file for one-time execution is convenient, which is mainly convenient for the administrator to set up or manage, but it is more powerful than the batch processing under Windows, and is more efficient than the program edited with other programming programs. In an embodiment of the present invention, the Shell deployment script is mainly used to monitor the change of the Host address information of the proxy server. In fact, the proxy server is deployed on the back-end server, and when the back-end server of the proxy server is deployed, the Host of the proxy server, i.e., the IP address and the port number, may change. At this time, it is necessary to read the Host address of the proxy server in the current environment in real time through Shell deployment, and use the Host address of the current environment read to cover the existing Host address in the Config.Json configuration file under the front-end directory, so that the Host address information of the proxy server can be avoided to change, and the Host address information in the Config.Json configuration file is not updated to the latest Host address in time, resulting in the front end receiving the user's access request and not being able to retrieve the corresponding API interface, so that the result displayed on the page is an access error. Based on the technical solution proposed in the present invention, the front-end can obtain the Host address of the proxy server in the current environment in real time and dynamically, and monitoring the proxy server and writing the Host address of the proxy server into the Config.Json configuration file are automatically completed by the Shell deployment script without manual intervention, saving costs and improving efficiency.
[0049] Figure 3 FIG. 2 is a flow chart showing a solution for front-end private cloud deployment according to another preferred embodiment of the present invention. Figure 3 As shown, in this preferred embodiment, the above method also includes: Step S106: receiving data returned by the above API interface, and rendering the data on a browser page to display to the user.
[0050] Specifically, after the above step S104, the proxy server can choose to directly process the received request or forward it to other back-end servers for processing. In actual applications, when only one back-end server is deployed, the proxy server can be deployed on the server. After the front end sends the user's access request to the proxy server through the API interface, since there is only one back-end server that can process the access request, the server directly processes the received user access request and returns the data to the front end through the proxy server after the processing is completed.
[0051] In the case of low traffic, it is possible to arrange a backend server to provide data services, but in the case of large traffic, in order to prevent the slow processing of user access requests, slow return of data, and possible crash of the backend server, multiple backend servers need to be arranged, and the proxy server can also be arranged on any backend server. In addition, in order to further ensure load balancing, the proxy server can directly process the access request of the logic class after receiving it. In fact, the logic class request occupies relatively less memory, and the processing pressure of the proxy server is also small, which will not have a significant impact on the performance of the proxy server. When the proxy server receives the access request of the search class, it can forward it to other backend servers for processing. In the process of forwarding to the backend server, the proxy server can determine the target server for forwarding according to certain rules. In one example, the proxy server can monitor each backend server to obtain the memory information of each backend server in real time, so that when receiving the access request of the search class, it can quickly determine the server with the largest remaining memory, and use the server as the target server, send the request to the target server, and the target server processes the received access request, and then receives the data returned by the target server, and returns it to the front end through the above API interface.
[0052] In another example, the proxy server can monitor each backend server to obtain the access information of each backend server in real time, so that when a search-type access request is received, the backend server with the least access can be used as the target server, and the request can be sent to the target server. The target server processes the received access request, and then receives the data returned by the target server and returns it to the front end through the above-mentioned API interface.
[0053] In actual applications, each backend server can also be set to report its own information to the proxy server at regular intervals. After the setting is completed, the backend server will report its own memory and / or access volume information to the proxy server at regular intervals, which can facilitate the proxy server to determine the target server for processing the request when it receives the user request.
[0054] It should be noted that, in addition to the above memory and access volume, there are many other parameters for selecting a backend server as a target server, which will not be listed one by one in the present invention.
[0055] In fact, a threshold of access volume and / or memory can be set for the proxy server, so that in the case of abnormally high access volume, that is, the threshold is exceeded, the proxy server can forward all received requests to other backend servers. The proxy server only provides the forwarding function, which can avoid the proxy server from crashing due to excessive load caused by forwarding user access requests on the one hand and processing user access requests on the other hand.
[0056] Furthermore, after receiving the data returned by itself or other back-end servers, the proxy server will return the data to the front-end through the above-mentioned API interface, and the front-end will be responsible for rendering the data on the browser page to display it to the user. In the embodiment of the present invention, the front-end and back-end are separated, and the front-end is responsible for writing HTML / CSS, javascript, and other static resources, and then calling the services provided by the back-end through HTTP requests; the back-end is responsible for the Model layer, business processing / data, etc. The front-end can call the API interface to interact with the back-end through the Host address recorded in the configuration file. The separation of the front-end and back-end allows the developers of the front-end and back-end to only focus on the parts they are responsible for, and they can develop in parallel after agreeing on the API format. This kind of workflow makes the responsibilities of developers clear, thereby improving work efficiency and reducing maintenance costs.
[0057] In a preferred embodiment, the proxy server is an Nginx server. The Nginx ("engine x") server is a high-performance HTTP and reverse proxy server, characterized by small memory usage and strong concurrency. In the embodiment of the present invention, the Nginx server mainly plays the role of a reverse proxy.
[0058] The present invention does not impose any restriction on the specific type of the proxy server. If there are other servers with the functions of the Nginx server, they can also be used as proxy servers in the present invention.
[0059] In a preferred embodiment, the above API interface is a REST-style API interface. REST stands for Representational State Transfer. REST is a software architecture style and design style, not a standard, but only provides a set of design principles and constraints. It is mainly used for client and server interaction software. Software designed based on this style can be simpler, more hierarchical, and easier to implement mechanisms such as caching. REST API is based on HTTP, and HTTP clients (such as browsers) can better understand APIs.
[0060] Based on the same inventive concept, the embodiment of the present invention also provides a solution device for front-end private cloud deployment. Figure 4 FIG. 2 shows a structural block diagram of a solution device for front-end private cloud deployment according to an embodiment of the present invention. Figure 4 As shown, the device 400 includes:
[0061] The acquisition module 410 is configured to receive an access request from a user and obtain the Host address of the proxy server in the current environment from a preset Config.Json configuration file according to the access request;
[0062] The calling module 420 is configured to determine a corresponding API interface according to the path information corresponding to the access request and the Host address, and call the API interface to send the access request to the proxy server.
[0063] Based on the technical solution proposed in the embodiment of the present invention, under the premise of ensuring data security and service availability, the front end can obtain the Host address information of the proxy server in the current environment in real time and dynamically, thereby improving work efficiency and reducing maintenance costs.
[0064] Figure 5 FIG. 4 shows a structural block diagram of a solution device for front-end private cloud deployment according to a preferred embodiment of the present invention. Figure 5 As shown, in this preferred embodiment, the above-mentioned device 400 also includes: a creation module 430, configured to create a Config.Json configuration file in a local directory, monitor and read the Host address of the proxy server in the current environment through a Shell deployment script, and write the read Host address into the Config.Json configuration file.
[0065] Figure 6 FIG. 4 shows a structural block diagram of a solution device for front-end private cloud deployment according to another preferred embodiment of the present invention. Figure 6 As shown, in this preferred embodiment, the above-mentioned device 400 also includes: a rendering module 440, which is configured to receive the data returned by the above-mentioned API interface and render the data on a browser page to display it to the user.
[0066] In a preferred embodiment, the above-mentioned proxy server is an Nginx server.
[0067] In a preferred embodiment, the above API interface is a REST-style API interface.
[0068] According to another aspect of the present invention, a computer storage medium is provided, which stores computer program code. When the computer program code runs on a computing device, it causes the computing device to execute the solution for front-end private cloud deployment in any of the above embodiments.
[0069] According to another aspect of the present invention, there is also provided a computing device, comprising:
[0070] processor;
[0071] a memory storing computer program code;
[0072] When the computer program code is executed by the processor, it causes the computing device to execute the solution for front-end private cloud deployment in any of the above embodiments.
[0073] According to the technical solution proposed in the present invention, after the front end receives the user's access request, it can obtain the Host address of the proxy server in the current environment through the preset Config.Json configuration file, and then determine the corresponding API interface according to the path information corresponding to the access request and the Host address, and call the API interface to send the access request to the proxy server. Based on the technical solution proposed in the embodiment of the present invention, under the premise of ensuring data security and service availability, the front end can obtain the Host address information of the proxy server in the current environment in real time and dynamically, improve work efficiency and reduce maintenance costs, and the front end is responsible for rendering the received data to the browser page to display it to the user. The separation of the front and back ends allows developers to only focus on the part they are responsible for, and they can develop in parallel after agreeing on the API format, which improves work efficiency and reduces maintenance costs. In addition, this solution adopts private deployment, which allows corporate customers to access back-end data on the one hand; on the other hand, it connects all systems, allowing enterprises to seamlessly access detailed data without restrictions, eliminating data islands and thus achieving more effective data sharing and utilization.
[0074] It will be apparent to those skilled in the art that the above described systems, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting an intent that the claimed invention requires more features than those expressly recited in each claim. Rather, as reflected in the claims below, inventive aspects lie in less than all of the features of the individual embodiments disclosed above. Therefore, the claims that follow the detailed description are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate embodiment of the invention.
[0075] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0076] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims, any one of the claimed embodiments may be used in any combination.
[0077] At this point, those skilled in the art should recognize that, although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived based on the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.
Claims
1. A solution for front-end private cloud deployment, including: Receive the user's access request, and obtain the Host address of the proxy server in the current environment from the preset Config.Json configuration file according to the access request; Determine a corresponding API interface according to the path information corresponding to the access request and the Host address, and call the API interface to send the access request to the proxy server; Before receiving the user's access request and obtaining the Host address of the proxy server in the current environment from the preset Config.Json configuration file according to the access request, the method further includes: Create a Config.Json configuration file in the local directory, monitor and read the Host address of the proxy server in the current environment through the Shell deployment script, and write the read Host address into the Config.Json configuration file.
2. The method according to claim 1, wherein: After determining the corresponding API interface according to the path information corresponding to the access request and the Host address, and calling the API interface to send the access request to the proxy server, the method further includes: Receive the data returned by the API interface and render the data on the browser page to display to the user.
3. The method according to claim 1, wherein: The proxy server is an Nginx server.
4. The method according to claim 1, wherein: The API interface is a REST-style API interface.
5. A solution for front-end private cloud deployment, comprising: An acquisition module is configured to receive an access request from a user and obtain the Host address of the proxy server in the current environment from a preset Config.Json configuration file according to the access request; A calling module, configured to determine a corresponding API interface according to the path information corresponding to the access request and the Host address, and call the API interface to send the access request to the proxy server; The device also includes: Create a module and configure it to create a Config.Json configuration file in the local directory. Use the Shell deployment script to monitor and read the Host address of the proxy server in the current environment, and write the read Host address into the Config.Json configuration file.
6. The device according to claim 5, wherein: The device also includes: The rendering module is configured to receive the data returned by the API interface and render the data on a browser page to display it to the user.
7. The device according to claim 5, wherein: The proxy server is an Nginx server.
8. The device according to claim 5, wherein: The API interface is a REST-style API interface.
9. A computer storage medium storing a computer program code, which, when executed on a computing device, causes the computing device to execute the solution for front-end private cloud deployment as described in any one of claims 1 to 4.
10. A computing device comprising: processor; a memory storing computer program code; When the computer program code is executed by the processor, it causes the computing device to execute the solution for front-end private cloud deployment as described in any one of claims 1-4.
