Application deployment method and device, electronic equipment and storage medium

By generating image files and sending deployment commands, automated application deployment is achieved, solving the problems of cumbersome and inefficient traditional deployment processes, and improving deployment efficiency and reliability.

CN119440558APending Publication Date: 2025-02-14GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411492611.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

Traditional application deployment processes are cumbersome and inefficient, and it is difficult for development and business personnel to obtain deployment results in a timely manner, affecting problem investigation and decision-making.

Method used

By obtaining the code information of the application to be deployed, a mirror file is generated and stored in the mirror warehouse, a deployment command is sent to the second electronic device, so that it downloads the mirror file and generates a container, and automatic deployment is achieved.

Benefits of technology

It realizes automated deployment, improves application deployment efficiency, reduces the complexity and error rate of manual operations, and provides timely deployment results to support problem investigation and decision-making.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440558A_ABST
    Figure CN119440558A_ABST
Patent Text Reader

Abstract

The invention is applicable to the technical field of computer software, and provides an application deployment method, which comprises the following steps: acquiring code information of a to-be-deployed application; generating a mirror image file based on the code information, and storing the mirror image file in a mirror image warehouse; and under the condition that the mirror image file is stored in the mirror image warehouse, sending a deployment command to a second electronic device, so that the second electronic device logs in the mirror image warehouse based on the deployment command to download the mirror image file, generates a container based on the mirror image file, and deploys the application based on the container. Automatic deployment can be realized, so that the application deployment efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer software technology, and in particular, relates to an application deployment method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of the software industry, the efficiency and reliability of application deployment have become the focus of enterprises. The traditional deployment process is cumbersome and requires manual operation, resulting in low deployment efficiency. Moreover, after the application is deployed, developers and business personnel cannot obtain deployment results in a timely manner, affecting problem troubleshooting and decision-making. Summary of the invention

[0003] The embodiments of the present application provide an application deployment method, device, electronic device and storage medium, which can improve the deployment efficiency of the application.

[0004] In a first aspect, an embodiment of the present application provides an application deployment method, which is applied to a first electronic device, including:

[0005] Get the code information of the application to be deployed;

[0006] Generate an image file based on the code information, and store the image file in an image warehouse;

[0007] When it is determined that the image repository stores the image file, a deployment command is sent to the second electronic device, so that the second electronic device logs in to the image repository based on the deployment command to download the image file, generates a container based on the image file, and deploys the application based on the container, wherein the deployment command is used to instruct the second electronic device to deploy the application.

[0008] In some embodiments, generating an image file based on the code information includes:

[0009] Compiling based on the code information and packaging the compiled files;

[0010] After the packaging is completed, an image file is produced based on the packaged files to generate an image file.

[0011] In some embodiments, the method further comprises:

[0012] Obtain log information during the compilation process, packaging process and / or image file creation process;

[0013] Output the log information.

[0014] In some embodiments, the method further comprises:

[0015] When the login information of the second electronic device is obtained, verifying the login information;

[0016] When the login information is verified, the mirror file is sent to the second electronic device.

[0017] In a second aspect, an embodiment of the present application provides an application deployment method, which is applied to a second electronic device, and the method includes:

[0018] When a deployment command sent by the first electronic device is obtained, logging into an image warehouse, wherein the image warehouse stores an image file generated based on code information of an application to be deployed, and the deployment command is used to instruct the second electronic device to deploy the application;

[0019] Downloading an image file corresponding to the code information of the application to be deployed from the image repository;

[0020] Generate a container based on the image file;

[0021] Applications are deployed based on the container.

[0022] In some embodiments, the method further comprises:

[0023] Determine whether there is a historical version of the image file;

[0024] If a historical version of the image file exists, the image file of the historical version is deleted, and the container corresponding to the historical version is deleted.

[0025] In some embodiments, the method further comprises:

[0026] Determine the deployment result and deployment time of the application;

[0027] Generate notification information based on the deployment result and the deployment time;

[0028] The notification information is sent to the target person.

[0029] In a third aspect, an embodiment of the present application provides an application deployment device, applied to a first electronic device, including:

[0030] The acquisition module is used to obtain the code information of the application to be deployed;

[0031] A storage module, used to generate an image file based on the code information, and store the image file in an image warehouse;

[0032] The sending module is used to send a deployment command to the second electronic device when it is determined that the image warehouse stores the image file, so that the second electronic device logs in to the image warehouse to download the image file, generates a container based on the image file, and deploys the application based on the container.

[0033] In a fourth aspect, an embodiment of the present application provides an application deployment device, applied to a second electronic device, including:

[0034] A login module, configured to log in to the image repository upon acquiring a deployment command sent by the first electronic device;

[0035] A download module, used to download the image file from the image repository;

[0036] A generation module, used to generate a container based on the image file;

[0037] A deployment module is used to deploy applications based on the container.

[0038] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the methods described above when executing the computer program.

[0039] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements any of the methods described above.

[0040] In a seventh aspect, an embodiment of the present application provides a computer program product, which, when executed on a terminal device, enables the electronic device to execute any of the methods described above.

[0041] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0042] The application deployment method provided in the embodiment of the present application obtains code information of the application to be deployed; generates an image file based on the code information, and stores the image file in an image warehouse; when it is determined that the image warehouse stores the image file, sends a deployment command to the second electronic device, so that the second electronic device logs in to the image warehouse based on the deployment command to download the image file, generates a container based on the image file, and deploys the application based on the container. The deployment of the application based on the container can achieve automatic deployment, thereby improving the deployment efficiency of the application.

[0043] It can be understood that the beneficial effects of the second to seventh aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0045] Figure 1 A schematic diagram of an implementation flow of an application deployment method provided for the implementation of this application;

[0046] Figure 2 A schematic diagram of the implementation process of another application deployment method provided for the implementation of this application;

[0047] Figure 3 A schematic diagram of the structure of an application deployment device provided in an embodiment of the present application;

[0048] Figure 4 A schematic diagram of the structure of another application deployment device provided in an embodiment of the present application;

[0049] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0051] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0052] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0053] As used in the specification of this application and the appended claims, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting" depending on the context. Similarly, the phrases "if it is determined" or "if it is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce detected" or "in response to detecting" depending on the context.

[0054] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0055] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.

[0056] Based on the technical problems of the related technology, the embodiments of the present application provide an application deployment method that can be applied to electronic devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), etc. The embodiments of the present application do not impose any restrictions on the specific types of electronic devices.

[0057] The functions implemented by the application deployment method provided in the embodiment of the present application can be implemented by the processor of the first electronic device calling the program code, wherein the program code can be stored in a computer storage medium.

[0058] A first aspect of the present application provides an application deployment method, which is applied to a first electronic device. Figure 1 A schematic diagram of an implementation flow of an application deployment method provided for the implementation of this application, such as Figure 1 As shown, the application deployment method includes:

[0059] Step S101, obtaining code information of the application to be deployed.

[0060] In an embodiment of the present application, the first electronic device obtains the latest code information of the application to be deployed through a source code management system (such as Git) or other methods.

[0061] In the embodiment of the present application, obtaining the code information of the application to be deployed is the initial step in the application deployment process, which is intended to obtain the source code or related code information of the application to be deployed from a suitable source or location. Such code information usually contains necessary elements such as the application's functional implementation, configuration files, and dependent library declarations to support the subsequent building and deployment process.

[0062] In an embodiment of the present application, first, it is necessary to clarify the location where the code information is stored. This can be a source code management system (such as a Git repository), a local file system, a version control tool, etc. If the code information is stored in a protected location (such as a private Git repository), access rights need to be verified to ensure that only authorized users can obtain the code. Use appropriate tools or commands (such as git clone, svn checkout, etc.) to download or pull the latest code information from the code source. This step may require specifying a specific branch, tag, or commit ID to ensure that the correct version of the code is obtained. Optionally, basic verification is performed on the obtained code, such as checking file integrity, running unit tests, etc., to ensure that the code is reliable and meets expectations before deployment.

[0063] In some embodiments, developers may also write codes and then send the codes to a Git repository, and the electronic device may obtain code information of the application to be deployed from the Git repository.

[0064] Step S102: Generate an image file based on the code information, and store the image file in an image repository.

[0065] In an embodiment of the present application, a Dockerfile can be written, and the Docker command line tool (such as docker build) can be used to execute the instructions in the Dockerfile to build a Docker image of the application. Among them, Dockerfile is a text file that contains a series of instructions that describe how to start from a base image and gradually build the image required for the application. These instructions may include setting the working directory, adding files, installing dependencies, compiling applications, etc. During the construction process, Docker will execute the instructions in the order in the Dockerfile, and generate an intermediate image at each step, and finally generate a complete image containing the application and all its dependencies.

[0066] In some embodiments, a Jenkins automated deployment service may be deployed in the first electronic device, and an image file may be generated through the Jenkins automated deployment service.

[0067] In the embodiment of the present application, in order to facilitate subsequent management and reference, a tag can be added to the built image. The tag usually contains information such as version number, build date, environment identifier, etc., which helps to distinguish different versions of the image.

[0068] In an embodiment of the present application, after the image is built and marked, the Docker command line tool (such as dockerpush) is used to push the image to the image repository. Among them, the image repository is a service that centrally stores and manages Docker images, which can be public (such as Docker Hub) or private (such as Harbor). When pushing an image, you need to specify the address of the image repository, the username and password (if necessary), and the name and tag of the image. After the push is completed, you can verify in the image repository whether the image has been successfully stored. This usually involves viewing the image list on the web interface of the image repository, or using a command line tool to query image information.

[0069] In the embodiment of the present application, the Docker image of the application will be securely stored in the image warehouse for use in the subsequent deployment process. The image warehouse not only provides the image storage function, but also supports advanced features such as image version control and access rights management, which helps to ensure the consistency and security of the application in different environments.

[0070] In the embodiment of the present application, a continuous integration / continuous deployment (CI / CD) tool (such as Jenkins) or a custom script is used to execute the build process based on the acquired code information, including steps such as compilation and packaging, and finally generate the Docker image file of the application. The built image file is pushed to the image warehouse (such as Harbor, Docker Hub, etc.) for centralized storage and management. This step ensures the security, availability and version control of the image file.

[0071] Step S103, when it is determined that the image repository stores the image file, sends a deployment command to the second electronic device, so that the second electronic device logs in to the image repository based on the deployment command to download the image file, generates a container based on the image file, and deploys the application based on the container, wherein the deployment command is used to instruct the second electronic device to deploy the application.

[0072] In the embodiments of the present application, it mainly involves sending deployment commands, downloading image files, creating containers, and actually deploying applications.

[0073] In an embodiment of the present application, a deployment command is sent from the current system (which may be part of the CI / CD pipeline or a dedicated deployment management system) to the second electronic device (usually a server or cluster responsible for specific deployment operations). This command may contain the necessary information required to download the image file, such as the image repository address, image name and label, etc. After receiving the deployment command, the second electronic device will parse the information in the command and prepare to perform subsequent deployment operations. Before downloading the image, the second electronic device needs to log in to the image repository using appropriate credentials (such as username and password, access token, etc.). In this way, it is ensured that only authorized devices can download the image and protect the security of the image. After successful login, the second electronic device uses the Docker command line tool (such as dockerpull) to download the image file corresponding to the deployment command from the image repository according to the image name and label provided in the deployment command. After downloading the image, the second electronic device will create one or more container instances based on this image file. The process of creating a container usually involves specifying the name of the container, allocating resources (such as CPU, memory), setting environment variables, configuring the network, etc. Finally, the second electronic device will start the container instance and run the application in it. This usually involves the configuration of the container and the execution of the startup command to ensure that the application can run as expected. During the startup process, some additional configuration or initialization work may be required, such as setting up database connections, loading configuration files, etc.

[0074] The application deployment method provided in the embodiment of the present application obtains code information of the application to be deployed; generates an image file based on the code information, and stores the image file in an image warehouse. When it is determined that the image warehouse stores the image file, a deployment command is sent to the second electronic device, so that the second electronic device logs in to the image warehouse based on the deployment command to download the image file, generates a container based on the image file, and deploys the application based on the container, so that automatic deployment can be achieved, thereby improving the deployment efficiency of the application.

[0075] According to the present application, the method realizes the automation of the whole process from code acquisition to application deployment. The application will be deployed to the second electronic device and run in the container, which can ensure the smooth deployment and stable operation of the application, and improve the efficiency and reliability of the deployment, and ensure the consistent operation of the application in different environments.

[0076] In the embodiment of the present application, the first electronic device may be a server, and the second electronic device may be a device on which the application is to be installed.

[0077] In some embodiments, step S102, generating an image file based on the code information, includes:

[0078] Step S1021, compile based on the code information, and package the compiled files.

[0079] In this step, compilation is the process of converting source code (such as code written in languages ​​such as Java, C++, Python, etc.) into machine code or intermediate code (such as bytecode) that can be directly executed by the computer. Specifically, compilation can be performed using a compiler or build tool (such as Maven, Gradle, npm, make, etc.). During the compilation process, the compiler checks for syntax errors in the source code and converts it into executable files or libraries. These files may include executable files, dynamic link libraries (DLLs), static libraries, etc., depending on the programming language used and the target platform.

[0080] In this step, packaging is the process of combining the compiled files and other resources required for the application to run (such as configuration files, dependent libraries, static resources, etc.) into a single file or package. The packaging step can simplify the deployment and distribution of the application. Packaging tools include Dockerfile for Docker, JAR packaging tools for Java, wheel or egg packages for Python, etc. In addition, when packaging, you can specify which files should be included and how to organize these files.

[0081] Step S1022: after the packaging is completed, an image file is produced based on the packaged file to generate an image file.

[0082] In this step, the image file is a lightweight, executable, independent software package that contains everything needed to run a certain software, including code, runtime environment, system tools, system libraries, settings, etc. In containerization technology (such as Docker), image files are the basis for deploying and distributing applications.

[0083] In this step, you can use container image building tools (such as Docker's docker build command) to create image files based on the packaged files. This process may involve starting from a base image, adding the packaged files to the image, and executing some configuration and installation commands to set up the runtime environment.

[0084] In this step, when making an image file, you can also specify the image's metadata, such as author, description, version tag, etc., to facilitate management and deployment.

[0085] In these embodiments, through these steps, the source code can be converted into a deployable image file. This process involves multiple links of code compilation, packaging, and making an image file based on the packaged file. Each step is the key to ensure that the application can be deployed smoothly and run correctly in the target environment.

[0086] According to the present application, by adding the steps of obtaining and outputting log information, the transparency and traceability of the deployment process can be improved, so that the application deployment method is further enhanced.

[0087] In some embodiments, the application deployment method further includes:

[0088] Step S104, obtaining log information during the compilation process, packaging process and / or image file production process.

[0089] In this step, the system or tool will capture and record all log information generated during the compilation process, packaging process, and / or image file production process. These log information usually contains a lot of details, such as compiler output, packaging tool logs, command execution results during image building process, etc. They are essential for diagnosing problems, understanding the inner workings of the deployment process, and optimizing the build process.

[0090] In this step, the way to obtain log information may vary depending on the tools and environment used. For example, during the Docker image building process, the docker build command automatically captures and displays the log information during the build process. In other scenarios, you may need to capture log information by configuring a logger (such as Log4j, Serilog, etc.) or using the log options of the command line tool.

[0091] Step S105: output log information.

[0092] In this step, after obtaining the log information, the next step is to output this information to a suitable location or interface so that users or automated tools can easily view and analyze it. The output method also depends on the specific needs and environment. Specifically, it can be output in the form of console, file, and remote log. For simple deployment processes, log information can be directly output to the console (command line interface). In this way, users can see the log information in real time during the deployment process to understand the progress and status of the deployment. For log information that needs to be stored for a long time or further analyzed, it can be output to a file. In this way, even if the deployment process is completed, users can view the log file at any time to obtain the required information. In some large systems, remote log services (such as ELK Stack, Splunk, etc.) may be used to centrally store and manage log information. By sending log information to these services, users can more conveniently search, filter, and analyze logs.

[0093] In these embodiments, by adding the steps of obtaining and outputting log information, the application deployment method can provide more comprehensive and detailed deployment process information. It not only helps users understand the progress and status of deployment, but also helps to quickly diagnose and solve problems when they occur. At the same time, these log information also provides valuable data support for optimizing the deployment process and improving deployment efficiency.

[0094] According to the present application, the application deployment method further expands the ability to interact with remote devices, especially increasing security control when it comes to distributing image files to a second electronic device.

[0095] In some embodiments, the application deployment method further includes:

[0096] Step S106: When the login information of the second electronic device is obtained, the login information is verified.

[0097] In this step, before sending the image file to the second electronic device, the system first receives the login information from the second electronic device. This login information usually includes a username, password, token (such as JWT), key or other authentication credentials. The received login information will then go through a series of verification processes to confirm its validity and legitimacy.

[0098] The verification process may involve the following steps:

[0099] Credential checking: Verifies that the login information is complete and in the expected format.

[0100] Authentication: Comparing received credentials with corresponding credentials stored in the system to confirm the user's identity.

[0101] Permission check: Verify whether the user has the right to receive or deploy the image file. This may involve role management, permission control, or policy-based access control.

[0102] If the login information verification fails (for example, the username or password is incorrect, or the user does not have sufficient permissions), the system may reject the request and return a corresponding error message to the second electronic device.

[0103] Step S107: When the login information is verified, the image file is sent to the second electronic device.

[0104] In this step, once the login information is successfully verified, the system will continue to execute the image file sending process. This usually involves transferring the image file from the source location (such as local storage, private image warehouse, etc.) to the designated location of the second electronic device.

[0105] In this step, the sending (transmission) process may use a variety of protocols and technologies, depending on the network environment, security requirements and the configuration of the second electronic device. For example, the HTTP / HTTPS protocol can be used to transmit through a Web server, or through a secure file transfer protocol such as SCP, SFTP, etc.

[0106] In this step, the system may also implement some security measures to protect the security and integrity of the image file during the transmission process. For example, TLS / SSL encryption can be used to ensure that the data in the transmission process is not stolen or tampered with, or a hash checksum can be used to verify that the image file remains intact during the transmission process.

[0107] In these embodiments, by adding the steps of login information verification and image file sending, the application deployment method not only improves the security of interaction with the second electronic device, but also ensures that only authorized devices can receive the image file. This helps prevent unauthorized access and data leakage, and protects the integrity and reliability of the deployment process.

[0108] According to a second aspect of the present application, there is provided an application deployment method, wherein the application deployment method is applied to a second electronic device, Figure 2 A schematic diagram of an implementation flow of an application deployment method provided for the implementation of this application, such as Figure 2 As shown, the application deployment method includes:

[0109] Step S201, when a deployment command sent by a first electronic device is obtained, log in to an image warehouse, wherein the image warehouse stores an image file generated based on code information of an application to be deployed, and the deployment command is used to instruct a second electronic device to deploy the application.

[0110] In the embodiment of the present application, the second electronic device first monitors or checks whether a deployment command from the first electronic device has been received. The deployment command may include various parameters and instructions required for deployment, such as application name, version number, deployment environment, etc. Once a valid deployment command is received, the second electronic device will log in to the image warehouse according to the information provided in the command or the pre-configured settings.

[0111] In the embodiment of the present application, the image warehouse is a remote warehouse for storing container images, which allows users to upload, download and manage image files. Logging into the image warehouse usually requires providing a username, password or other authentication information. This information may be pre-configured on the second electronic device or sent with the deployment command.

[0112] Step S202: Downloading an image file corresponding to the code information of the application to be deployed from the image repository.

[0113] In the embodiment of the present application, after successfully logging into the image warehouse, the second electronic device will download the corresponding image file from the image warehouse according to the image name, label and other information specified in the deployment command. The image file is the basic template of the container and contains all the files and configurations required for the application to run.

[0114] In the embodiment of the present application, the process of downloading the image file may be affected by various factors such as network conditions, image warehouse performance, etc. In order to improve efficiency and reliability, some systems may implement a cache mechanism to cache the downloaded image files locally for subsequent quick access.

[0115] Step S203: Generate a container based on the image file.

[0116] In the embodiment of the present application, after downloading the image file, the second electronic device will use container technology (such as Docker) to generate a container instance based on the image file. A container is a lightweight, portable, independently running environment that can run applications in the same way almost anywhere.

[0117] In the embodiment of the present application, the process of generating a container generally involves the creation, configuration and startup of the container. In this step, the second electronic device will configure the network, storage, environment variables and other parameters of the container as needed to ensure that the container can run the application normally.

[0118] Step S204: deploy the application based on the container.

[0119] In the embodiment of the present application, after the container is successfully started and running, the second electronic device will deploy the application inside the container. This usually involves steps such as initialization, configuration, and startup of the application. The deployment of the application can vary depending on the specific needs and characteristics of the application, but it needs to follow a certain deployment script or automated process.

[0120] After the deployment is complete, the second electronic device may perform a series of verification and testing tasks to ensure that the application has been successfully deployed and can run normally. These verification and testing tasks may include health checks, performance tests, security scans, etc. of the application.

[0121] According to the deployment method of the present application, the second electronic device can automatically receive the deployment command from the first electronic device and complete the entire process from downloading the image file from the image repository, generating the container to the application deployment. This method improves the automation of application deployment, reduces the complexity and error rate of manual operations, and makes application deployment faster, more reliable and repeatable.

[0122] According to the present application, in order to keep the system clean and efficient, the application deployment method includes checking and processing the historical versions of the image file and its corresponding container.

[0123] In some embodiments, the application deployment method further includes:

[0124] Step S205, determining whether there is a historical version of the image file.

[0125] In this step, before or after downloading a new version of the image file, the second electronic device may check whether there is a historical version of the image file in the image repository by querying the API or database of the image repository.

[0126] Step S206: If there is a historical version of the image file, delete the image file of the historical version, and delete the container corresponding to the historical version.

[0127] In this step, if the second electronic device finds that there are historical versions of the image file, it can also decide whether to delete these old versions according to certain policies. For example, only keep the latest uploaded image file, delete all old versions, keep a certain number of the latest image file versions, delete the old versions exceeding this number, delete the image file versions earlier than a certain timestamp based on the timestamp, etc.

[0128] In this step, the second electronic device may be able to perform the deletion operation through the API or command line tool of the image repository.

[0129] In this step, after deleting the historical version of the image file, the system also needs to check and delete the containers created based on these old versions of the image file. This is because if the container is still running and based on the deleted image file, then these containers may encounter problems, such as being unable to restart or update.

[0130] In these embodiments, first, the system needs to list all currently running and stopped containers in order to find containers based on old versions of image files. Then, the system will filter out containers based on old versions of image files according to the image ID or name of the container, and use the command of the container management tool (such as Docker's docker rm command) to delete them, so as to ensure the cleanliness and efficiency of the system.

[0131] In some embodiments, the application deployment method further includes:

[0132] Step S207, determining the deployment result and deployment time of the application.

[0133] In this step, after the application is deployed, the system needs to verify whether the deployment is successful and record the deployment time. The deployment results usually include success, failure, or partial success (for example, some services are successfully started, but other services fail). The deployment time refers to the time period from the start to the end of the deployment operation.

[0134] In this step, in order to determine the deployment results, the system may perform a series of checks, such as checking whether the service is running, whether the port is listening correctly, whether the database connection is successful, etc. These checks can be completed through health check APIs, log analysis, or direct service calls.

[0135] Step S208: Generate notification information based on the deployment result and deployment time.

[0136] In this step, once the deployment result and deployment time are determined, the system can generate notification information based on this information. The notification information should clearly and accurately reflect the results of the deployment, including whether it was successful, the reason for failure (if it failed), and the time of deployment. In addition, the notification information can also contain other useful information, such as the version number of the deployment, the deployment environment (such as development environment, test environment or production environment), etc.

[0137] In this step, when generating notification information, the system may use templates to format the information to ensure consistency and readability of the notification. These templates can be customized according to different deployment results and scenarios.

[0138] Step S209, sending notification information to the target person.

[0139] In this step, the system needs to send the generated notification information to the target personnel. The target personnel are usually the team or individuals responsible for application deployment, monitoring, and maintenance. They need to take corresponding actions based on the notification information, such as handling deployment failures, confirming deployment success, and notifying other relevant personnel.

[0140] In this step, there are many ways to send notification information, including email, SMS, instant messaging (such as Slack, Teams, etc.), or dedicated notification systems (such as PagerDuty, OpsGenie, etc.). Which method to choose depends on the preferences of the target personnel and the communication strategy of the organization.

[0141] In these embodiments, these steps together constitute part of the application post-deployment management process, which is intended to ensure that relevant personnel can understand the results of the deployment in a timely and accurate manner and take appropriate actions accordingly.

[0142] Based on the foregoing embodiments, the present application further provides an application deployment method, including:

[0143] Step 1: Basic environment construction phase.

[0144] Deploy Git version control service: ensure code version control, support multi-person collaborative development, and provide historical version backtracking function.

[0145] Introducing Docker containerization technology: Install Docker on the server and use containerization technology to achieve rapid deployment, migration, and expansion of applications.

[0146] Deploy Jenkins automated deployment service: Configure Jenkins to integrate tools such as Git and Docker to automate the build, test, and deployment processes.

[0147] Deploy Harbor image management service: As a private image repository, Harbor provides image storage, management, distribution, and permission control to ensure the security and traceability of images.

[0148] Step 2, install the portable auto-deployment receiver.

[0149] Spring Boot project: Use Java and Spring Boot framework to develop a lightweight HTTP service that can receive and execute deployment commands from Jenkins.

[0150] Security considerations: Make sure the service has appropriate security measures such as HTTPS, authentication, and authorization mechanisms to prevent unauthorized access.

[0151] Step 3, construction phase.

[0152] Code push: Developers push code to the Git repository, triggering Jenkins's webhook or polling mechanism.

[0153] Automated build: Jenkins executes preset build scripts, including code pulling, compiling, packaging, and Docker image creation.

[0154] Image push: After the build is completed, Jenkins pushes the Docker image to the Harbor image repository for storage and management.

[0155] Log display: Jenkins provides detailed build logs so that developers and operators can understand every step of the build process.

[0156] Step 4: Send Docker and related shells.

[0157] Script writing: A shell script for deployment is written in advance. The script contains commands such as logging in to Harbor, deleting old images and containers, pulling new images, and starting applications.

[0158] Script delivery: Jenkins delivers the script to each application server through SSH or other methods.

[0159] Step 5: Automatically deploy the receiver to receive commands, deploy and start the application

[0160] Receive commands: The automatic deployment receiver receives the script execution commands sent by Jenkins.

[0161] Execute deployment: Perform deployment operations according to the commands in the script, including logging in to Harbor, deleting old images and containers, pulling new images, and starting applications.

[0162] Error handling: During the deployment process, the automatic deployment receiver should be able to capture and handle possible errors to ensure the robustness of the deployment process.

[0163] Step 6: Send a notification after the deployment is complete.

[0164] Notification configuration: Configure WebSocket or email notification service in Jenkins, specify the person who receives the notification and the notification content template.

[0165] Send notification: After the deployment is completed, Jenkins sends a notification of deployment success or failure to the development and business personnel according to the configuration. The notification content should include detailed information such as deployment time, results, error information, etc., so that relevant personnel can quickly understand the deployment status and make corresponding handling.

[0166] The entire process is automated from code submission to application deployment, greatly improving the efficiency of development and operation and maintenance and reducing the risk of human error.

[0167] According to the deployment method of this application, the degree of integration is high. By seamlessly integrating independent tools such as Jenkins, Docker, Harbor, WebSocket / mail, etc., an end-to-end automated deployment pipeline is built. This high degree of integration not only simplifies the deployment process, but also improves the efficiency and stability of the overall system.

[0168] Key components:

[0169] Jenkins: As the core tool for continuous integration / continuous deployment (CI / CD), Jenkins is responsible for triggering the build, test, packaging, and deployment processes.

[0170] Docker: Use Docker containerization technology to package applications and their dependencies into independent containers to ensure consistent operation in any environment.

[0171] Harbor: As a private Docker image repository, Harbor provides image storage, signing, scanning and other functions, enhancing the security and management efficiency of images.

[0172] WebSocket / Mail: Used for real-time communication to push key information during the deployment process to relevant personnel, enabling instant information sharing and rapid response.

[0173] According to the deployment method of the present application, Docker containerization technology is used to ensure consistent operation of applications in different environments and reduce compatibility issues.

[0174] According to the deployment method of the present application, by providing real-time deployment status monitoring, relevant personnel can understand the progress and results of the deployment at any time, thereby enhancing the controllability and predictability of the deployment process.

[0175] According to the deployment method of this application, WebSocket or email can be used to push key information in the deployment process (such as start, success, failure, etc.) to development and business personnel in real time so that they can respond and handle problems in a timely manner.

[0176] In summary, according to the deployment method of this application, the efficiency of software development and operation and maintenance can be significantly improved, the error rate can be reduced, and the overall collaboration ability of the team can be improved.

[0177] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0178] According to the foregoing embodiments, the embodiments of the present application provide an application deployment device, and the modules included in the device, as well as the units included in the modules, can be implemented by a processor in a computer device; of course, they can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU, Central Processing Unit), a microprocessor (MPU, Microprocessor Unit), a digital signal processor (DSP, Digital Signal Processing) or a field programmable gate array (FPGA, Field Programmable Gate Array), etc.

[0179] The present application embodiment provides an application deployment device, Figure 3A schematic diagram of the structure of an application deployment device provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the application deployment device 400 includes:

[0180] The acquisition module 401 is used to acquire code information of the application to be deployed;

[0181] A storage module 402 is used to generate an image file based on the code information and store the image file in an image repository;

[0182] The sending module 403 is used to send a deployment command to the second electronic device when it is determined that the image repository stores the image file, so that the second electronic device logs in to the image repository based on the deployment command to download the image file, generates a container based on the image file, and deploys the application based on the container, wherein the deployment command is used to instruct the second electronic device to deploy the application.

[0183] In some embodiments, generating an image file based on the code information includes:

[0184] Compiling based on the code information and packaging the compiled files;

[0185] After the packaging is completed, an image file is produced based on the packaged files to generate an image file.

[0186] In some embodiments, the application deployment apparatus 400 is further used for:

[0187] Obtain log information during the compilation process, packaging process and / or image file creation process;

[0188] Output the log information.

[0189] In some embodiments, the application deployment apparatus 400 is further used for:

[0190] When the login information of the second electronic device is obtained, verifying the login information;

[0191] When the login information is verified, the mirror file is sent to the second electronic device.

[0192] This application embodiment provides another application deployment device. Figure 4 A structural diagram of another application deployment device provided in an embodiment of the present application, such as Figure 4 As shown, the application deployment device 500 includes: an application deployment device, which is applied to a second electronic device, including:

[0193] A login module 501 is used to log in to an image warehouse when a deployment command sent by a first electronic device is obtained, wherein the image warehouse stores an image file generated based on code information of an application to be deployed, and the deployment command is used to instruct a second electronic device to deploy the application;

[0194] A download module 502, configured to download an image file corresponding to the code information of the application to be deployed from the image repository;

[0195] A generation module 503, used to generate a container based on the image file;

[0196] The deployment module 504 is used to deploy the application based on the container.

[0197] In some embodiments, the application deployment apparatus 500 is further used for:

[0198] Determine whether there is a historical version of the image file;

[0199] If a historical version of the image file exists, the image file of the historical version is deleted, and the container corresponding to the historical version is deleted.

[0200] In some embodiments, the application deployment apparatus 500 is further used for:

[0201] Determine the deployment result and deployment time of the application;

[0202] Generate notification information based on the deployment result and the deployment time;

[0203] The notification information is sent to the target person.

[0204] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0205] in addition, Figure 3 or Figure 4 The application deployment device shown may be a software unit, a hardware unit, or a combination of software and hardware that is built into an existing electronic device, or may be integrated into the electronic device as an independent widget, or may exist as an independent terminal device.

[0206] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0207] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device 3 of this embodiment may include: at least one processor 30 ( Figure 5 Only one processor 30 is shown in the figure), a memory 31, and a computer program 32 stored in the memory 31 and executable on at least one processor 30. When the processor 30 executes the computer program 32, the steps in any of the above-mentioned method embodiments are implemented, for example Figure 1 Steps S101 to S103 in the illustrated embodiment. Alternatively, when the processor 30 executes the computer program 32, the functions of each module / unit in the above-mentioned device embodiments are implemented, for example, Figure 3 The functions of the modules 401 to 403 are shown or Figure 4 Functions of modules 501 to 504 are shown.

[0208] Exemplarily, the computer program 32 may be divided into one or more modules / units, one or more modules / units are stored in the memory 31, and are executed by the processor 30 to complete the present application. One or more modules / units may be a series of computer program 32 instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 32 in the electronic device 3.

[0209] The embodiment of the present application further provides a computer-readable storage medium, which stores a computer program 32. When the computer program 32 is executed by the processor 30, the steps in the above-mentioned method embodiments can be implemented.

[0210] An embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the vehicle can implement the steps in the above-mentioned method embodiments when the computer program product is executed.

[0211] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. According to this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program 32, and the computer program 32 can be stored in a computer-readable storage medium, and the computer program 32 can implement the steps of the above-mentioned various method embodiments when executed by the processor 30. Among them, the computer program 32 includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the terminal, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0212] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0213] An embodiment of the present application further provides a vehicle, including: the electronic device provided in the above embodiment.

[0214] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0215] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0216] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0217] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

[0218] The relevant user personal information that may be involved in the various embodiments of this application is strictly in accordance with the requirements of laws and regulations, following the principles of legality, legitimacy and necessity, based on the reasonable purposes of business scenarios, to process the personal information that users actively provide during the use of products / services or generated due to the use of products / services, as well as the personal information obtained with the user's authorization.

[0219] The user personal information processed by the applicant will vary depending on the specific product / service scenario, and shall be based on the specific scenario in which the user uses the product / service, which may involve the user's account information, device information, driving information, vehicle information or other related information. The applicant will treat the user's personal information and its processing with a high degree of diligence.

[0220] The Applicant attaches great importance to the security of user personal information and has adopted reasonable and feasible security protection measures that comply with industry standards to protect user information and prevent personal information from being accessed, disclosed, used, modified, damaged or lost without authorization.

Claims

1. An application deployment method, characterized in that: Applicable to a first electronic device, comprising: Get the code information of the application to be deployed; Generate an image file based on the code information, and store the image file in an image warehouse; When it is determined that the image repository stores the image file, a deployment command is sent to the second electronic device, so that the second electronic device logs in to the image repository based on the deployment command to download the image file, generates a container based on the image file, and deploys the application based on the container, wherein the deployment command is used to instruct the second electronic device to deploy the application.

2. The method according to claim 1, characterized in that The generating of the image file based on the code information includes: Compiling based on the code information and packaging the compiled files; After the packaging is completed, an image file is produced based on the packaged files to generate an image file.

3. The method according to claim 2, characterized in that The method further comprises: Obtain log information during the compilation process, packaging process and / or image file creation process; Output the log information.

4. The method according to claim 1, characterized in that: The method further comprises: When the login information of the second electronic device is obtained, verifying the login information; When the login information is verified, the mirror file is sent to the second electronic device.

5. An application deployment method, characterized in that: Applied to a second electronic device, the method includes: When a deployment command sent by the first electronic device is obtained, logging into an image warehouse, wherein the image warehouse stores an image file generated based on code information of an application to be deployed, and the deployment command is used to instruct the second electronic device to deploy the application; Downloading an image file corresponding to the code information of the application to be deployed from the image repository; Generate a container based on the image file; Applications are deployed based on the container.

6. The method according to claim 5, characterized in that The method further comprises: Determine whether there is a historical version of the image file; If a historical version of the image file exists, the image file of the historical version is deleted, and the container corresponding to the historical version is deleted.

7. The method according to claim 5, characterized in that The method further comprises: Determine the deployment result and deployment time of the application; Generate notification information based on the deployment result and the deployment time; The notification information is sent to the target person.

8. An application deployment device, characterized in that: Applicable to a first electronic device, comprising: The acquisition module is used to obtain the code information of the application to be deployed; A storage module, used to generate an image file based on the code information, and store the image file in an image warehouse; A sending module is used to send a deployment command to a second electronic device when it is determined that the image repository stores the image file, so that the second electronic device logs in to the image repository based on the deployment command to download the image file, generates a container based on the image file, and deploys the application based on the container, wherein the deployment command is used to instruct the second electronic device to deploy the application.

9. An application deployment device, characterized in that: Applicable to a second electronic device, comprising: A login module, configured to log in to an image repository when a deployment command sent by the first electronic device is obtained, wherein the image repository stores an image file generated based on code information of an application to be deployed, and the deployment command is used to instruct the second electronic device to deploy the application; A download module, used to download an image file corresponding to the code information of the application to be deployed from the image repository; A generation module, used to generate a container based on the image file; A deployment module is used to deploy applications based on the container.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

11. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Application release control method, system and server

    CN120762734A

  • Application publishing control method, system and server

    CN120762734B