Docker swing-based application deployment method and system

The Docker Swarm-based deployment method automates container orchestration in small-scale environments, addressing the inefficiencies of existing technologies by simplifying the deployment and management of container clusters, reducing resource needs, and improving operational efficiency.

CN119718343APending Publication Date: 2025-03-28FUJIAN FUJITSU COMM SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411576312.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-03-28

Smart Images

  • Figure CN119718343A_ABST
    Figure CN119718343A_ABST
Patent Text Reader

Abstract

The invention relates to an application deployment method and system based on docker swing. The method at least comprises the steps that S1, codes are pulled and compiled; s2, packaging the application mirror image, and uploading the application mirror image to a remote warehouse; s3, the ssh uses the key pair to log in the remote service, and confirms the corresponding service state; step S4, updating a mirror image version of the service through a docker sub-command; and S5, circularly detecting the deployed service state, and determining whether the deployment is successful or not. The technical scheme at least has the following beneficial effects: in limited server resources, the automatic deployment and container arrangement capabilities of the application system are provided, and the efficiency of container arrangement work of operation and maintenance personnel in a small cluster is improved. The deployment of the container arrangement cluster is simpler, and the requirement on server resources is lower. Rapid deployment and updating of the application container can be realized. The situation that operation and maintenance personnel need to additionally consider node distribution of the application when deploying the application can be relieved. And application updating and deployment are more convenient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of small-scale container cluster management and deployment, and specifically relates to an application deployment method and system based on Docker Swarm. Background Art

[0002] Application containerization technology has become a key trend in the field of modern software development and deployment. With the widespread adoption of cloud computing technology and the increasing popularity of microservice architecture, traditional application deployment methods can no longer meet the needs of rapid iteration, efficient expansion, and reliable operation. Containerization technology ensures the portability, scalability, and high availability of applications by encapsulating applications and all their dependencies in an independent container. This technology provides software developers with more flexible and efficient means of deployment and management. At present, there are many container technologies on the market, such as Docker Compose, Kubernetes, etc., which play an important role in their respective fields.

[0003] However, there are still some shortcomings and challenges in the existing background technology. Taking Kubernetes as an example, although it is a powerful container orchestration platform, its overall architecture is relatively large and complex when the basic server resources are insufficient. This not only increases the operating burden of the system, but also leads to a high learning cost, making it difficult for technicians to master and use Kubernetes. In addition, the configuration and management of Kubernetes are relatively complex, requiring technicians to have high professional knowledge and experience.

[0004] On the other hand, although Docker Compose performs well in single-machine deployment scenarios and can quickly start and manage multiple containers, it is not suitable for container orchestration in a multi-host environment. In scenarios where container management and scheduling across multiple servers are required, Docker Compose is unable to cope with it. This limits its application in large-scale distributed systems, forcing developers to look for other alternatives when faced with complex deployment requirements.

[0005] In general, although containerization technology has significant advantages in modern software development and deployment, existing technologies still have some limitations. Developers need to choose appropriate container technology based on specific application scenarios and requirements, and overcome its shortcomings to achieve efficient and reliable software deployment and management. Summary of the invention

[0006] In view of the shortcomings of the current related existing technologies, the present invention provides an application deployment method and system based on docker swarm. The solution provided by the present invention is suitable for small-scale container cluster management and deployment solutions. It can provide automatic deployment of application systems and container orchestration capabilities within limited server resources, thereby improving the efficiency of container orchestration work of operation and maintenance personnel in small clusters.

[0007] To achieve the above object, the present invention provides a first aspect of providing an application deployment method based on docker swarm, which at least comprises the following steps:

[0008] Step S1, pull the code and compile the code;

[0009] Step S2: Pack the application image and upload it to the remote warehouse;

[0010] Step S3, ssh uses the key pair to log in to the remote service and confirm the corresponding service status;

[0011] Step S4: Update the image version of the service through the docker subcommand;

[0012] Step S5: cyclically detect the deployed service status to determine whether the deployment is successful.

[0013] Furthermore, in step S3, it is necessary to further determine whether the service already exists; if not, a new application is installed.

[0014] Furthermore, if it is determined that the service already exists, a new version number of the service is set.

[0015] Furthermore, after setting the new version number of the service, it is necessary to further loop to determine whether the service has been successfully updated.

[0016] The second aspect of the present invention provides an application deployment system based on docker swarm, the system is used to implement the above method, the system at least includes

[0017] A compiling module, which is used to pull and compile codes;

[0018] Packaging and uploading module: The packaging and uploading module is used to package the application image and upload it to the remote warehouse;

[0019] A service status confirmation module, wherein the service status confirmation module uses ssh to log in to the remote service using a key pair, and uses the service status confirmation module to confirm the corresponding service status;

[0020] A deployment module is used to execute the deployment and update of the image version used by the service.

[0021] Furthermore, the image version of the service is updated through the docker subcommand in the deployment module.

[0022] Furthermore, it also includes a service detection and judgment module, which is used to judge whether the service already exists; if not, a new application is installed.

[0023] Furthermore, it also includes a loop detection module, which is used to cyclically determine whether the image version used by the update service is updated successfully.

[0024] The present invention adopts the above technical solution, step S1, pull the code, and compile the code; step S2, package the application image, and upload it to the remote warehouse; step S3, ssh uses the key pair to log in to the remote service and confirm the corresponding service status; step S4, updates the image version of the service through the docker subcommand; step S5, loops to detect the deployed service status to determine whether the deployment is successful. It has at least the following beneficial effects: In order to provide automatic deployment of application systems and container orchestration capabilities in limited server resources, this technical solution improves the efficiency of container orchestration work of operation and maintenance personnel in small clusters. The deployment of container orchestration clusters is simpler and has lower requirements for server resources. It can realize rapid deployment and updating of application containers. It can reduce the need for operation and maintenance personnel to consider the node allocation of applications when deploying applications. More convenient application updates and deployments. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0026] Figure 1 It is a flow chart of the application deployment method based on docker swarm of the present invention;

[0027] Figure 2 It is a schematic diagram of an application deployment system based on docker swarm of the present invention. DETAILED DESCRIPTION

[0028] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0029] like Figure 1 and Figure 2 As shown, the first aspect of this embodiment provides an application deployment method based on docker swarm, which at least includes the following steps:

[0030] Step S1, pull the code and compile the code;

[0031] Step S2: Pack the application image and upload it to the remote warehouse;

[0032] Step S3, ssh uses the key pair to log in to the remote service and confirm the corresponding service status;

[0033] Step S4: Update the image version of the service through the docker subcommand;

[0034] Step S5: cyclically detect the deployed service status to determine whether the deployment is successful.

[0035] As a preferred implementation, in step S3 of this embodiment, it is necessary to further determine whether the service already exists; if not, a new application is installed. If it is determined that the service already exists, a new version number of the service is set. As a preferred implementation, after setting the new version number of the service in this embodiment, it is necessary to further loop to determine whether the service is successfully updated.

[0036] like Figure 2 As shown, the second aspect of the present invention provides an application deployment system based on docker swarm, the system is used to implement the above method, the system at least includes

[0037] A compiling module, which is used to pull and compile codes;

[0038] Packaging and uploading module: The packaging and uploading module is used to package the application image and upload it to the remote warehouse;

[0039] A service status confirmation module, wherein the service status confirmation module uses ssh to log in to the remote service using a key pair, and uses the service status confirmation module to confirm the corresponding service status;

[0040] A deployment module is used to execute the deployment and update of the image version used by the service.

[0041] As a preferred implementation, the deployment module described in this embodiment updates the image version of the service through the docker subcommand.

[0042] As a preferred implementation, this embodiment further includes a service detection and judgment module, which is used to determine whether the service already exists; if not, a new application is installed.

[0043] As a preferred implementation, this embodiment further includes a loop detection module, which is used to cyclically determine whether the image version used by the update service is updated successfully.

[0044] The system and method provided in this embodiment realize the automatic deployment and container orchestration of the application system, thereby significantly improving the work efficiency of operation and maintenance personnel in a small cluster environment. Specifically, the present invention includes the following steps:

[0045] Step S1: Pull the source code from the code repository and compile it to ensure that the code can be successfully converted into an executable program. This process not only involves obtaining the code, but also includes compiling and building the code, laying a solid foundation for subsequent deployment.

[0046] Step S2: Package the compiled application into an image and upload it to the remote code repository. This process involves the creation and storage of images to ensure that the application can be quickly deployed in any required environment.

[0047] Step S3: Use the ssh key to securely log in to the remote server and check the status of the corresponding service. This process ensures that the operation and maintenance personnel can remotely access the server and monitor the operation of the service in real time, so as to discover and solve problems in a timely manner.

[0048] Step S4: Update the image version used by the service by executing docker-related subcommands. This process enables the service to quickly switch to the new image and achieve seamless updates and upgrades.

[0049] Step S5: cyclically detect the deployed service status to confirm whether the service has been successfully deployed. This process ensures the reliability of deployment and avoids service interruption caused by deployment failure.

[0050] This embodiment can provide the ability to automatically deploy application systems and orchestrate containers within limited server resources, significantly improving the efficiency of operations and maintenance personnel in performing container orchestration work in small clusters. This means that efficient and reliable automated deployment can still be achieved in resource-constrained environments. The deployment process of the container orchestration cluster is simpler and the requirements for server resources are relatively low. This makes it easy to deploy and manage complex container clusters even when hardware resources are limited.

[0051] The present invention can realize the rapid deployment and update of application containers. This means that when it is necessary to quickly respond to market changes or fix urgent problems, operation and maintenance personnel can quickly push new application versions to the production environment, thereby shortening the cycle from development to launch.

[0052] The present invention can reduce the need for operation and maintenance personnel to consider the node allocation of applications when deploying applications. This means that operation and maintenance personnel do not need to spend a lot of time on complex node planning and allocation, so that they can devote more energy to other important operation and maintenance tasks.

[0053] The present invention makes application updating and deployment more convenient. Whether it is daily updating or emergency repair, operation and maintenance personnel can quickly complete application updating and deployment through simple commands and processes, greatly improving work efficiency and system stability.

[0054] Although the embodiments of the present invention have been shown and described above, it will be appreciated that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, substitute and vary the above embodiments within the scope of the present invention.

Claims

1. A method for deploying an application based on docker swarm, characterized in that: At least the following steps are included: Step S1, pull the code and compile the code; Step S2: Pack the application image and upload it to the remote warehouse; Step S3, ssh uses the key pair to log in to the remote service and confirm the corresponding service status; Step S4: Update the image version of the service through the docker subcommand; Step S5: cyclically detect the deployed service status to determine whether the deployment is successful.

2. The method according to claim 1, characterized in that: In step S3, it is necessary to further determine whether the service already exists; if not, a new application is installed.

3. The method according to claim 2, characterized in that: If it is determined that the service already exists, set the new version number of the service.

4. The method according to claim 3, characterized in that: After setting the new version number of the service, you need to further loop to determine whether the service has been successfully updated.

5. An application deployment system based on docker swarm, characterized by: The system is used to implement the method described in any one of claims 1 to 4, and the system at least comprises A compiling module, which is used to pull and compile codes; Package upload module; The packaging and uploading module is used to package the application image and upload it to the remote warehouse; A service status confirmation module, wherein the service status confirmation module uses ssh to log in to the remote service using a key pair, and uses the service status confirmation module to confirm the corresponding service status; A deployment module is used to execute the deployment and update of the image version used by the service.

6. The system according to claim 5, characterized in that: In the deployment module, the image version of the service is updated through the docker subcommand.

7. The system according to claim 6, characterized in that: It also includes a service detection and judgment module, which is used to judge whether the service already exists; if not, a new application is installed.

8. The system according to claim 7, characterized in that: It also includes a loop detection module, which is used to cyclically determine whether the image version used by the update service is updated successfully.