B / s framework automatic cloud program upgrading system
By providing automated cloud program upgrade methods in the b/s framework, using automated scripts and docker container technology, the problem of automation upgrade in the b/s framework is solved, and an efficient and automated program upgrade and rollback mechanism is realized, improving operation and maintenance efficiency and system stability.
Patent Information
- Application Number
- CN202411891998.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to achieve efficient upgrade of automated cloud programs in the b/s framework, especially when the application system is deployed on the server side, and there is a lack of automatic upgrade methods for this architecture.
Provides a method for upgrading the b/s framework automation cloud program, including obtaining the version to be released, updating the version through automated scripts, and triggering a rollback mechanism when the update fails. This method uses timed tasks, docker container technology and automated scripts to implement version number management and rollback mechanisms.
It realizes the automatic cloud program upgrade in the b/s framework, improves operation and maintenance efficiency, reduces manual intervention, provides rollback and early warning functions when update failures, and ensures system stability and reliability.
Smart Images

Figure CN119829332A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of application upgrade, and more specifically, to a b / s framework automated cloud program upgrade system. Background Art
[0002] For private cloud SaaS deployment, most developers will send people to the site to complete debugging under the network resources provided by the other party. If there is a need for update later, it is necessary to connect to the intranet environment through VPN, contact the operation and maintenance personnel of Party A, or re-station on site. No matter which solution is adopted, the time cost and communication cost are high, so the developer often chooses to reduce the frequency of updates and deploy them all at once when the updates accumulate to a certain amount. This often leads to problems such as untimely response to needs or inability to modify urgent bugs.
[0003] CN103067484A discloses a method and system for automatically upgrading an application program, but the autonomous upgrade framework is mostly for upgrading personal computer clients and c / s frameworks. In the c / s framework, the upgrade program acts on the client, and each client must rely on the server to run, so the client version must be kept consistent. In addition, in the c / s framework, there will be users observing the update status every time an update is made, so there is no solution to the situation of upgrade failure. Moreover, the installation of the program in the c / s framework is carried out by a unified installation package, and there is no database upgrade requirement. However, there is currently no application upgrade method for the b / s framework and the application system is deployed on the server side. Summary of the invention
[0004] The purpose of the present invention is to address the deficiencies in the prior art and to propose a b / s framework automated cloud program upgrade system.
[0005] First, a b / s framework automated cloud program upgrade method is provided, including:
[0006] S1. Get the version to be released;
[0007] S2. Version update through automated scripts;
[0008] S3. Determine whether the version is updated successfully. If not, trigger the rollback mechanism.
[0009] Preferably, S1 comprises:
[0010] S101, obtaining an instruction to initiate an update;
[0011] S102, adding the SQL statement of the newly added function to the standard database according to the update initiation instruction;
[0012] S103, uploading the front-end and back-end files according to the update initiation instruction;
[0013] S104: Obtain the version to be released, and define the version number of the version to be released.
[0014] Preferably, in S104, the version number is provided with a special update identifier, and the special update identifier is used to identify a security upgrade or a test update.
[0015] Preferably, S2 comprises:
[0016] S201, obtain the latest version number through a scheduled task;
[0017] S202, downloading an update package according to its own architecture, wherein the update package includes a front-end file and an image;
[0018] S203, according to the type of its own database and the registered number, download and execute the SQL statement between the number and the standard database, and update the registered number;
[0019] S204, renaming the old front-end file to the old version number, and stopping the back-end system;
[0020] S205: Transfer the downloaded front-end files to the corresponding directory and start the back-end image.
[0021] Preferably, S3 includes:
[0022] S301, determine whether the backend image is successfully started by monitoring the script, if it is successfully started, record the log and delete the downloaded front-end and back-end files, and the version update is completed, if it fails to start, execute S302;
[0023] S302, delete the current backend image and frontend files;
[0024] S303, restore the backed-up front-end files and back-end images;
[0025] S304: Delete the downloaded front-end and back-end files, and push the update failure information.
[0026] In a second aspect, a b / s framework automated cloud program upgrade system is provided, which is used to execute any of the methods described in the first aspect, including:
[0027] Acquisition module, used to obtain the version to be released;
[0028] Update module, used for version updates through automated scripts;
[0029] The judgment module is used to judge whether the version is updated successfully. If not, the rollback mechanism is triggered.
[0030] According to a third aspect, a computer storage medium is provided, wherein a computer program is stored in the computer storage medium; when the computer program is executed on a computer, the computer executes any method described in the first aspect.
[0031] In a fourth aspect, an electronic device is provided, including:
[0032] Memory, used to store computer programs;
[0033] A processor is used to execute the computer program to implement any method as described in the first aspect.
[0034] The beneficial effects of the present invention are:
[0035] 1. The present invention realizes automatic update of the client through an automated script, so that operation and maintenance personnel do not need to update separately by on-site or other means, thereby improving work efficiency; and the present application provides a rollback and early warning function when the update fails.
[0036] 2. The present invention can define different application versions through multi-version management to adapt to different operating systems, and can be configured in the script according to the needs of each system, such as only security updates, only major version updates, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a schematic diagram of the overall process of the b / s framework automated cloud program upgrade method;
[0038] Figure 2 It is a structural diagram of the b / s framework automated cloud program upgrade system. DETAILED DESCRIPTION
[0039] The present invention is further described below in conjunction with embodiments. The description of the following embodiments is only used to help understand the present invention. It should be noted that for ordinary persons in the art, without departing from the principle of the present invention, the present invention can also be modified in some ways, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
[0040] Embodiment 1:
[0041] To solve the problems of the prior art, Example 1 of the present application provides a b / s framework automated cloud program upgrade method for upgrading the server side in the b / s framework. The server side can run independently, so it is possible to decide whether to update according to different needs and perform multi-version management.
[0042] Before introducing the method steps of this application, it is necessary to explain that the main technical tools used in this application include crond scheduled tasks and docker container technology. Crond scheduled tasks are used to automatically trigger scripts. For example, scheduled tasks are executed in the early morning every day to avoid the time when users frequently visit. Docker container technology can get rid of the application's dependence on the operating system and only needs to consider the CPU architecture. In addition, Docker container technology has the following characteristics:
[0043] 1. Cross-platform compatibility. Docker provides a consistent operating environment, allowing the same package to run seamlessly in different operating environments, reducing the need to package different installation packages for different operating systems when releasing versions.
[0044] 2. The dependencies required for program operation exist in the container. There is no problem that the program can run on host A but fails to run on host B, which reduces the workload of operation and maintenance.
[0045] 3. Deleting a container will not affect the image, making it easy to roll back when an error occurs.
[0046] Combining crond scheduled tasks and docker container technology, such as Figure 1 As shown, the b / s framework automated cloud program upgrade method provided by the present application includes:
[0047] S1. Get the version to be released.
[0048] S1 includes:
[0049] S101, obtaining an instruction to initiate an update.
[0050] Due to system function iteration / security vulnerabilities and other reasons, the system needs to be updated, and then the update instruction is obtained.
[0051] S102: According to the update initiation instruction, the SQL statement of the newly added function is added to the standard database.
[0052] In the standard database, the database structure of the entire system and some fixed data, such as configuration and default users, are defined. During the code iteration process, when you need to add table structure and configuration, you will add SQL statements (auto-increment id, add new table / configuration) to the standard library. When upgrading, the program will download these newly added SQL statements and execute them to achieve the effect of upgrading the database.
[0053] Specifically, in the graphical interface, add the SQL statements of the newly added functions to the standard database according to the auto-increment ID, MySQL statement, DAMO statement and Renmin University of China Jincang statement. For example, the maximum ID in the standard database is 500, so add a data with ID 501, which contains the SQL statements of the three databases of MySQL, DAMO and Renmin University of China Jincang.
[0054] S103: Upload the front-end and back-end files according to the update initiation instruction.
[0055] Specifically, in the graphical interface, upload the front-end files (static resource files), the x86 docker image and the arm docker image of the application.
[0056] S104: Obtain the version to be released, and define the version number of the version to be released.
[0057] In S104, the version number is provided with a special update identifier, and the special update identifier is used to identify a security upgrade or a test update.
[0058] Specifically, define a release version, click the release button, and mark this version number as valid. The version definition needs to comply with the rules: v2.4.4a, where v stands for version, as the beginning of the version number, 2.4.4 stands for the three version numbers of large, medium and small respectively, and a stands for a special update identifier, including the following options: None, representing a regular upgrade. a, represents a security upgrade, a remedial version issued when a security vulnerability is patched. b, beta update, a test update for immature functions, used to collect bug data and launch new functions first.
[0059] S2. Update the version through automated scripts.
[0060] S2 includes:
[0061] S201. Obtain the latest version number through a scheduled task.
[0062] For example, every morning, a crond scheduled task executes a local script, obtains the last version number marked as valid on the release system through http requests, and selectively updates through locally configured rules to achieve the effect of version control. For example, update all versions (except beta updates); or only perform ongoing version updates, and compare the obtained version information from v2.4.4 to v2.4.0 after regularization with the local version; or only perform security updates and continue only when the version number contains a.
[0063] When it is detected that the new version is consistent with the local version, the process ends; if it is detected that the new version information is greater than the local version information, S202 is executed.
[0064] S202: Download an update package according to its own architecture, where the update package includes a front-end file and a mirror.
[0065] Specifically, download the corresponding image and front-end files through wget.
[0066] S203. According to the type of its own database and the registered number, the SQL statement between the number and the standard database is downloaded and executed, and the registered number is updated.
[0067] S204. Rename the old front-end file to the old version number and stop the background system, that is, stop and delete the docker container.
[0068] S205. Transfer the downloaded front-end files to the corresponding directory and start the back-end image with docker.
[0069] For example, if the address of the front-end file is / www / html, when updating, the old one will be renamed as / www / htmlv1.2.0, and the downloaded file will be transferred to / www / html. Docker will delete the previous container, keep the old image, and run it with the new version number after loading the new image.
[0070] S3. Determine whether the version is updated successfully. If not, trigger the rollback mechanism.
[0071] S3 includes:
[0072] S301. Determine whether the backend image is started successfully through the monitoring script. If it is started successfully, record the log and delete the downloaded front-end and back-end files, and the version update is completed. If it fails to start, execute S302.
[0073] For example, the monitoring script will be triggered some time after S2 ends to monitor whether the Docker container is started successfully.
[0074] In S301, the monitoring method is: use the curl command to call an interface of a backend application program, if there is a response, it means success, and if there is no response, it means failure.
[0075] S302, delete the current backend image and frontend files.
[0076] S303: Restore the backed-up front-end files and back-end images.
[0077] For example, delete / www / html and rename / www / htmlv1.2.0 to / www / html. Delete the running container and restart the image with version number 1.2.0.
[0078] S304, deleting the downloaded front-end and back-end files, and pushing the update failure information, which requires manual intervention.
[0079] Embodiment 2:
[0080] Based on Example 1, Example 2 of the present application provides a more specific b / s framework automated cloud program upgrade method, which is used to upgrade all enterprises that have installed the program, including:
[0081] S1. Preparation stage:
[0082] The operation and maintenance team registers the SQL statements that need to be executed on the release page.
[0083] Upload the ARM and x86 installation packages, as well as the front-end static files.
[0084] S2. Automatic update (taking Group A as an example):
[0085] Group A uses automatic update technology, provides its own architecture (ARM) and database type (DAM database) as parameters, downloads the corresponding ARM installation package from the server, and obtains DAM SQL statements through the interface.
[0086] The specific implementation of the technology is:
[0087] S201. Place the automatic update script in any empty directory;
[0088] S202. Add a crond scheduled task to execute the script every morning;
[0089] S203, modify the configuration items in the script, including: update rules, front-end address ( / www / html in the above) and the address for downloading front-end and back-end files / sql;
[0090] S204 , compare the current SQL sequence number with the SQL sequence number of the publishing system (for example, the current one is 600 and the published one is 650), execute the SQL statements 601-650, and update the own sequence number to 650.
[0091] S3, Program upgrade:
[0092] S301, the script renames the old front end to "file name_old version number";
[0093] S302, moving the front-end static files in the upgrade package to the target location;
[0094] S303: Make the installation package in the upgrade package into a mirror file and run it.
[0095] S4. Verification and rollback mechanism:
[0096] S401, after waiting for two minutes, the script checks the running status of the container;
[0097] S402: If the container runs successfully, the update ends;
[0098] S403: If failure or restart is displayed, a rollback is triggered, including:
[0099] S4031. Delete the new front-end file and restore "file name_old version number" to the original file name.
[0100] S4032. Delete the new backend running container and re-run the old version container.
[0101] S4033. Send an error report to the publishing program and end the update.
[0102] It should be noted that the parts in this embodiment that are the same or similar to those in Embodiment 1 can be referenced to each other and will not be described in detail in this application.
[0103] Embodiment 3:
[0104] Based on Example 1, Example 3 of the present application provides a b / s framework automated cloud program upgrade system, such as Figure 2 As shown, including:
[0105] Acquisition module, used to obtain the version to be released;
[0106] Update module, used for version updates through automated scripts;
[0107] The judgment module is used to judge whether the version is updated successfully. If not, the rollback mechanism is triggered.
[0108] Specifically, the system provided in this embodiment is a system corresponding to the method provided in Embodiment 1. Therefore, the parts in this embodiment that are the same or similar to those in Embodiment 1 can be referenced to each other and will not be repeated in this application.
Claims
1. b / s framework automated cloud program upgrade method, characterized in that: include: S1. Get the version to be released; S2. Version update through automated scripts; S3. Determine whether the version is updated successfully. If not, trigger the rollback mechanism.
2. The b / s framework automatic cloud program upgrade method according to claim 1, characterized in that: S1 includes: S101, obtaining an instruction to initiate an update; S102, adding the SQL statement of the newly added function to the standard database according to the update initiation instruction; S103, uploading the front-end and back-end files according to the update initiation instruction; S104: Obtain the version to be released, and define the version number of the version to be released.
3. The b / s framework automated cloud program upgrade method according to claim 2, characterized in that: In S104, the version number is provided with a special update identifier, and the special update identifier is used to identify a security upgrade or a test update.
4. The b / s framework automatic cloud program upgrade method according to claim 3, characterized in that S2 include: S201, obtain the latest version number through a scheduled task; S202, downloading an update package according to its own architecture, wherein the update package includes a front-end file and an image; S203, according to the type of its own database and the registered number, download and execute the SQL statement between the number and the standard database, and update the registered number; S204, renaming the old front-end file to the old version number, and stopping the back-end system; S205: Transfer the downloaded front-end files to the corresponding directory and start the back-end image.
5. The b / s framework automatic cloud program upgrade method according to claim 4, characterized in that S3 include: S301, determine whether the backend image is successfully started by monitoring the script, if it is successfully started, record the log and delete the downloaded front-end and back-end files, and the version update is completed, if it fails to start, execute S302; S302, delete the current backend image and frontend files; S303, restore the backed-up front-end files and back-end images; S304: Delete the downloaded front-end and back-end files, and push the update failure information.
6. b / s framework automated cloud program upgrade system, characterized by: The method for executing any one of claims 1 to 5 comprises: Acquisition module, used to obtain the version to be released; Update module, used for version updates through automated scripts; The judgment module is used to judge whether the version is updated successfully. If not, the rollback mechanism is triggered.
7. A computer storage medium, characterized in that: The computer storage medium stores a computer program; when the computer program is executed on a computer, the computer executes any one of the methods described in claims 1 to 5.
8. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method and system upgrading application program automatically
CN103067484A
Software update system and method
CN101699399A
Application database updating method based on Android system
CN103324716A
System upgrading method and device for different network environments and storage medium
CN118945175A
Log collection client and updating method therefor
WO2017118334A1