Deploy a ComfyUI online service

更新时间:
复制 MD 格式

After installing the models, plugins, and dependencies in the development environment, you can publish the current image generation environment. This process creates a snapshot and deploys it as an online service. After deployment, any changes you make to plugins and dependencies in the development environment do not affect the published online service.

Overview

To ensure the stability and reliability of the online service, the development environment is isolated from the online service environment. You can debug and iterate on your ComfyUI image generation environment in the development environment. Once the environment can reliably run your expected workflow, you publish that specific version to the online service.

ComfyUI image generation environment

Component

Description

Model

All types of models required by the workflow, such as Checkpoint, LoRA, and ControlNet.

Located in the models directory.

Plugin

Community-developed or self-developed custom nodes.

Located in the custom_nodes directory.

Dependency

Python dependency packages for the ComfyUI main program and its plugins.

Cache

Auxiliary models, datasets, and other assets required to run the workflow.

Typically located in the .cache directory.

The development environment and the online service maintain mutable and immutable image generation environments, respectively. This isolation ensures the stability of online API calls. Each time you publish, the platform creates a snapshot of the current development environment and uses it to update the online service.

Deployment process overview

Phase

Description

1. Snapshot creation

The plugins, dependencies, and necessary cache from the project development environment are packaged and copied to generate a snapshot, which is stored in the snapshots directory. Models (models) are not included in the snapshot. The online service and the project development environment share the same model storage.

Snapshot creation time increases with the complexity of the image generation environment (more plugins and dependencies).

2. Service deployment

After the snapshot is created, the platform automatically updates the online service's function configuration and initiates a smooth rotation. This process starts a new instance with the new snapshot. Once the new instance passes its health check, the platform terminates the old instance. A "successful" deployment status indicates that the platform has updated the function configuration and started the instance rotation.


Procedure

Before you begin

Use a workstation in the development environment to debug your image generation environment. Ensure that your models, plugins, dependencies, and cache allow your workflow to run correctly. For more information, see Quick start for creating a ComfyUI project.

Note: If you have finished debugging, we recommend that you save and shut down the workstation before deploying to avoid unnecessary charges during the deployment process.

Step 1: Deploy the service and view history

  1. Go to the project details page by clicking Projects in the console and then clicking the target ComfyUI project.

  2. On the project details page, click Deploy Online Service.
    For your first deployment, the platform guides you through configuring the resource specifications and scaling policies for the online service. Subsequent deployments reuse the existing configuration from Online Service > Configuration Management.

  3. After starting the deployment, you can view its progress in Online Service > Deployment History.

Note: Only one deployment task can be in progress at a time. To start a new deployment, wait for the current task to complete.

Step 2: Monitor the instance status

When the deployment history shows a successful status, the smooth rotation of online service instances begins. You can monitor the rotation process in the following locations:

Location

What to check

Online Service > Service Overview

Changes in the actual minimum number of instances.

Online Service > Instance List > Inference Instances

The lifecycle of each instance, which helps you determine when new instances have replaced old ones.

Note: Instance rotation speed depends primarily on the startup time of the image generation environment. If your workstation starts up slowly (for example, due to a slow-loading ComfyUI plugin), the deployment rotation will also take longer.