Platform and method for rapidly cloning software environment in cloud environment
Technical Field
The invention relates to the technical field of computers, in particular to a platform and a method for quickly cloning a software environment in a cloud environment.
Background
kuberntes, abbreviated K8s, is an abbreviation for 8 instead of 8 characters "ubernet". Is an open source for managing containerized applications on multiple hosts in a cloud platform, kubertes's goal is to make it simple and efficient to deploy containerized applications (powerful), which provides a mechanism for application deployment, planning, updating, and maintenance. Kuberttes has a one-to-one correspondence between system environments and applications to some extent, and achieves a high degree of consistency from the basic system and applications in testing, development, and production environments. Kuberttes offers the greatest advantage of multiplexing containers that can be cloned indefinitely into any environment by continually optimizing the containers to ultimately form a mirror image.
The internet develops and iterates fast, the architecture of the micro-service is popularized more and more to meet the complex application architecture scene, namely the application service is coupled with high cohesion and low cohesion, is divided into more and more thin parts, and realizes free combination and service arrangement, thereby constructing a service center station and a data center station, but simultaneously, the complex architecture design also brings the cost and complexity of an operation, maintenance and software release level, the traditional server, the virtual host and the cloud host can not support frequent micro-service release, the services required by general enterprise-level application are from dozens to hundreds, the process from code to release and operation by using the traditional mode is long, complex, configuration is easy to be wrong and low in efficiency, the operation and maintenance cost is increased in a positive proportion along with the increase of the order-of-magnitude application service, the delivery cycle is long and unrealistic, the operation and maintenance bottleneck of the complex architecture is realized, the invention firstly carries out the rapid cloning process of the order-of-magnitude application from the existing automatic deployment platform, therefore, the operation and maintenance investment of building a repeated new environment is eliminated.
Disclosure of Invention
The invention aims to provide a platform and a method for rapidly cloning a software environment in a cloud environment.
In order to achieve the technical purpose and achieve the technical effect, the invention discloses a platform for rapidly cloning a software environment in a cloud environment, which comprises a server, a control end partrol, a process execution end process and a plug-in end plug in based on a Kuberttes cloud environment, wherein the server is responsible for configuring a gitlab address, account information and an uploaded project initialization database script corresponding to a software project, constructing the software environment and issuing a rapid cloning request instruction to the control end partrol, and the control end partrol is responsible for realizing user interaction, and rapidly cloning a new namespace by copying configuration information of a namespace which is already deployed by kuberttes in an initialization database and calling the plug-in end plug in after receiving the project rapid cloning request instruction; and the software environment of the project is executed by calling the process execution end.
The Server is deployed with Gitlab, Docker, Maven, NodeJs, Registry, Kubertes, Matrics-Server, NFS and data MySQL services, the Kubertes have a unique application alias under the same namespace, the application alias is used as an environment variable, the configured project Gitlab address and an initialized database are used, the environment variable of the Docker is used between projects, and the application alias is used for replacing the fixed ip configuration of the original traditional mode, so that the mutual access between applications is stateless. That is, the automation platform binds the IP to a fixed application alias name as an environment variable each time an application is launched. The data exchange addresses between the applications all adopt fixed application aliases.
The plugin terminal plugin contains calls of Git, Maven, Docker, Kubertes, Nfs and Matrics-Server service api; and the plug-in terminal plugin captures the codes of the software project through the configured gitlab address by using Git api, compiles, packages, makes a mirror image, uploads the mirror image to a mirror image warehouse and releases the service to the cluster of Kubertes and Docker.
The process of the process execution end is responsible for capturing various processes from the codes of the software project to the release application and triggering the processes to be executed.
Preferably, the Gitlab is used for saving daily management, version iteration, branch management and code storage of the source code of the developer.
Preferably, Maven manages the dependency package relationship of java language, analyzes the third-party package dependency condition analysis of the source code, and stores and downloads the packages in the local warehouse, the third-party warehouse and the central warehouse.
Preferably, the Matrics-Server operates based on a Docker instance, collects CPU, memory, and hard disk data of a cluster service, and the MySQL service stores a source code address, application configuration information, mirror image data information, and resource allocation information.
A method for rapidly cloning a software environment in a cloud environment comprises the following specific steps:
s1: building a Server, and configuring services of Gitlab, Docker, Maven, NodeJs, Registry, Kuberttes, Matrics-Server, NFS and data MySQL;
s2: building a deployment control end control, a process execution end process and a plug-in end plugin;
s3: the server executes a fast cloning operation on namespaces deployed by existing kuberntes and issues a fast cloning request instruction to a control end control;
s4: after receiving the rapid cloning request instruction, the control end patrol copies the configuration information of the namespaces deployed by kuberntes in the initialization database, rapidly clones a new namespace containing third-party software for initializing the software environment, and calls the process execution end process to execute the software environment issue of the project by the control end patrol;
s5: the control end control uses third-party software of the initialized software environment by calling plug-in end plugin, and issues service to the clusters of Kubertes and Docker; and visually displayed on the control end control.
The plug-in end plugin captures the code of the software project to the local in S5, the Maven of the plug-in end plugin compiles and packages the code of the back-end language, the plug-in end plugin compiles the front-end class code by using npm of NodeJs, the Docker configuration of the plug-in end plugin references the mirror image of namespace in the initialization database without re-manufacturing the mirror image and uploads the mirror image to the mirror image warehouse, and the plug-in end plugin generates deployment and svc by using the existing configuration data of the user and Kubertes api to realize the automatic deployment of the software project resource.
The readable storage medium stores the platform of the rapid cloning software environment, and the platform of the rapid cloning software environment is used for realizing the steps of the method for rapidly cloning the software environment in the cloud environment.
The invention has the following beneficial effects:
1. according to the invention, the software project is redeployed with a set of software environment on the basis of the existing software deployment, the repeated operation is eliminated in the whole process, the operation and maintenance investment for building the repeated new environment is eliminated, and the investment cost of operation and maintenance personnel is reduced.
2. The invention shortens the delivery cycle from the project development, test and production stages by effectively utilizing software and hardware resources, promotes the efficiency of each environment of the software project so as to improve the project research and development cost, can release the order of magnitude service application, and can normally run the service, thereby supporting the order of magnitude application service release and operation and maintenance so as to solve the operation and maintenance bottleneck mentioned in the background technology.
3. The invention needs the following requirements in some scenes through transverse expansion and contraction: and the system has quick response such as access outbreak, application reduction, load peak period and the like, and greatly reduces the cost investment of the software life cycle.
Drawings
Fig. 1 is a schematic operation flow diagram of a method for rapidly cloning a software environment in a cloud environment according to the present invention;
fig. 2 is a schematic diagram of an execution flow of automatically deploying resources in the method for quickly cloning a software environment in a cloud environment according to 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 with reference to the following embodiments.
As shown in FIGS. 1-2, the invention discloses a platform and a method for rapidly cloning a software environment in a cloud environment, which redeployes a software environment from an existing software deployment basis for a software project, eliminates repeated operation in the whole process, eliminates operation and maintenance investment for building a repeated new environment, and reduces the investment cost of operation and maintenance personnel.
In order to achieve the technical purpose and achieve the technical effect, the invention discloses a platform for quickly cloning a software environment in a cloud environment. The method comprises a server, a control end server, a process execution end process and a plug-in end plug, wherein the server is responsible for configuring a gitlab address, account information and an uploaded project initialization database script corresponding to a software project, constructing a software environment, and issuing a rapid cloning request instruction to the control end server; and third-party software such as a database containing software application, ActiveMQ, Reids, MongoDB and the like is issued through a software environment for calling a process execution project of a process execution end.
The Server is deployed with Gitlab, Docker, Maven, NodeJs, Registry, Kubertes, Matrics-Server, NFS and data MySQL services, and by means of configured project Gitlab addresses and initialization databases, environment variables of Docker are used among projects, and application aliases are used for replacing fixed ip configuration in an original traditional mode, so that mutual access among applications is stateless. That is, the automation platform binds the IP to a fixed application alias name as an environment variable each time an application is launched. The data exchange addresses between the applications all adopt fixed application aliases. For example, a user center application $ { u-center }, a service application $ { business }, and then the service application needs to be connected with a user center permission interface to access $ { u-center.ip } constantly and is valued by an environment variable of kubertes, and the automation platform automatically assigns an environment variable value to the user center application $ { u-center }, the service application $ { business } and an ip address of actual application when a set of application deployment is newly established. In this way, the specific ip address of each application need not be a concern between applications, within a program, or at a configuration center. The development environment, the test environment and the production environment apply the mirror image package to keep the hash value of the file without any modification. Thus, almost no configuration modification is needed to support the rapid set-up of an environment and the rapid cloning.
Port resources under the ip of a master node of a kuberntes cluster are generated in advance, and the port resources are used for being distributed to the ip and the port of the svc service mapped out by all pod instances (including software services and third-party software) under a new clone namespace of the kuberntes; generating yaml file of deployment of kuberntes, configuring and referring to the existing mirror image of the original namespace, and calling kuberntes to execute without re-making the mirror image; and preferentially starting third-party software, such as a pod (pod) instance of the database, initializing the database initialization script to the database instance under the cloned namespace according to the copied configuration information, and realizing automatic initialization action.
The plugin terminal plugin contains the call of Git, Maven, Docker, Kubertes, Nfs and Matrics-Server service api; and the plug-in terminal plugin captures the codes of the software project through the configured gitlab address by using Git api, compiles, packages, makes a mirror image, uploads the mirror image to a mirror image warehouse and releases the service to the cluster of Kubertes and Docker. The method specifically comprises the following steps: the java language software realizes the automatic packaging of the software through the mvn package command of Apache Maven; after packaging, making the software package into a docker mirror image with a version number through the automatically generated Dockerfile, and push-sending the software package to a registry mirror warehouse; the pushed mirror image information is automatically generated into yaml file information of the default of kuberntes, and information of all kuberntes instances under the whole namespace is transmitted into yaml files of the default in an environment variable mode, so that software obtains actual ip addresses and ports of associated configuration information, the ip information configuration of a user is omitted, and the residual software applications default and svc are deployed.
The process of the flow execution end is responsible for capturing various flows of the software project to the release application and triggering the execution.
And the Gitlab is used for storing daily management, version iteration, branch management and code storage of the source code of the developer.
And the Maven manages the dependency package relation of java language, analyzes the third-party package dependency condition analysis of the source code and stores and downloads the packages of the local warehouse, the third-party warehouse and the central warehouse.
The method comprises the following steps that a Matrics-Server operates based on a Docker instance, collects CPU, memory and hard disk data of cluster service, and a MySQL service stores source code addresses, application configuration information, mirror image data information and resource allocation information; and monitoring the CPU, memory and hard disk load conditions of the used pod application instance under the namespace through the Metrics-Server.
A method for rapidly cloning a software environment in a cloud environment comprises the following specific steps:
s1: building a Server, and configuring services of Gitlab, Docker, Maven, NodeJs, Registry, Kuberttes, Matrics-Server, NFS and data MySQL;
s2: building a deployment control end control, a process execution end process and a plug-in end plugin;
s3: the server executes a fast cloning operation on namespaces deployed by existing kuberntes and issues a fast cloning request instruction to a control end control;
s4: after receiving the rapid cloning request instruction, the control end patrol copies the configuration information of the namespaces deployed by kuberntes in the initialization database, rapidly clones a new namespace containing third-party software for initializing the software environment, and calls the process execution end process to execute the software environment issue of the project by the control end patrol;
s5: the control end control uses third-party software of the initialized software environment by calling plug-in end plugin, and issues service to the clusters of Kubertes and Docker; and visually displayed on the control end control.
In the S5, the plug-in end plugin captures the code of the software project to the local, the Maven of the plug-in end plugin compiles and packages the code of the back-end language, the plug-in end plugin compiles the front-end class code by using npm of NodeJs, the Docker configuration of the plug-in end plugin references the mirror image of namespace existing in the initialization database without re-making the mirror image and uploads the mirror image to the mirror image warehouse, and the plug-in end plugin utilizes the existing configuration data of the user and Kubertes api to generate deployment and svc to realize the automatic deployment of the software project resource.
The readable storage medium stores the platform of the rapid cloning software environment, and the platform of the rapid cloning software environment is used for realizing the steps of the method for rapidly cloning the software environment in the cloud environment.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention.