Skip to content

Deployment Overview of ComfyUI on Server

Prerequisites and Basic Requirements

The application requires a server with the following specifications to ensure proper functionality, particularly for GPU-accelerated tasks:

  • Operating System: Debian or Ubuntu.

  • Hardware Requirement: NVIDIA GPU is required for hardware acceleration.

  • Privileges: Root or sudo access is required for package installation and service configuration.

  • Ports:

  • 8188: Internal application port.

  • 443: External HTTPS port.

FQDN of the final panel on the hostkey.in domain

The application is accessible via a specific subdomain template based on the server ID.

Parameter Value
Prefix comfyui
Domain hostkey.in
Full template comfyui{Server_ID_from_Invapi}.hostkey.in

File and Directory Structure

The following directories are used for application data, configurations, and proxy management:

  • /root/ComfyUI: Main application directory containing the source code and models.

  • /root/nginx: Configuration files for the Nginx reverse proxy.

  • /etc/systemd/system/comfyui.service: Systemd service unit file.

  • /data/nginx/user_conf.d: Custom Nginx configuration files.

  • /data/nginx/nginx-certbot.env: Environment variables for the proxy container.

Application Installation Process

The installation process follows these specific steps:

  1. System Preparation: The system packages are updated and upgraded.

  2. NVIDIA Driver Setup:

  3. The existing NVIDIA drivers are checked. If the version is below 580, the current driver is purged.

  4. Kernel headers and dkms are installed.

  5. The nouveau driver is blacklisted to prevent conflicts.

  6. The official NVIDIA CUDA repository is added, and the nvidia-open driver is installed.

  7. Application Deployment:

  8. The ComfyUI repository is cloned into /root/ComfyUI.

  9. Python dependencies are managed via pip, including a specific installation of PyTorch with CUDA 13.0 support (--index-url https://download.pytorch.org/whl/cu130).

  10. All required Python packages from requirements.txt are installed.

  11. Model and Workflow Setup:

  12. The flux1-dev-fp8.safetensors model is downloaded directly into the checkpoints directory if it does not already exist.

  13. A default workflow JSON file (flux1-dev-fp8.json) is deployed to the user workflows directory.

  14. Service Configuration:

  15. The application settings are configured via comfy.settings.json.

  16. A systemd service named comfyui is created and enabled to ensure the application starts automatically on boot.

Access Rights and Security

  • Firewall: The server must allow traffic on port 443 (HTTPS).

  • Service User: The application runs as the root user via systemd.

  • Permissions: Configuration files in /root/nginx and the ComfyUI directory are set with specific ownership to ensure secure access.

Docker Containers and Their Deployment

The deployment utilizes a Docker container to manage SSL certificates and reverse proxying:

Container Name Image Ports Volumes Environment Variables Restart Policy
nginx jonasal/nginx-certbot:latest Host Network nginx_secrets:/etc/letsencrypt, /data/nginx/user_conf.d:/etc/nginx/user_conf.d [email protected] unless-stopped

Custom Scripts and Additional Setup

The following actions are performed during the setup process:

  • Model Download: A script uses wget to download the Flux model with resume capabilities to ensure large files are handled correctly.

  • Environment Cleanup: The /etc/hosts file is modified to remove any existing HuggingFace mirrors to ensure direct connections to official repositories.

Application Update Instructions

To update the main ComfyUI application, perform the following steps:

  1. Navigate to the application directory: cd /root/ComfyUI.

  2. Pull the latest changes from the repository (if using git manually) or re-run the installation script to ensure all dependencies and models are current.

Location of Configuration Files and Data

  • Application Settings: /root/ComfyUI/user/default/comfy.settings.json

  • Workflows: /root/ComfyUI/user/default/workflows/flux1-dev-fp8.json

  • Models (Checkpoints): /root/ComfyUI/models/checkpoints/

Available Ports for Connection

  • HTTPS (External): 443

  • Application (Internal): 8188

Starting and Stopping the Application

The application is managed via systemd. Use the following commands:

  • Start ComfyUI: sudo systemctl start comfyui

  • Stop ComfyUI: sudo systemctl stop comfyui

  • Restart ComfyUI: sudo systemctl restart comfyui

  • Check Status: sudo systemctl status comfyui

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×