Skip to content

Deployment Overview of ComfyUI on Server

Prerequisites and Basic Requirements

To ensure the successful deployment of ComfyUI, the following system requirements must be met:

  • Operating System: Debian or Ubuntu.

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

  • Privileges: Root or sudo access is required to install drivers and manage services.

  • Network Ports:

  • 443/TCP: External HTTPS access via Nginx proxy.

  • 8188/TCP: Internal application port.

FQDN of the final panel on the hostkey.in domain

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

File and Directory Structure

The application uses the following directory structure for configuration, data, and workflows:

  • /root/ComfyUI: Main application directory.

  • /root/ComfyUI/models/checkpoints/: Model storage location.

  • /root/ComfyUI/user/default/workflows/: User workflow JSON files.

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

  • /root/nginx: Nginx and Certbot configuration directory.

  • /data/nginx/user_conf.d: Custom Nginx virtual host configurations.

Application installation process

The installation follows a multi-step process to prepare the environment for AI workloads:

  1. System Preparation: The system packages are updated, and existing NVIDIA drivers are purged if they do not meet version requirements.

  2. Driver Installation:

  3. Kernel headers and dkms are installed.

  4. The nouveau driver is blacklisted to prevent conflicts.

  5. The official NVIDIA CUDA repository is added, and the nvidia-open driver (version 580 or higher) is installed.

  6. Environment Setup:

  7. Python 3 and pip are installed.

  8. PyTorch with CUDA 13.0 support is installed via pip to ensure GPU compatibility.

  9. Application Deployment:

  10. The ComfyUI repository is cloned from GitHub into /root/ComfyUI.

  11. All required Python dependencies listed in requirements.txt are installed via pip.

  12. Service Configuration:

  13. A systemd service unit is created at /etc/systemd/system/comfyui.service to manage the application process.

Access Rights and Security

  • Firewall: The application is intended to be accessed through a secure Nginx proxy on port 443.

  • User Permissions: The ComfyUI service runs under the root user, and configuration files are set with 0644 permissions.

  • Driver Security: The nouveau driver is explicitly blacklisted to ensure only the proprietary NVIDIA drivers are used for secure GPU access.

Databases

No external databases are required for this deployment; all data is stored locally within the application directory.

Docker Containers and Their Deployment

The deployment utilizes a single Docker container managed via Docker Compose to handle SSL termination and reverse proxying:

Nginx-Certbot Container

  • Image: jonasal/nginx-certbot:latest

  • Ports: Operates in host network mode.

  • Volumes:

  • nginx_secrets:/etc/letsencrypt: Stores SSL certificates.

  • /data/nginx/user_conf.d:/etc/nginx/user_conf.d: Provides custom Nginx configurations.

  • Environment Variables:

  • [email protected]

  • Restart Policy: unless-stopped

Custom Scripts and Additional Setup

The installation performs several automated setup actions:

  • Model Download: The script attempts to download the flux1-dev-fp8.safetensors model from HuggingFace into the checkpoints directory using wget.

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

  • Configuration Generation: The application settings file comfy.settings.json is configured with specific UI preferences (e.g., Menu position and Locale).

Application Update Instructions

To update the ComfyUI application, perform the following steps:

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

  2. Pull the latest changes from the repository: git pull.

  3. Update dependencies: pip install -r requirements.txt.

  4. Restart the service: systemctl restart comfyui.

Location of configuration files and data

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

  • Workflows: /root/ComfyUI/user/default/workflows/

  • Models: /root/ComfyUI/models/checkpoints/

  • Nginx Configs: /data/nginx/user_conf.d/

Available ports for connection

  • 443: Secure HTTPS access (via Nginx).

  • 8188: Internal application communication.

Starting and Stopping the application

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

  • Start ComfyUI: systemctl start comfyui

  • Stop ComfyUI: systemctl stop comfyui

  • Check Status: systemctl status comfyui

  • Enable on Boot: systemctl enable comfyui

Proxy Servers

The application uses an Nginx container with Certbot to provide SSL/TLS encryption. This setup handles incoming HTTPS requests on port 443 and proxies them to the ComfyUI service running internally on port 8188.

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