
ComfyUI is an open-source, node-based application that lets you design, test, and execute diffusion model pipelines using a graphical web interface. ComfyUI runs advanced stable diffusion pipelines using a flowchart interface of interconnected nodes that support checkpoint loading, workflow re-executions, and generation from PNG files.
This article explains how to deploy ComfyUI on a Vultr Cloud GPU server. You will set up all project dependencies, install the ComfyUI Manager to manage models and run ComfyUI as a system service to run diffusion model pipelines on the server.
Before you begin:
comfyui.example.com.linuxuser.Follow the steps below to install ComfyUI in your working directory on the server.
Switch to your user home directory.
Clone the ComfyUI project repository using Git.
Switch to the ComfyUI directory.
Install the required PyTorch, numpy <2, and xformers dependency packages.
The above command installs the following packages:
Install additional ComfyUI dependencies using the requirements.txt file.
Switch to the models/checkpoints directory.
Open the put_checkpoints_here file using a text editor such as nano.
Add the following contents to the file.
Save and close the file.
The above configuration downloads the Stable Diffusion XL and Stable Diffusion 1.5 models to the ComfyUI models directory using the wget utility. Modify the file to include new model checkpoint URLs from sources such as Hugging Face to enable in ComfyUI.
Run the file using bash to download the specified models.
Output:
Switch to your user home directory.
Move the ComfyUI project directory to a system-wide location such as /opt.
Follow the steps below to set up ComfyUI as a system service to automatically run and manage the application's processes on your server.
Create a new comfyui.service system service file.
Add the following configurations to the file. Replace /opt/ComfyUI with your actual ComfyUI project directory path.
Save and close the file.
The above configuration creates a new comfyui system service to manage the ComfyUI application processes on the server.
Restart the systemd daemon to apply the new service changes.
Enable the ComfyUI system service.
Start the ComfyUI service.
View the ComfyUI service status and verify that it's active.
ComfyUI listens for connection requests on the localhost port 8188 by default unless you set a specific IP address and port using the --listen option. Set up a reverse proxy such as Nginx to forward all incoming connection requests to the backend port 8188 to enable access to the ComfyUI interface. Follow the steps below to install and configure Nginx to forward HTTP requests to the ComfyUI interface using your comfyui.example.com domain.
Install Nginx.
Create a new comfyui.conf Nginx virtual host configuration in the sites-available directory.
Add the following configurations to the file. Replace comfyui.example.com with your actual domain.
Save and close the file.
Link the configuration file to the sites-enabled directory to activate it.
Test the Nginx configuration for errors.
Output:
Restart Nginx to apply the configuration changes.
Uncomplicated Firewall (UFW) is active on Vultr Ubuntu servers by default. Follow the steps below to enable connections to the HTTP port 80, and the HTTPS port 443 through the firewall configuration to enable access to the ComfyUI interface.
View the UFW status to verify that the firewall is active on your server.
Allow SSH connections on port 22 and enable UFW if the firewall status is inactive.
Allow network connections to the HTTP port 80.
Allow connections to the HTTPS port 443.
Reload the UFW configuration to apply the firewall changes.
SSL certificates encrypt network connections between a user's web browser and the server. Generate SSL certificates using a trusted certificate authority such as Let's Encrypt to secure network connections to the server using HTTPS. Follow the steps to install the Certbot Let's Encrypt client and generate trusted SSL certificates to secure the ComfyUI interface.
Install the Certbot Let's Encrypt client tool using Snap.
Generate a new SSL certificate using your domain. Replace comfyui.example.com and user@example.com with your actual domain and active email address respectively.
Test the Certbot automatic SSL certificate renewal process.
Certbot auto-renews your SSL certificate every 90 days before expiry if the above command is successful.
ComfyUI is actively running as a system service on your server and accessible using the comfyui.example.com domain defined in your Nginx configuration. Follow the steps below to set up the default nodes and generate images using ComfyUI.
Visit your domain using a web browser such as Chrome to access the ComfyUI interface.
ComfyUI uses the text-to-image workflow by default. Click Load Default in the floating menu to switch to the default workflow in case of unintended changes.
Click the Load Checkpoint node dropdown to select a diffusion model. For example, select the Stable Diffusion XL model.
Navigate to the Prompt node, and enter a positive prompt such as beautiful scenery nature glass bottle landscape, purple galaxy bottle,. Enter a negative prompt in the respective node such as text,watermark.
Click Queue Prompt on the main floating menu to generate a new image.
Wait for the image generation process to complete and view your generated image in the Save Image node.
ComfyUI manager is an add-on tool that provides a user-friendly interface to install and manage custom nodes or models. Follow the steps below to install and enable the ComfyUI manager tool.
Switch to the ComfyUI project directory.
Stop the ComfyUI system service.
Switch to the custom_nodes directory.
Clone the ComfyUI manager repository using Git.
Start the ComfyUI system service.
Access the ComfyUI interface in your web browser.
Verify and click the new Manager option on the floating menu.
Verify that the ComfyUI manager interface loads correctly.
Click Install Custom Nodes or Install Models to install additional nodes and models to enable in ComfyUI.
ComfyUI nodes are modular units that form a workflow and perform specific image generation functionalities. Each ComfyUI node processes input data and passes the output to the next node for further processing in a workflow. This modular approach enables you to create diverse image generation workflows and test multiple configurations to generate high-quality results. The following are the most common node types you can use in your ComfyUI workflows.
You have deployed ComfyUI on a Vultr Cloud GPU server and generated images using the ComfyUI web interface. In addition, you installed the ComfyUI Manager to enable new nodes and models. For more information and configuration options, please visit the ComfyUI community documentation.
0 Comments
Be the first to comment and share your perspective with the community.