CN115185550A - Service deployment method, device, computer equipment and storage medium - Google Patents
Service deployment method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN115185550A CN115185550A CN202210817535.2A CN202210817535A CN115185550A CN 115185550 A CN115185550 A CN 115185550A CN 202210817535 A CN202210817535 A CN 202210817535A CN 115185550 A CN115185550 A CN 115185550A
- Authority
- CN
- China
- Prior art keywords
- service
- parameters
- configuration file
- parameter
- template
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/61—Installation
- G06F8/63—Image based installation; Cloning; Build to order
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a service deployment method, a service deployment device, computer equipment and a storage medium, wherein the method comprises the steps of extracting a first configuration file of a target server from a server cluster in the current environment; the first configuration file comprises standard parameters and variable parameters; acquiring service parameters of a target server corresponding to a target environment; correspondingly replacing the variable parameters with the service parameters to generate a second configuration file; acquiring a basic template corresponding to the target server, and loading a second configuration file to the basic template; and generating a service template based on the basic template, and deploying the service in the target environment through the service template. In the embodiment, the service parameters and the variable parameters are replaced or changed before the basic template is built, so that the service corresponding to the second configuration file can normally run when being directly deployed in the target environment, and further, the template does not need to be modified and maintained when service deployment or service upgrade is conducted in different environments.
Description
Technical Field
The present invention relates to the technical field of service deployment, and in particular, to a service deployment method and apparatus, a computer device, and a storage medium.
Background
In the prior art, application or service deployment can be performed through an installation package by using a script, but operation management depends on a physical host or a virtual host, all life cycles of system operation, configuration, management and the like in the mode are bound with a current operating system, and upgrading, updating, rollback and other operations of the application are not facilitated. Secondly, the application or service deployment can also be performed containerization deployment through a kubernets (K8 s) technology, but the traditional K8s service template is usually created and managed by taking the application or service as a unit, if the parameters of the service template are changed, if part of parameters of the same application or service in different environments are possibly different, parameters such as 'host.name' and 'log.dirs' in different environments are different for the kafaka middleware, or if the service template is upgraded, if the versions of the application or service in different environments are different, if the development environment is a low version and the test environment is a high version, the service template needs to be modified and maintained, and the deployment or upgrade is time-consuming and labor-consuming and influences the environment.
Disclosure of Invention
The invention aims to provide a service deployment method, a service deployment device, computer equipment and a storage medium, which are used for solving the problems in the prior art.
In order to achieve the above object, the present invention provides a service deployment method, including:
determining a server cluster of a current environment;
extracting a first configuration file of a target server from the server cluster; the first configuration file comprises standard parameters and variable parameters;
acquiring service parameters of the target server corresponding to a target environment;
replacing the variable parameters correspondingly with service parameters to generate a second configuration file;
acquiring a basic template corresponding to the target server, and loading the second configuration file to the basic template;
and generating a service template based on the basic template, and deploying the service in the target environment through the service template.
Further preferably, the extracting a first configuration file of a target server from the server cluster; the first configuration file comprises standard parameters and variable parameters, and comprises the following steps:
identifying a category identification of the first profile;
and correspondingly acquiring standard parameters and variable parameters of the first configuration file based on the category identification.
Further preferably, the obtaining, by the corresponding target environment, the service parameter of the target server includes:
inquiring a mirror image warehouse corresponding to the target server in the target environment;
and acquiring corresponding service parameters from the mirror image warehouse.
Further preferably, the replacing the variable parameter into a service parameter correspondingly to generate a second configuration file includes:
respectively extracting a first proxy name and a second proxy name of the variable parameter and the service parameter based on a JAVA reflection mechanism;
and correspondingly replacing the variable parameter with a service parameter based on the matching relation between the first proxy class name and the second proxy class name.
Further preferably, the extracting the first proxy class name and the second proxy class name of the variable parameter and the service parameter respectively based on the JAVA reflection mechanism includes:
acquiring a character string of the variable parameter or the service parameter;
constructing a corresponding abstract syntax tree according to the character string, traversing the abstract syntax tree in a breadth mode by using a syntax parser, and creating a model file based on nodes of the abstract syntax tree;
converting the model file into an initial byte code file;
and loading the initial byte code file into a preset virtual machine through a class loader to obtain a first proxy class name or a second proxy class name corresponding to the standard parameter or the service parameter.
Further preferably, the converting the model file into an initial bytecode file includes:
and setting the model file as a source code file, and calling a preset compiler to compile the source code file into the initial byte code file.
Further preferably, the obtaining a basic template corresponding to the target server includes:
acquiring the type information of the target server;
and inquiring a basic template corresponding to the target server from a relation corresponding table based on the type information, wherein the relation corresponding table stores the corresponding relation of each type information and the basic model corresponding to each type information in advance.
To achieve the above object, the present invention further provides a service deployment apparatus, including:
the determining module is used for determining the server cluster of the current environment;
the extraction module is used for extracting a first configuration file of a target server from the server cluster; the first configuration file comprises standard parameters and variable parameters;
the acquisition module is used for acquiring the service parameters of the target server corresponding to the target environment;
the replacing module is used for correspondingly replacing the variable parameters with service parameters to generate a second configuration file;
the loading module is used for acquiring a basic template corresponding to the target server and loading the second configuration file to the basic template;
and the deployment module is used for generating a service template based on the basic template and deploying the service in the target environment through the service template.
To achieve the above object, the present invention also provides a computer device, comprising:
a memory storing at least a computer program; and
a processor executing the computer program stored in the memory to implement the service deployment method of any of the above.
To achieve the above object, the present invention further provides a computer-readable storage medium storing a computer program, which when executed by a processor, implements the service deployment method described in any one of the above.
The beneficial effects of the above technical scheme are that:
according to the service deployment method, the service deployment device, the computer equipment and the storage medium, the server cluster of the current environment is determined, and the first configuration file of the target server is extracted from the server cluster; the first configuration file comprises standard parameters and variable parameters; acquiring service parameters of the target server corresponding to a target environment; replacing the variable parameters correspondingly with service parameters to generate a second configuration file; acquiring a basic template corresponding to the target server, and loading the second configuration file to the basic template; and generating a service template based on the basic template, and deploying the service in the target environment through the service template. In the embodiment, the service parameters and the variable parameters are replaced or changed before the basic template is built, so that the service corresponding to the second configuration file can normally run when being directly deployed in the target environment, the templates are not required to be modified and maintained when service deployment or service upgrade is performed in different environments, and the service templates can be deployed or upgraded by directly using one or more basic templates loaded with the second configuration file to generate the service templates.
Drawings
FIG. 1 is a flowchart illustrating a service deployment method according to an embodiment of the present invention;
FIG. 2 is a functional block diagram of a second service deployment apparatus according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a computer device of a three-service deployment method according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the embodiments described herein are only for the purpose of illustrating the present invention and are not to be construed as limiting the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
As shown in fig. 1, which is a flowchart illustrating a service deployment method according to an embodiment of the present invention, it can be seen that the method includes steps S100-S600, which are specifically as follows:
s100: a cluster of servers of a current environment is determined.
In an exemplary embodiment, a server cluster is a system connected by a plurality of node servers, and during a process of developing a service (e.g., new software and new functions), different stages of development, testing, production, and the like need to be performed, each stage is generally based on a different environment, and a combination of servers used in different environments forms a server cluster corresponding to the service. The current environment can be used for representing the environment where the service history to be deployed is located, and if the service A needs to be deployed into the test environment from the development environment, the development environment serves as the current environment of the service A; or the current environment can also be used for representing the environment where the service to be upgraded is located, if the service B in the test environment needs to be upgraded, the test environment is used as the current environment of the service B.
S200: extracting a first configuration file of a target server from the server cluster; the first configuration file includes standard parameters and variable parameters.
In an exemplary embodiment, a server cluster in the current environment generally includes a plurality of sub servers, where different servers may be used to represent services with different functions, for example, a server of a drive system is used to drive a service, a server of a memory is used to serve a memory service, middleware, an installation package, and the like, and the server is used to serve a corresponding function, or it may be understood that the above-mentioned service is used to represent a configuration that may be used when a program is running, and the configuration that may be used when the program is running is preset by a developer or set according to characteristics of the program. For example: aiming at the game program, a server provided with drive systems such as DirectX, netFreamwork and the like can be set to normally run; the log processing program may be configured such that a server installed with middleware such as kafka can normally operate.
Further, one or more sub-servers may be designated as target servers from the server cluster by a developer in advance, or one or more sub-servers may be selected as target servers from the server cluster based on the environment to be deployed or the service to be upgraded. If the service required by the environment to be deployed comprises A, B and C, the server corresponding to A, B and C is correspondingly selected from the current environment to be used as the target server, and if the service to be upgraded is D, the server corresponding to D is correspondingly selected from the current environment to be used as the target server.
And acquiring a first configuration file corresponding to the target server based on the selected target server, wherein the first configuration file comprises a standard parameter and a variable parameter. The first configuration file is used for representing various configuration parameters including a corresponding target server, for example, the kafaka middleware is taken as an example, and the configuration parameters of the kafaka middleware are configuration specific parameter values such as 'host.name', 'log.dirs', 'zookeeper.connect', and the like.
The method includes the steps that standard parameters and variable parameters can be determined based on a current environment and an environment to be deployed, for example, the standard parameters are used for representing the same configuration parameters of the same service deployed in different environments, the variable parameters are used for representing different configuration parameters of the same service deployed in different environments, kafaka middleware is taken as an example, the configuration parameters representing host addresses, log.dirs representing data storage addresses and zookeeper connection character strings are variable parameters, the configuration parameters representing host addresses, log.dirs and zookeeper.connect are different in parameter value when deployed in different environments, the configuration parameters representing service ports, maximum thread numbers representing network processing messages, thread.threads and the like representing IO thread numbers are different in parameter values, and the configuration parameters representing network deployment messages, thread.metadata, and the like are different in parameter values. Or it can be understood that when the configuration parameters are deployed in different environments, the parameter values should be the same and represent that the parameter values have influence on the program operation, and if the configuration parameters are different, the representation of the parameter values has no influence on the program; it can also be understood that when the service a is deployed in the environment 1 and the environment 2, respectively, then the standard parameter is used to characterize the same parameter value of the service a in the environment 1 and the environment 2, and the variable parameter is used to characterize the different parameter value of the service a in the environment 1 and the environment 2.
It should be noted that, in the above example, the explanation is performed based on service deployment in different environments, and in addition, the standard parameter and the variable parameter may also be determined based on a service to be upgraded and an upgraded service in the same environment, and if it can be understood that the service a is upgraded to the service B in the same environment, the standard parameter is used to represent the same parameter value of the service a and the service B, and the variable parameter is used to represent different parameter values of the service a and the service B.
Preferably, the class attribute corresponding to each first configuration file is used as a class identifier of the first configuration file and loaded into the first configuration file, for example, the class attribute may include a drive system, a memory, a middleware, and the like, the configuration parameter of the drive system generates a first configuration file corresponding to a class of the drive system, the configuration parameter of the memory generates a first configuration file corresponding to a class of the memory, and the configuration parameter of each middleware generates a first configuration file corresponding to each middleware, that is, the first configuration file of the drive system carries the class identifier of the drive system, and the first configuration file of the middleware carries the class identifier of the middleware and the like.
In an exemplary embodiment, a category identifier of the first configuration file is identified, and the standard parameter and the variable parameter of the first configuration file are correspondingly obtained based on the category identifier. The configuration parameters of the first configuration files identified by different categories are different, that is, the standard parameters and the variable parameters of the first configuration files identified by different categories are also different, for example: and the standard parameters and the variable parameters of the first configuration file of the class identification of the driving system and the standard parameters and the variable parameters of the first configuration file of the class identification of the middleware. Preferably, the corresponding relations between the standard parameters and the variable parameters corresponding to the plurality of category identifiers and the plurality of category identifiers are pre-stored in a configuration relation table, and after the first configuration file is obtained, the standard parameters and the variable parameters corresponding to the category identifiers can be extracted from the configuration relation table by identifying the category identifiers in the first configuration file, so that which configuration parameters are the same when the corresponding program runs and which configuration parameters are different are determined. The configuration parameters are preset by developers in the same or different manners, or may be set based on different environment attributes or different upgrade information, which is not particularly limited.
S300: and acquiring the service parameters of the target server corresponding to the target environment.
In an exemplary embodiment, for service deployment in different environments, a target environment is used for representing an environment to be deployed of a service, and if a service a needs to be deployed from a development environment to a test environment, the development environment serves as a current environment of the service a, and the test environment serves as a target environment of the service a; if the service B in the test environment needs to be upgraded, the test environment is used as the current environment and the target environment of the service B; in addition, when one service is upgraded when deployed in different environments, the target environment and the current environment are determined in a service deployment mode aiming at the different environments.
Further, a mirror image warehouse corresponding to the target server in the target environment is inquired, and corresponding service parameters are obtained from the mirror image warehouse. Each server or terminal has a corresponding mirror image warehouse, for example, a private mobile terminal has a private mirror image warehouse, a local server has a local mirror image warehouse, a remote server has a remote mirror image warehouse, and a public mirror image warehouse is located at the network cloud. Each mirror repository has a container which is preferred as a processing object by default, the container is called a primary container, a backup container corresponding to the primary container is called a secondary container, the mirror is stored in the primary container and the secondary container, and the primary container and the service container originate from the mirror repository. It can be understood that, the image repository stores the backup server (image) of the same version corresponding to the target server or the backup server (image) of other upgraded or downgraded version, and when a service needs to be upgraded or downgraded when deployed in different environments, the image of the corresponding upgraded or downgraded version can be selected from the corresponding image repository based on the environmental characteristics of the target environment, and the service parameters can be obtained from the image. The description is made specifically. The selection of the corresponding upgraded or downgraded image in the repository can be specified in advance by a developer, or the selection can be performed based on the characteristics of the target environment, if the target environment can only use the upgraded target server, the upgraded image is selected correspondingly. The service parameter corresponds to a variable parameter, the variable parameter is used for representing which parameters of the service to be deployed or the service to be upgraded need to be changed, and the service parameter can be understood as the parameter after the variable parameter is changed. If 1 is changed to 2, the variable parameter is 1 and the service parameter is 2.
S400: and replacing the variable parameters correspondingly with service parameters to generate a second configuration file.
In an exemplary embodiment, the variable parameter is replaced by the service parameter correspondingly to generate a second configuration file, so that the service to be deployed or upgraded is deployed or upgraded in the target environment by using the second configuration file, and it is further ensured that the service deployed in the target environment can operate normally or the service upgraded in the target environment can operate normally.
Specifically, a first proxy name and a second proxy name of the variable parameter and the service parameter are respectively extracted based on a JAVA reflection mechanism, and the variable parameter is correspondingly replaced with the service parameter based on a matching relationship between the first proxy name and the second proxy name. Respectively extracting a first proxy name and a second proxy name of the variable parameter and the service parameter based on a JAVA reflection mechanism, wherein the first proxy name and the second proxy name can be obtained by acquiring a character string of the variable parameter or the service parameter; constructing a corresponding abstract syntax tree according to the character string, traversing the abstract syntax tree in a breadth mode by using a syntax parser, and creating a model file based on the nodes of the abstract syntax tree; setting the model file as a source code file, and calling a preset compiler to compile the source code file into the initial byte code file; and loading the initial byte code file into a preset virtual machine through a class loader to obtain a first proxy class name or a second proxy class name corresponding to the standard parameter or the service parameter. The preset compiler is a JAVAC compilation tool, the initial bytecode file is a class file, the virtual machine is a JAVA virtual machine, and the class loaders include a boot (boottrap) class loader, an Extension (Extension) class loader, a System (System) class loader (also referred to as an application class loader), and a Custom (Custom) class loader, which are not limited herein. It can be understood that the proxy class names are used for representing type names of the parameters, and variable parameters and service parameters of the same type names can be correspondingly replaced by matching the first proxy class name with the second proxy class name.
S500: and acquiring a basic template corresponding to the target server, and loading the second configuration file to the basic template.
In an exemplary embodiment, the type information of the target server is obtained, where the type information is used to characterize the type of an application service, such as stateful set, stateless application, deployment, daemon daemoset, and a basic template corresponding to the target server is queried from a relationship correspondence table based on the type information, where the relationship correspondence table stores in advance the correspondence between each type information and a basic model corresponding to each type information. Preferably, the basic template can be in a hellm template format, the hellm template can write Go template language in Go template language, the value of the template is recorded in a values.
S600: and generating a service template based on the basic template, and deploying the service in the target environment through the service template.
In an exemplary embodiment, one service corresponds to one basic template, the basic template in the format of one or more hellm templates is obtained based on one or more services required by a target environment, and the one or more basic templates are integrated and packaged into one service template, which can be understood as a service template used for characterizing a kubernets (K8 s) cluster, and the deployment of batch services or single services can be performed through the service template. In the embodiment, before the basic template is built, the service parameters and the variable parameters are replaced or changed mutually, so that the service corresponding to the second configuration file can be normally operated when being directly deployed in the target environment, the first configuration file can be understood as configuration parameters required by normal operation of the service in the current environment, the second configuration file is configuration parameters required by normal operation of the service in the target environment, the templates are not required to be modified and maintained for service deployment or service upgrade in different environments, the service templates can be directly generated by using one or more basic templates loaded with the second configuration file for deployment or upgrade, the variable parameters and the service parameters of the same service deployment in the target environment different from the current environment are ensured to be changed, the normal operation of the service in different environments is further ensured, or the variable parameters and the service parameters are changed after the service upgrade in the same environment, and the normal operation after the service upgrade is further ensured.
Example two
Fig. 2 is a functional block diagram of a service deployment apparatus according to a second embodiment.
The service deployment device 3 includes a determination module 31, an extraction module 32, an acquisition module 33, a replacement module 34, a loading module 35, and a deployment module 36. The module referred to herein is a series of computer program segments stored in a memory that can be executed by a processor and that can perform a fixed function. In the present embodiment, the functions of the modules will be described in detail in the following embodiments.
The determining module 31 is used for determining the server cluster of the current environment.
The extracting module 32 is configured to extract a first configuration file of a target server from the server cluster; the first configuration file includes standard parameters and variable parameters.
In an exemplary embodiment, a category identifier of the first configuration file is identified, and a standard parameter and a variable parameter of the first configuration file are obtained correspondingly based on the category identifier.
The obtaining module 33 is configured to obtain the service parameter of the target server corresponding to the target environment.
In an exemplary embodiment, a mirror repository corresponding to the target server in the target environment is queried; and acquiring corresponding service parameters from the mirror image warehouse.
The replacing module 34 is configured to replace the variable parameter with a service parameter correspondingly to generate a second configuration file.
In an exemplary embodiment, a character string of the variable parameter or the service parameter is obtained; constructing a corresponding abstract syntax tree according to the character string, traversing the abstract syntax tree in a breadth mode by using a syntax parser, and creating a model file based on the nodes of the abstract syntax tree; setting the model file as a source code file, and calling a preset compiler to compile the source code file into the initial byte code file; loading the initial byte code file into a preset virtual machine through a class loader to obtain a first proxy class name or a second proxy class name corresponding to the standard parameter or the service parameter; and correspondingly replacing the variable parameter with a service parameter based on the matching relation between the first proxy class name and the second proxy class name.
The loading module 35 is configured to obtain a basic template corresponding to the target server, and load the second configuration file to the basic template.
In an exemplary embodiment, type information of the target server is obtained; and inquiring a basic template corresponding to the target server from a relation corresponding table based on the type information, wherein the relation corresponding table stores the corresponding relation of each type information and the basic model corresponding to each type information in advance.
The deployment module 36 is configured to generate a service template based on the basic template, and perform service deployment in the target environment through the service template.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a computer device of the three-service deployment method according to this embodiment.
In the exemplary embodiment, computer device 4 includes, but is not limited to, a memory 41, a processor 42, and a computer program, such as a service deployment program, stored in memory 41 and executable on the processor. Those skilled in the art will appreciate that the depicted diagram is merely an example of a computing device and is not meant to be limiting and that the depicted diagram may include more or fewer components than those shown, or some components may be combined, or different components, e.g., the computing device may also include input output devices, network access devices, buses, etc.
The memory 41 includes at least one type of computer-readable storage medium including flash memory, hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), random Access Memory (RAM), static Random Access Memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks, etc. In some embodiments, the memory 41 may be an internal storage module of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the memory 41 may be an external storage device of a computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device. Of course, the memory 41 may also include both internal and external memory modules of the computer device. In this embodiment, the memory 41 is generally used for storing an operating system and various types of application software installed in the computer device. Further, the memory 41 may also be used to temporarily store various types of data that have been output or are to be output.
The Processor 42 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. The processor 42 is an operation core and a control center of the computer device, and is connected to each part of the whole computer device by various interfaces and lines, and executes an operating system of the computer device and various installed application programs, program codes, and the like.
The processor 42 executes the operating system of the computer device as well as various applications installed. The processor 42 executes the application program to implement the steps in the various service deployment method embodiments described above, such as steps S100-S600 shown in fig. 1.
Example four
The present embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, which when executed by a processor implements corresponding functions. The computer readable storage medium of this embodiment is used for storing a computer program for implementing the service deployment method, and when executed by the processor 42, implements the service deployment method of one, two or three embodiments.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a component of' 8230; \8230;" does not exclude the presence of another like element in a process, method, article, or apparatus that comprises the element.
The application is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and all equivalent structures or equivalent processes performed by the present invention or directly or indirectly applied to other related technical fields are also included in the scope of the present invention.
Claims (10)
1. A method for service deployment, comprising:
determining a server cluster of a current environment;
extracting a first configuration file of a target server from the server cluster; the first configuration file comprises standard parameters and variable parameters;
acquiring service parameters of the target server corresponding to a target environment;
replacing the variable parameters correspondingly with service parameters to generate a second configuration file;
acquiring a basic template corresponding to the target server, and loading the second configuration file to the basic template;
and generating a service template based on the basic template, and deploying the service in the target environment through the service template.
2. The service deployment method of claim 1, wherein the extracting a first configuration file of a target server from the server cluster; the first configuration file comprises standard parameters and variable parameters, and comprises the following steps:
identifying a category identification of the first profile;
and correspondingly acquiring standard parameters and variable parameters of the first configuration file based on the category identification.
3. The service deployment method according to claim 1, wherein the acquiring the service parameter of the target server according to the corresponding target environment includes:
inquiring a mirror image warehouse corresponding to the target server in the target environment;
and acquiring corresponding service parameters from the mirror image warehouse.
4. The service deployment method according to claim 1, wherein the replacing the variable parameter correspondence with a service parameter to generate a second configuration file comprises:
respectively extracting a first proxy class name and a second proxy class name of the variable parameter and the service parameter based on a JAVA reflection mechanism;
and correspondingly replacing the variable parameter with a service parameter based on the matching relation between the first proxy class name and the second proxy class name.
5. The service deployment method according to claim 4, wherein the extracting the first proxy class name and the second proxy class name of the variable parameter and the service parameter respectively based on the JAVA reflection mechanism comprises:
acquiring the character string of the variable parameter or the service parameter;
constructing a corresponding abstract syntax tree according to the character string, traversing the abstract syntax tree in a breadth mode by using a syntax parser, and creating a model file based on the nodes of the abstract syntax tree;
converting the model file into an initial byte code file;
and loading the initial byte code file into a preset virtual machine through a class loader to obtain a first proxy class name or a second proxy class name corresponding to the standard parameter or the service parameter.
6. The service deployment method of claim 5, wherein the converting the model file into an initial byte code file comprises:
and setting the model file as a source code file, and calling a preset compiler to compile the source code file into the initial byte code file.
7. The service deployment method according to claim 1, wherein the obtaining of the basic template corresponding to the target server includes:
acquiring type information of the target server;
and inquiring a basic template corresponding to the target server from a relation corresponding table based on the type information, wherein the relation corresponding table stores the corresponding relation of each type information and the basic model corresponding to each type information in advance.
8. A service deployment apparatus, comprising:
the determining module is used for determining the server cluster of the current environment;
the extraction module is used for extracting a first configuration file of a target server from the server cluster; the first configuration file comprises standard parameters and variable parameters;
the acquisition module is used for acquiring the service parameters of the target server corresponding to the target environment;
the replacing module is used for correspondingly replacing the variable parameters with the service parameters to generate a second configuration file;
the loading module is used for acquiring a basic template corresponding to the target server and loading the second configuration file to the basic template;
and the deployment module is used for generating a service template based on the basic template and deploying the service in the target environment through the service template.
9. A computer device, comprising:
a memory storing at least a computer program; and
a processor executing a computer program stored in the memory to implement the service deployment method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, characterized in that the computer program is executed by a processor to implement the service deployment method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210817535.2A CN115185550A (en) | 2022-07-12 | 2022-07-12 | Service deployment method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210817535.2A CN115185550A (en) | 2022-07-12 | 2022-07-12 | Service deployment method, device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115185550A true CN115185550A (en) | 2022-10-14 |
Family
ID=83516525
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210817535.2A Pending CN115185550A (en) | 2022-07-12 | 2022-07-12 | Service deployment method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115185550A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115580646A (en) * | 2022-09-08 | 2023-01-06 | 中国建设银行股份有限公司 | Middleware configuration method, device, server, medium and product |
CN116260860A (en) * | 2022-12-09 | 2023-06-13 | 深圳前海环融联易信息科技服务有限公司 | Application deployment method and device, storage medium and electronic equipment |
CN116389324A (en) * | 2023-06-07 | 2023-07-04 | 深圳市东信时代信息技术有限公司 | Cloud server management method, device, equipment and storage medium |
CN117992115A (en) * | 2024-04-02 | 2024-05-07 | 建信金融科技有限责任公司 | System configuration processing method, device, equipment, medium and program product |
CN118132539A (en) * | 2024-05-08 | 2024-06-04 | 山东浪潮数字商业科技有限公司 | Method, equipment and medium for dynamically configuring database based on environment variables |
-
2022
- 2022-07-12 CN CN202210817535.2A patent/CN115185550A/en active Pending
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115580646A (en) * | 2022-09-08 | 2023-01-06 | 中国建设银行股份有限公司 | Middleware configuration method, device, server, medium and product |
CN116260860A (en) * | 2022-12-09 | 2023-06-13 | 深圳前海环融联易信息科技服务有限公司 | Application deployment method and device, storage medium and electronic equipment |
CN116389324A (en) * | 2023-06-07 | 2023-07-04 | 深圳市东信时代信息技术有限公司 | Cloud server management method, device, equipment and storage medium |
CN116389324B (en) * | 2023-06-07 | 2023-09-29 | 深圳市东信时代信息技术有限公司 | Cloud server management method, device, equipment and storage medium |
CN117992115A (en) * | 2024-04-02 | 2024-05-07 | 建信金融科技有限责任公司 | System configuration processing method, device, equipment, medium and program product |
CN118132539A (en) * | 2024-05-08 | 2024-06-04 | 山东浪潮数字商业科技有限公司 | Method, equipment and medium for dynamically configuring database based on environment variables |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115185550A (en) | Service deployment method, device, computer equipment and storage medium | |
US5617533A (en) | System and method for determining whether a software package conforms to packaging rules and requirements | |
US7684964B2 (en) | Model and system state synchronization | |
CN111399853A (en) | Templated deployment method of machine learning model and custom operator | |
CN109032631B (en) | Application program patch package obtaining method and device, computer equipment and storage medium | |
US20220198003A1 (en) | Detecting added functionality in open source package | |
CN112394942A (en) | Distributed software development compiling method and software development platform based on cloud computing | |
CN111367510A (en) | Android function module development method and device | |
CN112764753A (en) | Project deployment method and device, electronic equipment and storage medium | |
US10866803B2 (en) | Generating interaction libraries | |
CN114661423A (en) | Cluster configuration detection method and device, computer equipment and storage medium | |
CN113238795A (en) | Component distribution method, device, electronic equipment, storage medium and program product | |
CN113330419A (en) | Equipment application installation method and device | |
CN111309332A (en) | File content on-demand loading method and device, electronic equipment and storage medium | |
Brada et al. | Practical verification of component substitutability using subtype relation | |
CN111562907A (en) | Conversion method and system of user-defined interface data | |
US9396239B2 (en) | Compiling method, storage medium and compiling apparatus | |
US7487227B2 (en) | Scripting engine having a sequencer table and a plurality of secondary tables for network communication software | |
CN115794214A (en) | Application module metadata management method, device, storage medium and device | |
CN113296854B (en) | Data loading method and system, electronic equipment and storage medium | |
CN114356379A (en) | Backup-based service upgrading method, device, equipment and storage medium | |
JP6705482B2 (en) | System construction parameter management device, system construction parameter management system, system construction parameter management method, and system construction parameter management program | |
CN115167862A (en) | Patch method and related equipment | |
CN112148301A (en) | Method, system and storage medium for integrated production of customized version of non-compiled Android system | |
CN112925523A (en) | Object comparison method, device, equipment and computer readable medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |