CN118012442A - Program deployment method, program deployment device, computer program product and electronic equipment - Google Patents

Program deployment method, program deployment device, computer program product and electronic equipment Download PDF

Info

Publication number
CN118012442A
CN118012442A CN202410181510.7A CN202410181510A CN118012442A CN 118012442 A CN118012442 A CN 118012442A CN 202410181510 A CN202410181510 A CN 202410181510A CN 118012442 A CN118012442 A CN 118012442A
Authority
CN
China
Prior art keywords
program
application program
deployment
target
initial application
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
Application number
CN202410181510.7A
Other languages
Chinese (zh)
Inventor
李俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sweet Orange Finance Leasing Shanghai Co ltd
Original Assignee
Sweet Orange Finance Leasing Shanghai Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Sweet Orange Finance Leasing Shanghai Co ltd filed Critical Sweet Orange Finance Leasing Shanghai Co ltd
Priority to CN202410181510.7A priority Critical patent/CN118012442A/en
Publication of CN118012442A publication Critical patent/CN118012442A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses a program deployment method, a program deployment device, a computer program product and electronic equipment. Wherein the method comprises the following steps: detecting program variation of the initial application program to obtain a detection result of the initial application program; determining a target application program to be deployed under the condition that the detection result indicates that program variation exists; based on the initial application program, the deployment processing of the target application program is executed in a hot deployment mode. The invention solves the technical problem that the application restarting time is not ideal due to program variation in the related technology.

Description

Program deployment method, program deployment device, computer program product and electronic equipment
Technical Field
The present invention relates to the field of computer technology and the field of software development technology, and in particular, to a program deployment method, apparatus, computer program product, and electronic device.
Background
Currently, when developing an application, part of the test environment needs to be built locally. However, there are many limitations to local testing, such as insufficient hardware performance or network environment, and there may be a database mismatch between the local testing environment and the integrated testing environment. Therefore, most programs are deployed on a remote server, and a lot of time is required to upload the application program to the remote server for testing, which brings inconvenience to the developer. Even if the application program has a small change, the application program needs to be restarted, so that the time-consuming time of repeated start and stop is long, and the research and development efficiency is greatly influenced.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a program deployment method, a program deployment device, a computer program product and electronic equipment, which at least solve the technical problem that the restarting time of an application is not ideal due to program variation in the related technology.
According to an aspect of the embodiment of the present invention, there is provided a program deployment method, including: detecting program variation of an initial application program to obtain a detection result of the initial application program; determining a target application program to be deployed under the condition that the detection result indicates that program variation exists; and executing the deployment processing of the target application program by adopting a hot deployment mode based on the initial application program.
Optionally, the performing, based on the initial application, a deployment process of the target application in a hot deployment manner includes: determining an initial byte code of the initial application program; processing the initial byte code by adopting a byte code operation mode to obtain a target byte code matched with the target application program; and executing the deployment processing of the target application program by adopting the hot deployment mode based on the target byte code.
Optionally, the performing, based on the target bytecode, the deployment process of the target application program by adopting the hot deployment mode includes: loading the target byte codes by using a class loader to generate target classes; determining an initial class of the initial application program; and redefining the initial class by adopting the target class, and executing the deployment processing of the target application program as the hot deployment mode.
Optionally, the initial application program is deployed on a cloud platform, and the detecting the program variation of the initial application program to obtain a detection result of the initial application program includes: and responding to the starting of the initial application program, starting program change detection of the initial application program, and determining that the detection result is that the initial application program has program change under the condition that the file included in a preset catalog is detected to be updated, wherein the preset catalog is an installation catalog of the initial application program on the cloud platform.
Optionally, before the detecting the program change of the initial application program, the method further includes: packaging a preset local file by adopting a preset packaging format to obtain a file package, wherein the preset local file is packaged by adopting a preset packaging format; and uploading the file package to a preset catalog of a cloud platform, and executing deployment processing of the initial application program on the cloud platform.
Optionally, the initial application program and the target application program are both deployed on a cloud platform, where the initial application program and the target application program are programs with different application versions, and the method further includes: determining a first virtual environment resource allocated to the initial application program by the cloud platform and a second virtual environment resource allocated to the target application program; and running the initial application program by adopting the first virtual environment resource, and running the target application program by adopting the second virtual environment resource in parallel.
Optionally, the method further comprises: responding to a program screening instruction of a human-computer interaction interface, and determining the type of a target program to be detected; the initial application matching the target program type is determined among a predetermined plurality of candidate applications.
According to another aspect of the embodiment of the present invention, there is provided a program deployment apparatus including: the change detection module is used for detecting program change of the initial application program to obtain a detection result of the initial application program; the target application program determining module is used for determining a target application program to be deployed under the condition that the detection result indicates that the program variation exists; and the hot deployment execution module is used for executing the deployment processing of the target application program in a hot deployment mode based on the initial application program.
According to another aspect of embodiments of the present invention, there is provided a computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the program deployment method.
According to another aspect of an embodiment of the present invention, there is provided an electronic apparatus including: one or more processors and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the program deployment method of any of the claims.
In the embodiment of the invention, a program hot deployment mode is adopted, and the detection result of the initial application program is obtained by detecting the program variation of the initial application program; determining a target application program to be deployed under the condition that the detection result indicates that program variation exists; and executing the deployment processing of the target application program by adopting a hot deployment mode based on the initial application program. The method achieves the purposes of automatically detecting program change and performing program hot deployment in a non-stop state, achieves the technical effects of reducing program modification process and improving application deployment efficiency, and further solves the technical problem that application restarting is not ideal due to program change in the related technology.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a flow chart of an alternative program deployment method provided in accordance with an embodiment of the present invention;
FIG. 2 is a schematic diagram of an alternative program deployment method provided in accordance with an embodiment of the present invention;
Fig. 3 is a schematic diagram of an alternative program deployment apparatus according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of description, the following will describe some terms or terminology involved in the embodiments of the present application:
the code cloud platform refers to an infrastructure and a platform for providing cloud computing services, and can be accessed and managed remotely through a network. Various resources and services, such as computing, storage, networking, databases, etc., are provided to support the development, deployment, and management of applications.
The Agent technology is positioned at the edge of an SRV6 SFC (Segment Routing for IPv 6) service chain ((SERVICE CHAIN, SC) network and is a source node of a service chain path, the SC can adopt different drainage modes to introduce service data into an SRV6 TE Policy (Segment Routing TRAFFIC ENGINEERING Policy) tunnel for forwarding, the SRv TE Policy is a traffic engineering strategy, and an ordered instruction list (path information) is packaged at a head node to guide a message to traverse the network so as to meet the end-to-end requirement of the service.
Hot deployment refers to dynamically replacing or updating some or all of the code, resources, or configuration of an application without stopping and restarting the application in the event that the application is running. In a cloud platform-based Java (a programming language) hot deployment system, the hot deployment functionality allows developers to implement incremental updating and debugging of code without stopping the application.
Currently, when developing applications (e.g., java), some test environments need to be built locally. However, there are many limitations to local testing, such as hardware performance, network environment inadequacies, or database differences, which can cause the test results to be inconsistent with the actual deployment environment, thereby affecting the quality and performance of the application. Meanwhile, the process of uploading the application program to a remote server for testing is tedious and time-consuming, and especially under the condition of long application starting time, the research and development efficiency can be obviously affected.
In view of the foregoing, embodiments of the present invention provide a method embodiment for program deployment, it should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order other than that illustrated herein.
Fig. 1 is a flowchart of a program deployment method according to an embodiment of the present invention, as shown in fig. 1, the method including the steps of:
step S102, detecting program variation of an initial application program to obtain a detection result of the initial application program;
It will be appreciated that the system will use a special change detection tool or algorithm to check whether these files have changed since the last deployment. After the completion of the fluctuation detection, a detection result is generated, and the detection result may include details of the fluctuation, such as a list of files of the fluctuation, specific contents of the fluctuation, and the like.
Optionally, the system may obtain current version information of the initial application, such as: code files, configuration files, dependency libraries, etc.
Alternatively, the above-mentioned execution program change detection is an Agent program, such as a Java Agent program, for detecting and managing Java application programs requiring hot deployment. The Agent program can realize dynamic modification and loading of Java classes through technologies such as Instrumentation and bytecode operation. Instrumentation is an interface for detecting and modifying bytecodes (Bytecode). Instrumentation (instrumentation) of the class's bytecode, i.e., modifying or enhancing the functionality of the class, is supported prior to loading the class.
Optionally, the initial application is running in a virtual instance of a cloud platform (which may also be a remote platform).
In an alternative embodiment, an initial application program is deployed on a cloud platform, and program change detection is performed on the initial application program to obtain a detection result of the initial application program, including: and in response to the starting of the initial application program, starting program change detection of the initial application program, and determining that a detection result is that the initial application program has program change under the condition that the file included in the preset catalog is detected to be updated, wherein the preset catalog is an installation catalog of the initial application program on the cloud platform.
It can be appreciated that in the cloud platform environment, program change detection is performed on the initial application program, so as to ensure stable running and timely updating of the application program. When an initial application is started on the cloud platform, a detection service or agent deployed on the cloud platform captures the event and triggers a program change detection flow. After the detection result is obtained, if the update of the key file is detected, determining that the program change exists in the initial application program, and if the updated file is a non-key file or no file update is detected, determining that the program change does not exist in the initial application program. By the method, the cloud platform can realize automatic program change detection of the initial application program and timely respond to the changes so as to ensure the stability and continuous usability of the application program.
Alternatively, the program fluctuation detection may be various, for example: comparing the file of the current version with the file of the last successfully deployed version, and checking whether any file is modified, added or deleted. For code files, static code analysis tools may be used to check whether code logic or structure has changed, such as whether new functions, classes have been added or existing logic has been changed. If the code is stored in a version control system (e.g., git), the code change can be analyzed by checking the commit record since the last deployment.
Alternatively, the file update may be an Agent program, and the notification may be immediately received when a change in the target file is detected (e.g., the predetermined suffix is a class file update).
Optionally, after the Agent program is started, detecting a file change under a predetermined directory. Monitoring of the file system may be accomplished by WATCHSERVICE API using Java (for detecting changes to the file system) or by using a third party library such as Apache Commons IO to monitor changes to the file. Apache Commons IO provide encapsulation and expansion of IO (input/output) operations, including file operations, stream operations, file copies, and the like. By using Apache Commons IO, a large number of IO operations can be completed with less code, which is advantageous for improving development efficiency.
In an alternative embodiment, before the detecting the program change of the initial application program, the method further includes: packaging a preset local file by adopting a preset packaging format to obtain a file package, wherein the preset local file is preset; and uploading the file package to a preset catalog of the cloud platform, and executing deployment processing of the initial application program on the cloud platform.
It will be appreciated that prior to deploying the initial application to the cloud platform, a series of preparation and upload steps are required to select an appropriate packaging format based on the requirements of the cloud platform and the nature of the application. And selecting a preset catalogue on the cloud platform as a deployment target of the application program, wherein the preset catalogue is a storage space reserved for the application program by the cloud platform and is used for storing files and data of the application program. After the file package is successfully uploaded to the preset catalogue, the cloud platform can execute the deployment processing of the initial application program. This may include the steps of decompressing a package of files, configuring an application runtime environment, launching an application, and the like. The cloud platform will automatically complete these deployment tasks according to the type and requirements of the application. Through the processing, the local files are packaged into file packages and uploaded to the cloud platform for deployment, and the cloud platform is responsible for processing subsequent deployment tasks and ensuring that the application program can stably run in a cloud environment.
Optionally, the initial application program (such as a Java application program) is packaged into an executable predetermined packaging format (such as a Jar file), and uploaded to a corresponding virtual machine instance on the cloud platform. When an application is started, an Agent parameter is specified and connected to the Agent program. Jar files (Java Archive) are a software package file format and use Jar as a file extension to aggregate a large number of Java class files, related metadata and resource (text, pictures, etc.) files into one file in order to develop Java platform applications or libraries.
Alternatively, the predetermined packing format may be various, for example: JAR, WAR, ZIP, etc. These formats enable multiple files and directories to be combined into a single file for ease of transmission and deployment. WAR (Web Application Archive) is the archive file format of a Java Web application. ZIP (Zip Archive) is a generic archive file format that can be used to compress and archive a plurality of files and directories.
Step S104, determining a target application program to be deployed when the detection result indicates that the program variation exists;
It will be appreciated that the presence of program variations based on the generated detection results indicates that the target application to be deployed will be determined from these variations information.
Optionally, the method may further include: check if the target application contains all the necessary dependent libraries and ensure that the versions of these dependent libraries are compatible.
Optionally, when a new application version (target application) is successfully built, the system will typically assign it a unique version number for subsequent tracking and management.
Alternatively, the manner in which the target application to be deployed is determined may be varied, for example: it is necessary to determine which programs or code libraries have changed, either by looking at the version control system's commit history, or by building logs of continuous integration/continuous deployment (CI/CD) pipelines.
Step S106, based on the initial application program, the deployment processing of the target application program is executed in a hot deployment mode.
It will be appreciated that the use of a hot deployment technique to update a target application without stopping or restarting the entire application or service, by which process program change detection of the initial application may be achieved, and when a change is detected, the target application is updated in a hot deployment manner, which helps to improve development efficiency and usability of the application, while reducing maintenance costs and risks.
Optionally, performing a deployment process to deploy the target application to the production environment may also include, for example, transmitting an application file to a server, configuring environment variables, launching the application, and so forth.
In an alternative embodiment, the deployment process of the target application program is performed in a hot deployment mode based on the initial application program, including: determining an initial bytecode of an initial application; processing the initial byte code by adopting a byte code operation mode to obtain a target byte code matched with a target application program; and executing the deployment processing of the target application program in a hot deployment mode based on the target byte code.
It can be appreciated that, based on the initial application program performing the deployment process on the target application program in the hot deployment manner, the initial bytecode of the initial application program is determined, and the bytecode (Bytecode) is an intermediate code generated after compiling a programming language such as Java, and needs to be executed on a virtual machine (such as a Java virtual machine, JVM) in the context of hot deployment, and first, the bytecode file of the initial application program needs to be acquired as the initial bytecode. The initial bytecode is handled in a bytecode operation that supports modifying its bytecode before loading the class into the JVM. And generating a target byte code matched with the target application program, obtaining the target byte code after byte code operation, and generating a new class or modifying the existing class according to the target byte code. The target byte code is matched with the function and structure of the target application program, and hot deployment is executed based on the target byte code.
It should be noted that hot deployment (Hot Deployment) refers to updating an application at runtime without stopping and restarting the entire application or server. In the Java environment, hot deployment involves the use of class loaders, which load modified bytecodes by creating a custom class loader without restarting the JVM. When the target bytecode is generated, it is loaded into the running JVM using a custom class loader, thereby effecting the change.
Optionally, after the hot deployment is completed, it is necessary to verify whether the target application is working as intended, for example involving functional testing, performance testing and security checking. The behavior and performance of the target application is checked to ensure that the hot deployment does not introduce new problems or affect the stability of the application.
Alternatively, the file format of the initial bytecode may be various, such as a ". Class" file or a packaged ". Jar", ". War" file.
Alternatively, the bytecode operation may be various, such as: through a byte code operation library (such as ASM, javassist, BCEL, etc.). The initial bytecode is modified to reflect changes to the target application, such as adding new methods, modifying existing methods, adding or modifying fields, etc. Based on specific needs, execution results from code changes, dependency updates, configuration changes or security patches, etc. ASM is a lightweight bytecode operation and analysis framework for Java platforms that supports analysis, modification, and generation of Java bytecodes. Javassist is an open source library for analyzing, editing and creating Java bytecodes, providing a simple API to manipulate Java bytecodes, supporting creation of new classes, methods or fields, or modifying existing class structures. BCEL (Byte Code Engineering Library) is a library for analyzing, modifying and creating Java bytecodes, providing a rich API for manipulating Java class structures including classes, methods, fields, and bytecode instructions, etc.
In an alternative embodiment, the deployment process of the target application program is performed in a hot deployment mode based on the target byte code, including: loading the target byte codes by using a class loader to generate target classes; determining an initial class of an initial application program; and redefining an initial class by adopting the target class, and executing the deployment processing of the target application program as a hot deployment mode.
It can be appreciated that, based on the target bytecode, the deployment process of the target application program is executed by a hot deployment mode, the target bytecode is loaded, and the modified target bytecode can be loaded by using a custom class loader, and the class loader is responsible for reading the bytecode file, for example, converting the bytecode file into a class which can be understood by a Java Virtual Machine (JVM), so as to generate a target class. The Class loader converts the bytecode into an internal format and creates a corresponding object, such as a Class object representing the Class being loaded and can be used by the JVM to create an instance of the Class. The class in the initial application that needs to be hot deployed (i.e., the initial class) is determined to be the class that has been previously loaded into the JVM. And redefining an initial class by adopting the target class, and executing the deployment processing of the target application program as a hot deployment mode. Once the target class is defined and used to redefine the initial class, the JVM will begin to use the new class definition, enabling the behavior of the application to be updated without restarting the JVM.
Alternatively, if the initial class already has instances running in the JVM, then these instances are not automatically updated due to redefinition of the class, requiring predetermined logic to handle these existing object instances.
Alternatively, due to the class loader hierarchy of the virtual machine JVM, it may be necessary to ensure that custom class loaders have access to classes that need to be hot deployed. The custom class loader is set as a child loader of the parent class loader to ensure visibility of the class.
Optionally, the initial class is redefined (or replaced) using Java Instrumentation interfaces and ClassFileTransformer callbacks. The new class definition is loaded using either the DEFINECLASS method or the retransformClasses method of the Instrumentation interface. In Java, the Instrumentation interface and ClassFileTransformer callback provide a mechanism that allows the developer to dynamically modify the bytecode of a class at runtime. This is a key part of implementing hot deployment and hot replacement of code.
ClassFileTransformer provides a callback mechanism that allows the bytecode of a class to be converted during class loading. When a class loader loads a class, it will ask if all registered ClassFileTransformer are willing to translate the bytecode of this class. If ClassFileTransformer agrees to the conversion, the bytecode can be modified and a modified version returned, which can then be used by the JVM to create an instance of the class.
DEFINECLASS allow a new class to be dynamically defined as a method to accept as parameters an array of bytecodes representing the structure of the class to be defined, which may create classes that do not exist on the class path, or overwrite existing classes.
RetransformClasses allow the loaded classes to be re-translated at runtime, accept a class array as a parameter, and instruct the JVM to re-translate the classes. Re-translation means that the JVM will recall all registered ClassFileTransformer again, passing in the bytecode of the class to be re-translated. This allows the behavior of the already loaded classes to be dynamically altered without restarting the JVM.
In an alternative embodiment, the initial application program and the target application program are both deployed on the cloud platform, and the initial application program and the target application program are programs with different application versions, and the method further includes: determining a first virtual environment resource allocated to an initial application program by a cloud platform and a second virtual environment resource allocated to a target application program; and running the initial application program by using the first virtual environment resource, and running the target application program by using the second virtual environment resource in parallel.
It will be appreciated that in a cloud platform environment, applications are typically deployed in a virtual environment that provides the application with the required resources, such as computing, storage, networking, and the like. When version upgrades or hot deployments of applications are involved, the cloud platform needs to manage resource allocation for different versions of the application to ensure that the initial application and the target application can run in parallel without interfering with each other. The initial application program and the target application program are programs with different versions, and resource allocation is needed on the cloud platform. Through the processing, the cloud platform ensures isolation and safety among different versions of application programs, provides flexible resource allocation and monitoring mechanisms, and improves the efficiency and quality of software development. The method and the system support flexible deployment strategies, dynamically adjust resource allocation according to needs and realize multi-version coexistence capability. The number and configuration of virtual machine instances are automatically adjusted according to the needs of the application program to meet different performance requirements and access volume changes.
Optionally, the cloud platform first evaluates the resource requirements of the initial application and the target application. The resource requirements may be various, such as: including computing resources (e.g., CPU cores, clock frequency), memory requirements, storage requirements (e.g., disk space, I/O performance), and network bandwidth, among others. In order to ensure isolation between different versions of an application, the cloud platform ensures that the initial application and the target application run in different virtual environments, and even if a new version of the application (the target application) has a problem, the old version of the application (the initial application) running is not affected.
Alternatively, the first virtual environment resource and the second virtual environment resource may be allocated in a plurality of manners, for example: a Virtual Machine (VM), a container (e.g., a Docker container), or a lightweight virtual environment, such as a function computing environment.
In an alternative embodiment, the method further comprises: responding to a program screening instruction of a human-computer interaction interface, and determining the type of a target program to be detected; among a predetermined plurality of candidate applications, an initial application matching the target program type is determined.
It can be appreciated that in the process of application program management and deployment by the cloud platform, user input is received through the man-machine interaction interface, and the user can send various instructions including screening, deployment, upgrading and managing the application program requiring hot deployment through the interfaces. And screening the initial application programs matched with the candidate application program in the candidate application program list according to the type of the target program.
Alternatively, in determining the initial application program matching the target program type, the matching processing manner may be various, for example, matching and comparing metadata, tags or attributes of the application program.
Optionally, the man-machine interaction interface may be various, for example: a Web interface, a command line interface, or a graphical user interface.
Through the step S102, the program change detection is performed on the initial application program, so as to obtain a detection result of the initial application program; step S104, determining a target application program to be deployed when the detection result indicates that the program variation exists; step S106, based on the initial application program, the deployment processing of the target application program is executed in a hot deployment mode. The method can automatically detect the program change and realize the purpose of performing hot deployment of the program in a non-stop state, thereby realizing the technical effects of reducing the program modification process and improving the application deployment efficiency, and further solving the technical problem of unsatisfactory application restarting time caused by program change in the related technology.
Based on the foregoing embodiments and optional embodiments, an optional implementation manner is provided in the present invention, and fig. 2 is a schematic diagram of an optional program deployment method provided according to an embodiment of the present invention, where steps shown in fig. 2 are described below:
And selecting an initial application program (such as a Java application program) to be subjected to hot deployment through a man-machine interaction interface in the local area, packaging the Java application program into a Jar file in a preset format, and uploading the Jar file to a corresponding virtual machine instance on the cloud platform. And when the cloud platform starts the initial application program, designating the Agent parameters and connecting to the Agent program. When the Agent program is started, detecting file change under the appointed directory. When the Agent program detects that the target file changes (such as update of the class file), a corresponding detection result is generated.
The Agent program uses byte code operation technology (such as ASM, javassist and other libraries) to enhance or replace the class needing hot deployment according to the file change. And loading the modified byte codes by using a custom class loader to obtain a target class and replacing the initial class. After the target class is redefined, the Java Agent technology and the cloud platform are combined, so that the hot deployment of the target application program can be realized.
At least the above-mentioned alternative embodiments realize: java hot deployment system is carried out by using Java Agent technology: the system utilizes the virtualized environment provided by the cloud platform to realize the hot deployment of Java application programs on line, and solves the problem of limitation of traditional local deployment. And an intuitive and easy-to-use man-machine interaction interface is provided, and related technicians can upload, deploy and manage application programs through the interface, so that the operation and control are convenient. By adopting an automatic hot deployment process, the automatic hot deployment process is realized, and operations such as version detection, upgrading and restarting can be automatically completed only by uploading a new program package, so that errors and omission of manual operation are reduced.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
The present embodiment also provides a program deployment device, which is used to implement the foregoing embodiments and preferred embodiments, and will not be described in detail. As used below, the terms "module," "apparatus" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
According to an embodiment of the present invention, there is further provided an apparatus embodiment for implementing a program deployment method, and fig. 3 is a schematic diagram of a program deployment apparatus according to an embodiment of the present invention, as shown in fig. 3, where the program deployment apparatus includes: the device is described below as a change detection module 302, a target application determination module 304, and a hot deployment execution module 306.
The change detection module 302 is configured to perform program change detection on the initial application program to obtain a detection result of the initial application program;
The target application program determining module 304 is connected to the change detecting module 302, and is configured to determine a target application program to be deployed when the detection result indicates that there is a program change;
The hot deployment execution module 306 is connected to the target application program determination module 304, and is configured to execute deployment processing on the target application program in a hot deployment manner based on the initial application program.
In the program deployment device provided by the embodiment of the invention, the change detection module 302 is used for detecting the program change of the initial application program to obtain the detection result of the initial application program; the target application program determining module 304 is connected to the change detecting module 302, and is configured to determine a target application program to be deployed when the detection result indicates that there is a program change; the hot deployment execution module 306 is connected to the target application program determination module 304, and is configured to execute deployment processing on the target application program in a hot deployment manner based on the initial application program. The method achieves the purposes of automatically detecting program change and performing program hot deployment in a non-stop state, achieves the technical effects of reducing program modification process and improving application deployment efficiency, and further solves the technical problem that application restarting is not ideal due to program change in the related technology.
As an optional embodiment, the program deployment device provided in the embodiment of the present invention, the hot deployment execution module includes: an initial byte code determining module for determining initial byte codes of the initial application program; the byte code operation module is used for processing the initial byte code by adopting a byte code operation mode to obtain a target byte code matched with the target application program; the first deployment module is used for executing the deployment processing of the target application program in a hot deployment mode based on the target byte code.
As an optional embodiment, the program deployment device provided in the embodiment of the present invention, the first deployment module includes: the class loading module is used for loading the target byte codes by adopting a class loader to generate target classes; an initial class determining module for determining an initial class of the initial application program; and the second deployment module is used for redefining the initial class by adopting the target class and executing the deployment processing of the target application program as a hot deployment mode.
As an optional embodiment, the program deployment device provided in the embodiment of the present invention, the hot deployment execution module includes: the change detection triggering module is used for responding to the starting of the initial application program, starting program change detection of the initial application program, and determining that a detection result is that the initial application program has program change under the condition that the file included in the preset catalogue is detected to be updated, wherein the preset catalogue is an installation catalogue of the initial application program on the cloud platform.
As an optional embodiment, the program deployment apparatus provided in the embodiment of the present invention further includes: the packaging module is used for packaging the preset local file by adopting a preset packaging format to obtain a file package, wherein the preset local file package is preset; and the uploading module is used for uploading the file package to a preset catalog of the cloud platform and executing the deployment processing of the initial application program on the cloud platform.
As an alternative embodiment, the above device further comprises: the resource allocation module is used for determining a first virtual environment resource allocated to the initial application program by the cloud platform and a second virtual environment resource allocated to the target application program; and the parallel running module is used for running the initial application program by adopting the first virtual environment resource and running the target application program by adopting the second virtual environment resource in parallel.
As an alternative embodiment, the above device further comprises: the target program type determining module is used for responding to the program screening instruction of the human-computer interaction interface and determining the type of the target program to be detected; and the program matching module is used for determining an initial application program matched with the target program type in a plurality of preset candidate application programs.
It should be noted that each of the above modules may be implemented by software or hardware, for example, in the latter case, it may be implemented by: the above modules may be located in the same processor; or the various modules described above may be located in different processors in any combination.
Here, the above-mentioned change detection module 302, the target application program determination module 304, and the hot deployment execution module 306 correspond to steps S102 to S106 in the embodiment, and the above-mentioned modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to those disclosed in the above-mentioned embodiments. It should be noted that the above modules may be run in a computer terminal as part of the apparatus.
It should be noted that, the optional or preferred implementation manner of this embodiment may be referred to the related description in the embodiment, and will not be repeated herein.
The program deployment device may further include a processor and a memory, where the change detection module 302, the target application determination module 304, the hot deployment execution module 306, and the like are stored as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel may be provided with one or more. The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
Embodiments of the present application provide a computer program product comprising a non-volatile computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method of the various embodiments of the application.
The embodiment of the invention provides a nonvolatile storage medium, on which a program is stored, which when executed by a processor, implements a program deployment method.
The embodiment of the invention provides an electronic device, which comprises a processor, a memory and a program stored on the memory and capable of running on the processor, wherein the following steps are realized when the processor executes the program: detecting program variation of the initial application program to obtain a detection result of the initial application program; determining a target application program to be deployed under the condition that the detection result indicates that program variation exists; based on the initial application program, the deployment processing of the target application program is executed in a hot deployment mode. The device herein may be a server, a PC, etc.
The invention also provides a computer program product adapted to perform, when executed on a data processing device, a program initialized with the method steps of: detecting program variation of the initial application program to obtain a detection result of the initial application program; determining a target application program to be deployed under the condition that the detection result indicates that program variation exists; based on the initial application program, the deployment processing of the target application program is executed in a hot deployment mode.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that 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 phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present invention and is not intended to limit the present invention. Various modifications and variations of the present invention will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the invention are to be included in the scope of the claims of the present invention.

Claims (10)

1. A program deployment method, comprising:
Detecting program variation of an initial application program to obtain a detection result of the initial application program;
determining a target application program to be deployed under the condition that the detection result indicates that program variation exists;
And executing the deployment processing of the target application program by adopting a hot deployment mode based on the initial application program.
2. The method according to claim 1, wherein the performing the deployment process of the target application program in a hot deployment manner based on the initial application program includes:
Determining an initial byte code of the initial application program;
Processing the initial byte code by adopting a byte code operation mode to obtain a target byte code matched with the target application program;
And executing the deployment processing of the target application program by adopting the hot deployment mode based on the target byte code.
3. The method of claim 2, wherein the performing the deployment process of the target application in the hot deployment manner based on the target bytecode comprises:
Loading the target byte codes by using a class loader to generate target classes;
Determining an initial class of the initial application program;
And redefining the initial class by adopting the target class, and executing the deployment processing of the target application program as the hot deployment mode.
4. The method of claim 1, wherein the initial application is deployed on a cloud platform, and the detecting the program variation of the initial application to obtain the detection result of the initial application includes:
And responding to the starting of the initial application program, starting program change detection of the initial application program, and determining that the detection result is that the initial application program has program change under the condition that the file included in a preset catalog is detected to be updated, wherein the preset catalog is an installation catalog of the initial application program on the cloud platform.
5. The method according to claim 1, wherein before the detecting of the program change of the initial application program, the method further comprises:
packaging a preset local file by adopting a preset packaging format to obtain a file package, wherein the preset local file is packaged by adopting a preset packaging format;
And uploading the file package to a preset catalog of a cloud platform, and executing deployment processing of the initial application program on the cloud platform.
6. The method of claim 1, wherein the initial application and the target application are both deployed on a cloud platform, the initial application and the target application being different application versions of the program, the method further comprising:
determining a first virtual environment resource allocated to the initial application program by the cloud platform and a second virtual environment resource allocated to the target application program;
And running the initial application program by adopting the first virtual environment resource, and running the target application program by adopting the second virtual environment resource in parallel.
7. The method according to any one of claims 1 to 6, further comprising:
responding to a program screening instruction of a human-computer interaction interface, and determining the type of a target program to be detected;
The initial application matching the target program type is determined among a predetermined plurality of candidate applications.
8. A program deployment apparatus, comprising:
The change detection module is used for detecting program change of the initial application program to obtain a detection result of the initial application program;
The target application program determining module is used for determining a target application program to be deployed under the condition that the detection result indicates that the program variation exists;
And the hot deployment execution module is used for executing the deployment processing of the target application program in a hot deployment mode based on the initial application program.
9. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the program deployment method of any of claims 1 to 7.
10. An electronic device, comprising: one or more processors and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the program deployment method of any of claims 1 to 7.
CN202410181510.7A 2024-02-18 2024-02-18 Program deployment method, program deployment device, computer program product and electronic equipment Pending CN118012442A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410181510.7A CN118012442A (en) 2024-02-18 2024-02-18 Program deployment method, program deployment device, computer program product and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410181510.7A CN118012442A (en) 2024-02-18 2024-02-18 Program deployment method, program deployment device, computer program product and electronic equipment

Publications (1)

Publication Number Publication Date
CN118012442A true CN118012442A (en) 2024-05-10

Family

ID=90943954

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410181510.7A Pending CN118012442A (en) 2024-02-18 2024-02-18 Program deployment method, program deployment device, computer program product and electronic equipment

Country Status (1)

Country Link
CN (1) CN118012442A (en)

Similar Documents

Publication Publication Date Title
US10977066B2 (en) Virtual machine to container conversion and optimization
US8621419B2 (en) Automating the life cycle of a distributed computing application
US10216509B2 (en) Continuous and automatic application development and deployment
EP1497721B1 (en) A software distribution method and system
CN111399865A (en) Method for automatically constructing target file based on container technology
US7904484B2 (en) Incremental packaging
US20100205604A1 (en) Systems and methods for efficiently running multiple instances of multiple applications
US20040088397A1 (en) System and method for management of software applications
CN108897547B (en) Software automation deployment method and device
US10514898B2 (en) Method and system to develop, deploy, test, and manage platform-independent software
US20090125874A1 (en) Method and system for creating projects in a rational application developer workspace
US9256509B1 (en) Computing environment analyzer
US11481245B1 (en) Program inference and execution for automated compilation, testing, and packaging of applications
CN111930466A (en) Kubernetes-based data synchronization environment deployment method and device
CN115220863A (en) Operation and maintenance method and device for container application, computer equipment and storage medium
CN117707543A (en) Application installation package manufacturing and installation method, computing device and storage medium
CN108304184B (en) Compiling method and device
CN110806891A (en) Method and device for generating software version of embedded equipment
CN118012442A (en) Program deployment method, program deployment device, computer program product and electronic equipment
CN114791884A (en) Test environment construction method and device, storage medium and electronic equipment
CN112486511A (en) Method for generating operating system installation mirror image through web
CN113076109B (en) Cross-platform script language deployment method
CN117648198B (en) Application adaptation method, device, equipment and storage medium
JP2012093979A (en) Osgi bundle and deployment package automatic creation system, automatic creation method and automatic creation tool
CN115640005A (en) Hybrid application generation method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination