Disclosure of Invention
In view of this, the embodiments of the present invention provide an application and a method and an apparatus for upgrading the application, which can upgrade both an application main program and an upgrade program, and support centralized management of version upgrade without deploying an independent upgrade program, so that deployment time can be greatly shortened.
To achieve the above object, according to one aspect of the embodiments of the present invention, there is provided a method for application upgrade.
A method of application upgrade, comprising: the method comprises the steps that an application main program process starts an upgrade program process according to an application upgrade instruction, the application main program and the upgrade program are packaged in a data packet, and the main program and the upgrade program have different starting inlets; after the upgrade program process is started, the upgrade program process stops the main program process and executes application upgrade operation; and after the application upgrading operation is finished, the upgrading program process starts the main program process and exits the upgrading program process to finish the application upgrading.
Optionally, before the upgrade program process stops the main program process, the method further includes: downloading an upgrade data packet for the upgrade, wherein the upgrade data packet is used for upgrading a main program and/or an upgrade program of the application; and backing up the current versions of the main program and the upgrade program of the application.
Optionally, performing the application upgrade operation includes: and executing the upgrade data packet to upgrade the main program and the upgrade program of the application to new versions.
Optionally, the method further comprises: if the upgrade program process fails to start the main program process, the upgrade program process rolls back the application to the backup version.
Optionally, the data packet and the upgrade data packet are generated by packaging data in a Fat-Jar mode.
According to another aspect of the embodiment of the invention, an apparatus for application upgrade is provided.
An apparatus for application upgrades, comprising: the upgrade starting module is used for enabling a main program process of an application to start an upgrade program process according to an application upgrade instruction, wherein the main program and the upgrade program of the application are packaged in a data packet, and the main program and the upgrade program have different starting inlets; the application upgrading module is used for enabling the upgrading program process to stop the main program process after the upgrading program process is started, and executing application upgrading operation; and the upgrade exit module is used for enabling the upgrade program process to start the main program process and exit the upgrade program process after the application upgrade operation is finished so as to finish the application upgrade.
Optionally, the system further comprises an upgrade preparation module for: the upgrade program process downloads an upgrade data packet for upgrading the time before stopping the main program process, wherein the upgrade data packet is used for upgrading the main program and/or the upgrade program of the application; and backing up the current versions of the main program and the upgrade program of the application.
Optionally, performing the application upgrade operation includes: and executing the upgrade data packet to upgrade the main program and the upgrade program of the application to new versions.
Optionally, the method further comprises a version rollback module for: if the upgrade program process fails to start the main program process, the upgrade program process rolls back the application to the backup version.
Optionally, the data packet and the upgrade data packet are generated by packaging data in a Fat-Jar mode.
According to a further aspect of embodiments of the present invention, there is provided an application.
An application, comprising: the method for upgrading the application comprises a main program, an upgrading program and an upgrading control program, wherein the upgrading control program is used for upgrading the main program and the upgrading program of the application according to the method for upgrading the application provided by the embodiment of the invention.
According to yet another aspect of an embodiment of the present invention, an electronic device for application upgrade is provided.
An electronic device for application upgrades, comprising: one or more processors; and the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the method for upgrading the application provided by the embodiment of the invention.
According to yet another aspect of an embodiment of the present invention, a computer-readable medium is provided.
A computer readable medium having stored thereon a computer program which when executed by a processor implements a method of application upgrade provided by an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: the main program process and the upgrade program process of the application are packaged in one data packet, so that the data sharing of the main program and the upgrade program can be realized very conveniently, the upgrade program process can easily acquire the process number of the main program, and the upgrade program process of the application can be stopped accurately and conveniently; by enabling the main program and the upgrading program to have different starting inlets, the main program and the upgrading program of the application can be started at different times; by stopping the main program process after the upgrade program process is started and starting the main program process and exiting the upgrade program process after the upgrade process is finished, the upgrade program process is started only when the upgrade is needed, and automatically exits after the upgrade of the application is finished, the different simultaneous execution of the main program process and the upgrade program process can be realized, thereby reducing the system load and saving the system resources. The invention is based on the packing mode of the Fat-Jar, all the resources on which the program depends are packed together, so that the upgrading program only needs to download an upgrading data packet and replace the data packet to finish the version upgrading work, the upgrading of the application main program can be realized, the upgrading of the upgrading program can be realized, the independent upgrading program is not required to be deployed, the centralized management of the version upgrading is supported, and the deployment time can be greatly shortened. According to the technical scheme, the problem of deployment of the proxy application upgrading program in the GCP mode is solved, centralized management of the proxy by the control terminal is supported, and release of the gray level of the version can be supported.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In order to solve the problems in the prior art, the invention provides a new technical scheme for application upgrading, an upgrading program is not required to be independently deployed, automatic upgrading of the proxy in the GCP mode is supported, and an upgrading strategy can be controlled at a controller side. The technical scheme of the invention is realized based on the Fat-Jar technology, and all applications based on the Fat-Jar mode package can adopt the technical scheme. In the Java ecosystem, the term "Fat-Jar" refers to packaging all resources (class files, class libraries, resource files, etc.) that an application depends on into a single executable Jar file. The application is packaged into the Fat-Jar, so that the operations of deployment, starting, stopping and the like of the application are very simple, and more development frameworks (such as SpringBoot, wildFlySwarm, dropwizard) begin to adopt the Fat-Jar packaging mode. Those skilled in the art will appreciate that other packaging schemes similar to the function of the Fat-Jar may also implement the functionality of the present invention. Wherein, the packaging mode similar to the function of the Fat-Jar refers to: all resources (including class files, class libraries, resource files and the like) relied by the application can be packaged into a single executable file, and the data packaging mode of different programs corresponding to different starting inlets can be realized.
The technical scheme of the invention can solve the problem of automatic upgrading of the proxy application in the GCP mode. In the technical scheme of the invention, the control end can control synchronous upgrading operation of all agent ends, and meanwhile, the control end can also carry out version upgrading and rollback operation on agent ends of different groups so as to support gray level release of upgrading programs applied by the agent ends (the gray level release refers to a release mode capable of smoothly transiting between black and white, a part of users continue to use the product characteristic A, a part of users start to use the product characteristic B, if the users do not have an adverse opinion on the product characteristic B, the application range of the product characteristic B is gradually enlarged, and all users are migrated to the product characteristic B. And the application upgrading operation of the proxy end is completely executed by operators of the control end, and the operators of the proxy end are not required to participate.
Specifically, the control end can comprise a data management module, a proxy registration module and an operation management module according to the function implementation. The data management module is mainly responsible for managing application upgrade data packets of the proxy, for example: uploading, updating, storing and the like of the application upgrading data packet; the proxy registration module is responsible for processing registration requests of proxy terminals and can manage registered proxy terminals; the operation management module is mainly responsible for sending operation instructions such as upgrading, rollback and the like to the proxy end. The control end can check the information of all registered agent ends by setting a display device, for example: application version information of the proxy side, packet information of the proxy side, and the like. And when the application of the proxy end needs to be upgraded, selecting the proxy end needing to be upgraded, generating an upgrade instruction and sending the upgrade instruction to the proxy end.
The agent end deploys the main program and the upgrading program of the application at the same time, so as to provide specific business services. The upgrade program carries information such as the current version number of the application. When the main program of the application of the proxy end is started, the version number information can be extracted, and the version number information and the grouping information of the proxy end are sent to the proxy registration module of the control end so as to register the proxy end to the control end, so that the control end can check the version information, the grouping information and the like of all the proxy ends.
The following describes a specific procedure of application upgrade at the proxy end of the present invention.
Fig. 2 is a schematic diagram of the main flow of a method of application upgrade according to an embodiment of the present invention. As shown in fig. 2, the method for upgrading an application according to the embodiment of the present invention mainly includes the following steps S201 to S203.
Step S201: the main program process of the application starts the upgrading program process according to the application upgrading instruction, the main program and the upgrading program of the application are packaged in a data packet, and the main program and the upgrading program have different starting inlets;
Step S202: after the upgrade program process is started, the upgrade program process stops the main program process and executes the application upgrade operation;
Step S203: after the application upgrading operation is finished, the upgrading program process starts the main program process and exits the upgrading program process to finish the application upgrading.
In the embodiment of the invention, the data packet is generated by packing the data in a Fat-Jar mode. Data packing based on the Fat-Jar mode can support that a plurality of startup portals exist in one data packet (Jar packet). In the technical scheme of the invention, two starting inlets exist: a main program start entry for starting the normal service main program code; an upgrade program initiation portal for initiating upgrade program code. By packing the main program and the upgrade program of the application in one data packet, the data sharing of the main program and the upgrade program can be realized very conveniently, so that the upgrade program process can easily acquire the process number of the main program, and the upgrade program process of the application can be stopped to the main program process accurately and conveniently. In the prior art, an application upgrade program process is used as a system process, and is operated simultaneously with a main program process, and even if the application main program process can stop the application upgrade program process, the main program process is required to search and stop from a process list according to the process name of the upgrade program, so that the efficiency is low, and when a plurality of processes are named as each other, misoperation can occur, and the user experience is influenced. In the invention, the upgrade program process is started only when the upgrade is needed, and the upgrade program process automatically exits after the upgrade of the application is finished, thereby greatly saving system resources.
The application upgrading instruction in the invention can be sent by the control end or actively applied by the proxy end.
According to an embodiment of the present invention, before the upgrade program process stops the main program process, it is also possible to:
downloading an upgrade data packet for the upgrade, wherein the upgrade data packet is used for upgrading a main program and/or an upgrade program of an application; and
And backing up the current versions of the main program and the upgrading program of the application.
The execution sequence of the operation of downloading the upgrade data packet for the upgrade and the operation of backing up the current version of the application can be flexibly set, and the two operations can be simultaneously executed, or the operation of downloading the upgrade data packet for the upgrade can be executed first, then the operation of backing up the current version of the application can be executed, or the operation of backing up the current version of the application can be executed first, and then the operation of downloading the upgrade data packet for the upgrade can be executed.
In the embodiment of the invention, the main program and the upgrade program of the application are packaged in one data packet, and each time of upgrading, the upgrade data packet is completely replaced by the original data packet, so that the main program and the upgrade program of the application have the same version number.
If the upgrade program process fails to start the main program process, the upgrade program process rolls back the application to the backup version. Here, the backup version refers to the version of the main program and the upgrade program of the application backed up before the upgrade package is executed this time.
In addition, in the invention, whether the main program or the upgrading program of the application is required to be upgraded, the upgrading is realized through the upgrading data packet. When the data is packed based on the Fat-Jar mode, all the resources (class files, class libraries, resource files and the like) relied by the application can be packed into a single executable Jar file, so that the upgrade data packet can comprise data for upgrading the main program of the application and data for upgrading the upgrade program of the application. According to different contents included in the upgrade data packet, updated contents after the upgrade data packet is executed are also different, and the specific upgrade contents are determined by the contents in the upgrade data packet.
In an embodiment of the present invention, performing an application upgrade operation is, for example: and executing the upgrade data packet to upgrade the main program and the upgrade program of the application to new versions.
FIG. 3 is a timing flow diagram of an application upgrade of an embodiment of the present invention. As shown in fig. 3, after receiving an application upgrade instruction sent by the control end, the main program process of the application deployed by the proxy end starts the upgrade program process of the application according to the application upgrade instruction. After the upgrade program process is started successfully, upgrade preparation work is executed in advance: and downloading an upgrade data packet for the upgrade of the application from a control end (a data management module), and backing up the main program of the application and the current version of the upgrade program. After the upgrade preparation work is completed, the upgrade program process stops the main program process of the application to exit the main program of the application, and then executes the upgrade data packet to replace the current version of the application to upgrade the application to a new version. After that, the upgrade program process will start the main program of the new version application, so that the main program process can start the main program by loading the new version of the application, and then the upgrade program process automatically exits, and the application upgrade is completed.
Fig. 4 is a schematic diagram of the main modules of an apparatus for application upgrade according to an embodiment of the present invention. As shown in fig. 4, an apparatus 400 for application upgrade according to an embodiment of the present invention mainly includes an upgrade starting module 401, an upgrade executing module 402, and an upgrade exiting module 403.
The upgrade starting module 401 is configured to enable a main program process of an application to start an upgrade program process according to an application upgrade instruction, where the main program and the upgrade program of the application are packaged in a data packet, and the main program and the upgrade program have different starting entries;
the upgrade execution module 402 is configured to stop the upgrade program process from the main program process after the upgrade program process is started, and execute an application upgrade operation;
the upgrade exit module 403 is configured to enable the upgrade program process to start the main program process and exit the upgrade program process after the application upgrade operation is completed.
The apparatus 400 for application upgrade according to an embodiment of the present invention may further include an upgrade preparation module (not shown in the drawings) for:
Before stopping the main program process, the upgrade program process downloads an upgrade data packet for the upgrade, wherein the upgrade data packet is used for upgrading the main program and/or the upgrade program of the application; and
And backing up the current versions of the main program and the upgrading program of the application.
Wherein performing the application upgrade operation may include, for example: and executing the upgrade data packet to upgrade the main program and the upgrade program of the application to new versions.
In addition, the apparatus 400 for application upgrade according to the embodiment of the present invention may further include a version rollback module (not shown in the figure) for:
if the upgrade program process fails to start the main program process, the upgrade program process rolls back the application to the backup version.
In the embodiment of the invention, the data packet and the upgrade data packet are generated by packing the data in a Fat-Jar mode.
In addition, the invention also provides an application, which comprises the following steps: the method for upgrading the application comprises a main program, an upgrading program and an upgrading control program, wherein the upgrading control program is used for upgrading the main program and the upgrading program of the application according to the upgrading program.
According to the technical scheme of the embodiment of the invention, the main program process and the upgrade program process of the application are packaged in one data packet, so that the data sharing of the main program and the upgrade program can be realized very conveniently, the upgrade program process can easily acquire the process number of the main program, and the stop of the main program process by the upgrade program process of the application can be realized accurately and conveniently; by enabling the main program and the upgrading program to have different starting inlets, the main program and the upgrading program of the application can be started at different times; by stopping the main program process after the upgrade program process is started and starting the main program process and exiting the upgrade program process after the upgrade process is finished, the upgrade program process is started only when the upgrade is needed, and automatically exits after the upgrade of the application is finished, the different simultaneous execution of the main program process and the upgrade program process can be realized, thereby reducing the system load and saving the system resources. The invention is based on the packing mode of the Fat-Jar, all the resources on which the program depends are packed together, so that the upgrading program only needs to download an upgrading data packet and replace the data packet to finish the version upgrading work, the upgrading of the application main program can be realized, the upgrading of the upgrading program can be realized, the independent upgrading program is not required to be deployed, the centralized management of the version upgrading is supported, and the deployment time can be greatly shortened. In addition, the technical scheme of the invention also solves the deployment problem of the proxy application upgrade program in the GCP mode, supports the centralized management of the proxy by the control terminal, and can support the release of the gray scale of the version.
Fig. 5 illustrates an exemplary system architecture 500 of a method of application upgrade or an apparatus of application upgrade to which embodiments of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 is used as a medium to provide communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 505 via the network 504 using the terminal devices 501, 502, 503 to receive or send messages or the like. Various communication client applications may be installed on the terminal devices 501, 502, 503, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 501, 502, 503 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (by way of example only) providing support for shopping-type websites browsed by users using the terminal devices 501, 502, 503. The background management server may analyze and process the received data such as the product information query request, and feedback the processing result (e.g., the target push information, the product information—only an example) to the terminal device.
It should be noted that, the method for upgrading an application provided in the embodiment of the present invention is generally executed by the server 505, and accordingly, the device for upgrading an application is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, there is illustrated a schematic diagram of a computer system 600 suitable for use in implementing a terminal device or server in accordance with an embodiment of the present invention. The terminal device or server shown in fig. 6 is only an example, and should not impose any limitation on the functions and scope of use of the embodiments of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 601.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described units or modules may also be provided in a processor, for example, as: a processor includes an upgrade initiation module, an upgrade execution module, and an upgrade exit module. The names of these units or modules do not constitute limitations on the unit or module itself in some cases, and for example, the upgrade starting module may also be described as "a module for causing a main program process of an application to start an upgrade program process according to an application upgrade instruction".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include: the method comprises the steps that an application main program process starts an upgrade program process according to an application upgrade instruction, the application main program and the upgrade program are packaged in a data packet, and the main program and the upgrade program have different starting inlets; after the upgrade program process is started, the upgrade program process stops the main program process and executes application upgrade operation; after the application upgrading operation is finished, the upgrading program process starts the main program process and exits the upgrading program process to finish the application upgrading.
According to the technical scheme of the embodiment of the invention, the main program process and the upgrade program process of the application are packaged in one data packet, so that the data sharing of the main program and the upgrade program can be realized very conveniently, the upgrade program process can easily acquire the process number of the main program, and the stop of the main program process by the upgrade program process of the application can be realized accurately and conveniently; by enabling the main program and the upgrading program to have different starting inlets, the main program and the upgrading program of the application can be started at different times; by stopping the main program process after the upgrade program process is started and starting the main program process and exiting the upgrade program process after the upgrade process is finished, the upgrade program process is started only when the upgrade is needed, and automatically exits after the upgrade of the application is finished, the different simultaneous execution of the main program process and the upgrade program process can be realized, thereby reducing the system load and saving the system resources. The invention is based on the packing mode of the Fat-Jar, all the resources on which the program depends are packed together, so that the upgrading program only needs to download an upgrading data packet and replace the data packet to finish the version upgrading work, the upgrading of the application main program can be realized, the upgrading of the upgrading program can be realized, the independent upgrading program is not required to be deployed, the centralized management of the version upgrading is supported, and the deployment time can be greatly shortened. In addition, the technical scheme of the invention also solves the deployment problem of the proxy application upgrade program in the GCP mode, supports the centralized management of the proxy by the control terminal, and can support the release of the gray scale of the version.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.