Application publishing method, system and computer readable storage medium
By building an automated release process for the primary and backup machines, the risks of uncontrollable anomalies caused by manual releases are resolved, ensuring stable system operation and secure version releases, reducing request interruptions, and improving release efficiency.
Patent Information
- Application Number
- CN202011558581.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-25
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2040-12-25
AI Technical Summary
In distributed and microservice architectures, manual release operations introduce uncontrollable risks of exceptions and make it difficult to guarantee stable system operation and the security of version releases.
By building scripts for traffic switching, application release, and load balancing between the primary and backup servers, an automated and online application release process is achieved, including traffic switching between the primary and backup servers, application release, and load balancing status switching, and the Jenkins system is introduced to trigger script execution.
It improves the security and system stability of application version releases, reduces request interruption issues caused by releases, and enables a simple and easy-to-operate release process.
Smart Images

Figure CN112559028B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of publishing, and mainly to an application publishing method, system and computer-readable storage medium. Background Art
[0002] With the rise of distributed architecture and microservice architecture, more and more applications need to be released, up to dozens or hundreds of applications. Manual release will bring great risks. In order to reduce the uncontrollable exceptions caused by manual release, this application provides an automated, online, and systematic application release method and system. Summary of the invention
[0003] The embodiments of the present invention provide an application version publishing method, system and computer-readable storage medium to ensure stable operation of the system and improve the security of application version publishing.
[0004] In a first aspect, the present invention provides an application publishing method, the application publishing method being applied to a publishing server, comprising:
[0005] Switch traffic to the host using a pre-built host traffic switching script;
[0006] Deploy applications on the standby machine using pre-built standby application release scripts;
[0007] After verifying that the standby machine application release function is normal, use the pre-built standby machine traffic switching script to switch traffic to the standby machine;
[0008] Deploy applications on the host using pre-built host application release scripts;
[0009] After verifying that the host application release function is normal, the traffic is switched to the load balancing state of the master and backup machines through the pre-built load balancing switching script.
[0010] Optionally, the content of the host traffic switching script includes: remotely changing the load IP of the reverse proxy to the host IP configuration, and hot loading the configuration;
[0011] The content of the backup machine traffic switching script includes: remotely changing the load IP of the reverse proxy to the backup machine IP configuration, and hot loading the configuration;
[0012] The content of the load balancing switching script includes: remotely changing the load IP of the reverse proxy to a common load configuration of the host IP and the backup IP, and hot loading the configuration.
[0013] Optionally, before switching traffic to the host using a pre-built host traffic switching script, the process includes:
[0014] Use the pre-built clean compiled application script to clear the files in the pre-created host application folder and standby application folder;
[0015] Update the source code in the application source code folder of the release server through the pre-built update application code script;
[0016] Compile the source code using the pre-built application code compilation script, and move the generated application war packages to the host application folder and the standby application folder respectively.
[0017] Optionally, before updating the source code in the application source code folder of the release server by using the pre-built update application code script, the following steps are included:
[0018] Clone the source code from the source code repository to the application source code folder on the release server;
[0019] Create a master release application list information file and a standby release application list information file.
[0020] Optionally, the method of compiling the source code by using a pre-built application code compilation script and moving the compiled application war package to the host application folder and the standby application folder respectively includes:
[0021] Use the pre-built backup application code script to copy the application war package to the pre-created master application backup folder and standby application backup folder.
[0022] Optionally, the content of the application release script includes:
[0023] Determine whether there is a file in the standby machine application folder. If not, output the log and end. If yes, continue.
[0024] Traverse the standby machine application folder, and then nest the loop standby machine release application list information file;
[0025] Determine whether the first 6 characters of the name of the standby machine release application list information file are the same as the release application number. If they are not the same, continue the loop traversal. If they are the same, continue;
[0026] Copy the application war package in the standby machine's release application list information file to the temporary file directory on the standby machine's application server;
[0027] Get the application service process ID by remotely executing commands, and stop the application service process by remotely executing commands based on the application service process ID. Wait for 5 seconds, delete the current application war package under the application service, and move the application war package in the temporary file directory to the application service.
[0028] Remotely execute commands to forcibly stop application services;
[0029] Remotely execute commands to start application services;
[0030] Output the application war package name, target server IP and startup logo in the temporary file directory;
[0031] The content of the host application release script includes:
[0032] Determine whether there is a file in the host application folder. If not, output the log and end. If yes, continue.
[0033] Traverse the host application folder, and then nest the loop host release application list information file;
[0034] Determine whether the first 6 characters of the host release application list information file name are the same as the release application number. If they are not the same, continue to loop through them. If they are the same, continue.
[0035] Copy the application war package in the host release application list information file to the temporary file directory on the application server;
[0036] Obtain the application service process ID by remotely executing commands;
[0037] Remotely execute the command to stop the application service process, wait for 5 seconds, delete the current application war package under the application service, and move the application war package in the temporary file directory to the application service;
[0038] Remotely execute commands, force stop, application services;
[0039] Remotely execute commands to start application services;
[0040] Output the application war package name, target server IP and startup logo in the temporary file directory.
[0041] Optionally, the application publishing method further includes:
[0042] Clear JS, CSS cache URL connections via pre-built clear JS, CSS cache scripts.
[0043] Optionally, the application publishing method further includes:
[0044] The execution of each script is triggered by the pre-built open source software Jenkins system service.
[0045] In a second aspect, the present invention further provides an application publishing system, the application publishing system comprising:
[0046] A memory, a processor, and a computer program stored in the memory and executable on the processor;
[0047] When the computer program is executed by the processor, the steps of the application publishing method as described in any one of the above items are implemented.
[0048] In a second aspect, the present invention further provides a computer-readable storage medium, on which an application publishing program is stored, and when the application publishing program is executed by a processor, the steps of the application publishing method as described in any one of the above items are implemented.
[0049] The application of the technical solution of the present invention ensures the stable operation of the system and improves the security of application version release. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 is a flowchart of an application publishing method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0051] The present invention discloses an application publishing method, system and computer-readable storage medium. Those skilled in the art can refer to the content of this article and appropriately improve the process parameters to achieve it. It should be particularly pointed out that all similar substitutions and modifications are obvious to those skilled in the art, and they are all considered to be included in the present invention, and relevant personnel can obviously modify or appropriately change and combine the contents described in this article without departing from the content, spirit and scope of the present invention to implement and apply the technology of the present invention.
[0052] In the present invention, unless otherwise specified, the scientific and technical terms used herein have the meanings commonly understood by those skilled in the art.
[0053] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention is further described in detail below in conjunction with specific embodiments.
[0054] Embodiment 1
[0055] The invention discloses an application publishing method, which is applied to the publishing of a type of system service, and includes an online publishing system integrating source code update, source code compilation, application backup, traffic switching, application publishing, publishing rollback and JS / CSS cache prevention method.
[0056] The embodiment of the present invention provides an application publishing method, such as Figure 1 As shown, the application publishing method is applied to a publishing server, including:
[0057] Step 1: Switch traffic to the host using the pre-built host traffic switching script;
[0058] Step 2: Use the pre-built standby application release script to release the application on the standby machine.
[0059] Step 3: After verifying that the standby machine application release function is normal, switch the traffic to the standby machine through the pre-built standby machine traffic switching script;
[0060] Step 4: Publish the application on the host using the pre-built host application publishing script;
[0061] Step 5: After verifying that the host application release function is normal, the traffic is switched to the load balancing state of the host and the standby machine through the pre-built load balancing switching script.
[0062] Optionally, the content of the host traffic switching script includes: remotely changing the load IP of the reverse proxy to the host IP configuration, and hot loading the configuration;
[0063] The content of the backup machine traffic switching script includes: remotely changing the load IP of the reverse proxy to the backup machine IP configuration, and hot loading the configuration;
[0064] The content of the load balancing switching script includes: remotely changing the load IP of the reverse proxy to a common load configuration of the host IP and the backup IP, and hot loading the configuration.
[0065] The embodiment of the present invention executes the above steps on a dedicated publishing server, converts publishing operation commands into script commands, effectively improves publishing efficiency, and can be operated online without time restrictions; it can automatically distribute access traffic; and reduce request interruption problems caused by publishing.
[0066] The application deployment in the embodiment of the present invention mainly includes two environments: the host and the backup. These two environments share the same set of codes and databases, can be used independently, and can be load balanced. These two environments ensure that version updates do not affect user use, and users will not feel anything during the release process, ensuring the stable operation of the system and effectively improving the security of version release. The release process is simple and easy to operate, making it convenient for personnel to manage.
[0067] The host and standby can be multiple tomcat servers or one. Through the host registration center and the standby registration center, multiple servers can be configured in different environments. Through the traffic switching button, the traffic can be switched to the host, standby, or load balancing state with one click.
[0068] In some implementations, before switching traffic to the host using a pre-built host traffic switching script, the process includes:
[0069] Use the pre-built clean compiled application script to clear the files in the pre-created host application folder and standby application folder;
[0070] Update the source code in the application source code folder of the release server through the pre-built update application code script;
[0071] Compile the source code using the pre-built application code compilation script, and move the generated application war packages to the host application folder and the standby application folder respectively.
[0072] Optionally, the method of compiling the source code by using a pre-built application code compilation script and moving the compiled application war package to the host application folder and the standby application folder respectively includes:
[0073] Use the pre-built backup application code script to copy the application war package to the pre-created master application backup folder and standby application backup folder.
[0074] Optionally, the content of the application release script includes:
[0075] Determine whether there is a file in the standby machine application folder. If not, output the log and end. If yes, continue.
[0076] Traverse the standby machine application folder, and then nest the loop standby machine release application list information file;
[0077] Determine whether the first 6 characters of the name of the standby machine release application list information file are the same as the release application number. If they are not the same, continue the loop traversal. If they are the same, continue;
[0078] Copy the application war package in the standby machine's release application list information file to the temporary file directory on the standby machine's application server;
[0079] Get the application service process ID by remotely executing commands, and stop the application service process by remotely executing commands based on the application service process ID. Wait for 5 seconds, delete the current application war package under the application service, and move the application war package in the temporary file directory to the application service.
[0080] Remotely execute commands to forcibly stop application services;
[0081] Remotely execute commands to start application services;
[0082] Output the application war package name, target server IP and startup logo in the temporary file directory;
[0083] The content of the host application release script includes:
[0084] Determine whether there is a file in the host application folder. If not, output the log and end. If yes, continue.
[0085] Traverse the host application folder, and then nest the loop host release application list information file;
[0086] Determine whether the first 6 characters of the host release application list information file name are the same as the release application number. If they are not the same, continue to loop through them. If they are the same, continue.
[0087] Copy the application war package in the host release application list information file to the temporary file directory on the application server;
[0088] Obtain the application service process ID by remotely executing commands;
[0089] Remotely execute the command to stop the application service process, wait for 5 seconds, delete the current application war package under the application service, and move the application war package in the temporary file directory to the application service;
[0090] Remotely execute commands, force stop, application services;
[0091] Remotely execute commands to start application services;
[0092] Output the application war package name, target server IP and startup logo in the temporary file directory.
[0093] Optionally, clear the URL connection of JS and CSS cache through pre-built scripts for clearing JS and CSS cache. Trigger the execution of each script through the pre-built open source software Jenkins system service.
[0094] Specifically, the application release environment includes at least a release server, a source code repository, a Jenkins system, and an application runtime environment. An application release method includes the following steps:
[0095] S1. Build and execute to clear the compiled application scripts;
[0096] S2, build and execute the update application code script;
[0097] S3, build and execute compiled application code script;
[0098] S4, building and executing the backup application code script;
[0099] S5. Build and execute the host traffic switching script to switch the traffic to the host;
[0100] S6. Build and execute the first batch of application release scripts on the standby machine to release the applications on the standby machine;
[0101] S7. Build and execute the second batch of application release scripts on the standby machine to release the applications on the standby machine.
[0102] S8. After the step described in S7 is completed, whether to build and execute the rollback standby machine application script is determined according to whether the test passes;
[0103] S9. Build and execute the backup machine traffic switching script to switch the traffic to the backup machine;
[0104] S10, build and execute the first batch of application release scripts on the host to release the application on the host;
[0105] S11, build and execute the second batch of application release scripts on the host to release the application on the host;
[0106] S12. After the step S11 is completed, whether to build and execute the fallback host application script is determined according to whether the test passes;
[0107] S13, build and execute the load balancing switching script to switch the traffic to the load balancing state;
[0108] S14. Build and execute scripts to clear JS and CSS caches, and decide whether to execute based on the release requirements.
[0109] The following preparations need to be made in advance: clone the source code from the source code repository to the application source code folder of the release server; create the host release application list information file and the standby release application list information file. Details include:
[0110] S20. Install the version control client on the release server;
[0111] S21. Generate SSH public and private keys on the distribution server. The main commands are:
[0112] ssh-keygen –trsa;
[0113] S22, configuring the public key generated in S21 in the source code repository to establish a secure connection;
[0114] S23, cloning the application code from the source code repository to the application source code folder of the release server;
[0115] S24, configuring password-free login on all servers in the application running environment using the public key generated in S21 to establish a secure connection;
[0116] S25. Create a publishing folder on the publishing server;
[0117] S26. Create a host application folder under the release folder described in S25;
[0118] S27. Create a backup application folder under the release folder described in S25;
[0119] S28. Create a host latest application folder under the release folder described in S25, and copy the host latest application service to this folder;
[0120] S29. Create a backup machine's latest application folder under the release folder described in S25, and copy the backup machine's latest application service to this folder;
[0121] S30, creating a host application history release folder under the release folder described in S25;
[0122] S31. Create a backup application history release folder under the release folder described in S25;
[0123] S32, creating a host application backup folder under the release folder described in S25;
[0124] S33, creating a backup folder for standby application under the release folder described in S25;
[0125] S34, under the release folder described in S25, create a list of information files of the first batch of release applications of the host, which includes application number, application server IP, application war name, tomcat service path, tomcat service name, and is separated by space characters;
[0126] S35. Create a host second batch release application list information file in the release folder described in S25, which contains application number, application server IP, application war name, tomcat service path, tomcat service name, and is separated by space characters;
[0127] S36. Create a first batch of release application list information files for the standby machine under the release folder described in S25. The files contain application ID, application server IP, application war name, tomcat service path, and tomcat service name, separated by spaces.
[0128] S37. Create a second batch of standby release application list information file in the release folder described in S25. The file contains application number, application server IP, application war name, tomcat service path, and tomcat service name, separated by spaces.
[0129] S38. Build the open source software Jenkins system service;
[0130] Wherein, the step S1 specifically includes:
[0131] S40, the script is stored in the release folder described in S25;
[0132] S41, the script content includes a) deleting all files in the host application folder in S26 and b) deleting all files in the standby application folder in S27;
[0133] S42, the script is an executable file;
[0134] S43, the script is triggered and executed by the JENKINS system described in S38;
[0135] The step S2 specifically comprises:
[0136] S44, the script is stored in the release folder of S25;
[0137] S45, the script content includes a) entering the application source code folder in S23, and b) executing a source code update command;
[0138] S46, the script is an executable file;
[0139] S47, the script is triggered and executed by the JENKINS system described in S38;
[0140] The step S3 specifically comprises:
[0141] S44, the script is stored in the release folder of S25;
[0142] S45, the script content includes a) entering the application source code folder in S23, b) executing the source code host compilation command, and moving the generated war package to the host application folder in S26, c) executing the source code standby machine compilation command, and moving the generated war package to the standby machine application folder in S27;
[0143] S46, the script is an executable file;
[0144] S47, the script is triggered and executed by the JENKINS system described in S38;
[0145] Wherein, the step S4 specifically includes:
[0146] S48, the script is stored in the release folder described in S25;
[0147] S49, the script content includes a) judging whether there is a file in the host application folder of S26, if so, continue, otherwise end, b) delete all files in the folder of S32, c) traverse the host application folder of S26, and then nest the loop of the host latest application folder of S28, and judge whether the names of the host latest application folders of S26 and S28 are consistent, if they are consistent, copy the current file in the host latest application folder of S28 to the folder of S32, and output the file name log, otherwise continue; d) after the traversal is completed, judge whether there is a file in the standby application folder of S27, if so, continue, otherwise end, e) delete all files in the folder of S33, f) traverse the files of S27, and then nest the loop of the files of S29, and judge whether the names of the files of S27 and S29 are consistent, if they are consistent, copy the current file in the folder of S29 to the folder of S33, and output the file name log, otherwise continue;
[0148] S50, the script is an executable file;
[0149] S51, the script is triggered and executed by the JENKINS system described in S38;
[0150] Wherein, the step S5 specifically includes:
[0151] S52, the script is stored in the release folder of S25;
[0152] S53, the script content includes remotely changing the load IP of the reverse proxy to the host IP configuration, and hot loading the configuration;
[0153] S54, the script is an executable file;
[0154] S55, the script is triggered and executed by the JENKINS system described in S38;
[0155] Wherein, the step S6 specifically includes:
[0156] S56, the script is stored in the release folder described in S25;
[0157] S57, the script content includes a) judging whether there is a file in the standby application folder of S27, if not, output the log and end, if yes, continue, b) traverse the files of S27, and then nest the loop of S36, c) judge the first 6 characters of the current file name and the application number, if they are different, continue the loop traversal, if they are the same, perform d and subsequent commands, d) copy the current file to the temporary file directory on the application server by using the scp command; e) obtain the application service process ID by remote execution command, f) remotely execute the command to stop the application service process, wait for 5 seconds, delete the existing application war package, and move the new application war package from the temporary directory to the application service, g) remotely execute the command kill-9$PID to force stop, h) remotely execute the command to start the application service, i) output the application war name, target server ip and startup logo;
[0158] S58, the script is an executable file;
[0159] S59, the script is triggered and executed by the JENKINS system described in S38;
[0160] Wherein, the step S7 specifically includes:
[0161] S60, the script is stored in the release folder described in S25;
[0162] S61, the script content includes a) judging whether there is a file in the standby application folder of S27, if not, output the log and end, if yes, continue, b) traverse the files of S27, and then nest the loop of S37, c) judge the first 6 characters of the current file name and the application number, if they are different, continue the loop traversal, if they are the same, perform d and subsequent commands, d) copy the current file to the temporary file directory on the application server with the scp command; e) obtain the application service process ID by remote execution command, f) remotely execute the command to stop the application service process, wait for 5 seconds, delete the existing application war package, and move the new application war package from the temporary directory to the application service, g) remotely execute the command kill-9$PID to force stop, h) remotely execute the command to start the application service, i) output the application war name, target server ip and startup logo; j) after the traversal loop ends, copy all the files of S27 with the \cp command and overwrite them to the folder of S29, k) move all the files of S27 to the folder of S31 with the mv command, and name the folder with the current time;
[0163] S62, the script is an executable file;
[0164] S63, the script is triggered and executed by the JENKINS system described in S38;
[0165] Optionally, the step S8 specifically includes:
[0166] S64, after verification, the system function is released to see if it passes. If it passes, no need to perform this operation. If it fails, perform the operation;
[0167] S65, the script is stored in the release folder described in S25;
[0168] S66, the script content includes a) judging whether there is a file in the folder in S33, if not, outputting a log and ending, if yes, continuing, b) deleting all files in the standby application folder in S27, c) moving all files in S33 to the standby application folder in S27;
[0169] S67, the script is an executable file;
[0170] S68, the script is triggered and executed by the JENKINS system described in S38;
[0171] Optionally, the step S9 specifically includes:
[0172] S69, the script is stored in the release folder of S25;
[0173] S70, the script content includes remotely changing the load IP of the reverse proxy to the backup machine IP configuration, and hot loading the configuration;
[0174] S71, the script is an executable file;
[0175] S72, the script is triggered and executed by the JENKINS system described in S38;
[0176] Optionally, the step S10 specifically includes:
[0177] S73, the script is stored in the release folder of S25;
[0178] S74, the script content includes a) judging whether there is a file in the host application folder of S26, if not, output the log and end, if yes, continue, b) traverse the files of S26, and then nest the loop of S34, c) judge the first 6 characters of the current file name and the application number, if they are different, continue the loop traversal, if they are the same, perform d and subsequent commands, d) copy the current file to the temporary file directory on the application server by using the scp command; e) obtain the application service process ID by remote execution command, f) remotely execute the command to stop the application service process, wait for 5 seconds, delete the existing application war package, and move the new application war package from the temporary directory to the application service, g) remotely execute the command kill-9$PID to force stop, h) remotely execute the command to start the application service, i) output the application war name, target server ip and startup logo;
[0179] S75, the script is an executable file;
[0180] S76, the script is triggered and executed by the JENKINS system described in S38;
[0181] Wherein, the step S11 specifically includes:
[0182] S77, the script is stored in the release folder of S25;
[0183] S78, the script content includes a) judging whether there is a file in the host application folder of S26, if not, output the log and end, if yes, continue, b) traverse the files of S26, and then nest the loop of S35, c) judge the first 6 characters of the current file name and the application number, if they are different, continue the loop traversal, if they are the same, perform d and subsequent commands, d) copy the current file to the temporary file directory on the application server with the scp command; e) obtain the application service process ID by remote execution command, f) remotely execute the command to stop the application service process, wait for 5 seconds, delete the existing application war package, and move the new application war package from the temporary directory to the application service, g) remotely execute the command kill-9$PID to force stop, h) remotely execute the command to start the application service, i) output the application war name, target server ip and startup logo; j) after the traversal loop ends, copy all the files of S26 with the \cp command and overwrite them to the latest application folder of the host in S28, k) move all the files of S26 to the folder of S30 with the mv command, and name the folder with the current time;
[0184] S79, the script is an executable file;
[0185] S80, the script is triggered and executed by the JENKINS system described in S38;
[0186] Wherein, the step S12 specifically includes:
[0187] S81. After verification, the system function is released to see if it passes. If it passes, no need to perform this operation. If it fails, perform the operation;
[0188] S82, the script is stored in the release folder of S25;
[0189] S83, the script content includes a) judging whether there is a file in the folder of S32, if not, outputting a log and ending, if yes, continuing, b) deleting all files in the host application folder of S26, c) moving all files of S32 to the host application folder of S26;
[0190] S84, the script is an executable file;
[0191] S85, the script is triggered and executed by the JENKINS system described in S38;
[0192] Wherein, the step S13 specifically includes:
[0193] S86, the script is stored in the release folder of S25;
[0194] S87, the script content includes remotely changing the load IP of the reverse proxy to a common load configuration of the host and backup IP, and hot loading the configuration;
[0195] S88, the script is an executable file;
[0196] S89, the script is triggered and executed by the JENKINS system described in S38;
[0197] Wherein, the step S13 specifically includes:
[0198] S90, the script is stored in the release folder described in S25;
[0199] S91, the script content includes remotely changing the load IP of the reverse proxy to a common load configuration of the host and backup IP, and hot loading the configuration;
[0200] S92, the script is an executable file;
[0201] S93, the script is triggered and executed by the JENKINS system described in S38;
[0202] Wherein, the step S14 specifically includes:
[0203] S94, the script is stored in the release folder described in S25;
[0204] S95, the script content accesses the URL connection provided by the web project to clear the JS and CSS cache;
[0205] S96. The script is an executable file;
[0206] S97, the script is triggered to execute by the JENKINS system described in S38;
[0207] The present application provides a flowchart of an application publishing method, which is applied to publishing and updating, and mainly includes the following steps.
[0208] First, clear the compiled war package to ensure the purity of the content to be updated in this release and avoid publishing unauthorized content to the server;
[0209] Update the latest source code, compile and build the project. If the build fails, the reason for the failure will be prompted. If the build succeeds, proceed to the next step.
[0210] The one-click traffic switching method implemented by the present invention is used to switch all user traffic using the system to the host, and after ensuring that no one is using the standby machine, click deploy to update all war packages with one click, and restart the server;
[0211] Verify whether the standby version release function is normal. If the test fails, you can directly roll back the code or wait for the developer to modify the code and submit it, then re-release the version to the standby machine and perform verification test again;
[0212] After the backup server version verification is passed, all traffic will be switched to the backup server environment. After confirming that there are no abnormalities, the version host will be released.
[0213] Host post-release verification;
[0214] If the verification is successful, the traffic can be switched to load balancing state;
[0215] If the code update content involves the modification of static files, such as js, css and other files, click the "jscss" button to update the version number with one click, and the version is now published. The "jscss" button can update the version number of static files with one click, provided that the version number is set for each static file when writing the code. After the version is updated, the user only needs to refresh the interface, and the system will automatically load the latest version number, effectively avoiding system abnormalities caused by the failure to update the browser cache.
[0216] The embodiment of the present invention mainly aims at publishing with multiple applications and multiple target servers; online and systematic operation of publishing; request interruption problem during publishing; static files being browsed and cached; the embodiment of the present invention provides a dedicated publishing server; configures SSH password-free login of the publishing server and all application servers; converts publishing operation commands into script commands; introduces a publishing backup mechanism; introduces a publishing rollback mechanism; introduces the open source software Jenkins system; the embodiment of the present invention improves publishing efficiency, can be online without time restrictions; can automatically distribute access traffic; reduces request interruption problems caused by publishing; can roll back to the previous version of publishing; updates JS / CSS cache problems to solve the problem of not taking effect immediately after publishing.
[0217] Embodiment 2
[0218] An embodiment of the present invention provides an application publishing system, the application publishing system comprising:
[0219] A memory, a processor, and a computer program stored in the memory and executable on the processor;
[0220] When the computer program is executed by the processor, the steps of the application publishing method as described in any one of the first embodiments are implemented.
[0221] Embodiment 3
[0222] An embodiment of the present invention provides a computer-readable storage medium, on which an application publishing program is stored. When the application publishing program is executed by a processor, the steps of the application publishing method as described in any one of the first embodiments are implemented.
[0223] In the specific implementation process of Embodiment 2 and Embodiment 3, reference may be made to Embodiment 1, and corresponding technical effects are achieved.
[0224] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for publishing an application, characterized in that: The application publishing method is applied to a publishing server and includes: Switch traffic to the host using a pre-built host traffic switching script; Deploy the application on the standby machine using the pre-built standby application release script; After verifying that the standby machine's application release function is normal, switch traffic to the standby machine using the pre-built standby machine traffic switching script; Deploy the application on the host using a pre-built host application deployment script; After verifying that the host application release function is normal, the traffic is switched to the load balancing state of the master and backup machines through the pre-built load balancing switching script.
2. The application publishing method according to claim 1, characterized in that: The content of the host traffic switching script includes: remotely changing the load IP of the reverse proxy to the host IP configuration, and hot loading the configuration; The content of the backup machine traffic switching script includes: remotely changing the load IP of the reverse proxy to the backup machine IP configuration, and hot loading the configuration; The content of the load balancing switching script includes: remotely changing the load IP of the reverse proxy to a common load configuration of the host IP and the backup IP, and hot loading the configuration.
3. The application publishing method according to claim 1, characterized in that: Before switching traffic to the host using the pre-built host traffic switching script, the following steps are performed: Use the pre-built clean compiled application script to clear the files in the pre-created host application folder and standby application folder; Update the source code in the application source code folder of the release server through the pre-built update application code script; Compile the source code using the pre-built application code compilation script, and move the generated application war packages to the host application folder and the standby application folder respectively.
4. The application publishing method according to claim 3, characterized in that: Before updating the source code in the application source code folder of the release server using the pre-built update application code script, the following steps are included: Clone the source code from the source code repository to the application source code folder on the release server; Create a master application release list information file and a backup application release list information file.
5. The application publishing method according to claim 3, characterized in that: The process of compiling the source code using a pre-built application code compilation script and moving the compiled application war package to the host application folder and the standby application folder respectively includes: Use the pre-built backup application code script to copy the application war package to the pre-created master application backup folder and standby application backup folder.
6. The application publishing method according to claim 5, characterized in that: The content of the standby application release script includes: Determine whether there is a file in the standby machine's application folder. If not, output the log and end. If yes, continue. Traverse the standby machine application folder, and then nest the loop standby machine release application list information file; Determine whether the first 6 characters of the standby machine release application list information file name are the same as the release application number. If they are not the same, continue the loop; if they are the same, continue; Copy the application war package in the standby machine's release application list information file to the temporary file directory on the standby machine's application server; Obtain the application service process ID by remotely executing a command. Use the remote command to stop the application service process based on the application service process ID. Wait for 5 seconds, delete the current application war package under the application service, and move the application war package in the temporary file directory to the application service. Remotely execute commands to forcibly stop application services; Remotely execute commands to start application services; Output the application war package name, target server IP and startup logo in the temporary file directory; The content of the host application release script includes: Determine whether there is a file in the host application folder. If not, output the log and end. If yes, continue. Traverse the host application folder, and then nest the loop host release application list information file; Determine whether the first 6 characters of the host release application list information file name are the same as the release application number. If they are not the same, continue the loop; if they are the same, continue; Copy the application war package in the host release application list information file to the temporary file directory on the application server; Obtain the application service process ID by remotely executing commands; Remotely execute the command to stop the application service process, wait for 5 seconds, delete the current application war package under the application service, and move the application war package in the temporary file directory to the application service; Remotely execute commands, force stop, application services; Remotely execute commands to start application services; Output the application war package name, target server IP and startup logo in the temporary file directory.
7. The application publishing method according to claim 1, characterized in that: The application publishing method further includes: Clear JS and CSS cache URL connections using pre-built clear JS and CSS cache scripts.
8. The application publishing method according to any one of claims 1 to 7, characterized in that: The application publishing method further includes: Each script execution is triggered by the pre-built open source software Jenkins system service.
9. An application publishing system, characterized in that: The application publishing system includes: A memory, a processor, and a computer program stored on the memory and executable on the processor; When the computer program is executed by the processor, the steps of the application publishing method according to any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores an application publishing program, which, when executed by a processor, implements the steps of the application publishing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Spliced model online putting method based on application master and slave machine online check
CN106250528A
Method and system for version update in mobile application based on Weex
CN107577491A
Distributed NAT duplicated hot-redundancy traffic switching system and method
CN108574626A
Master-slave switching method, device and system of load balancing service, and server
CN109618000A
Application request processing method and device and router
CN109729131A
