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:
-
System Preparation: The system packages are updated, and existing NVIDIA drivers are purged if they do not meet version requirements.
-
Driver Installation:
-
Kernel headers and
dkmsare installed. -
The
nouveaudriver is blacklisted to prevent conflicts. -
The official NVIDIA CUDA repository is added, and the
nvidia-opendriver (version 580 or higher) is installed. -
Environment Setup:
-
Python 3 and
pipare installed. -
PyTorch with CUDA 13.0 support is installed via pip to ensure GPU compatibility.
-
Application Deployment:
-
The ComfyUI repository is cloned from GitHub into
/root/ComfyUI. -
All required Python dependencies listed in
requirements.txtare installed viapip. -
Service Configuration:
-
A systemd service unit is created at
/etc/systemd/system/comfyui.serviceto 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
rootuser, and configuration files are set with0644permissions. -
Driver Security: The
nouveaudriver 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
hostnetwork 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:
-
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.safetensorsmodel from HuggingFace into the checkpoints directory usingwget. -
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.jsonis configured with specific UI preferences (e.g., Menu position and Locale).
Application Update Instructions¶
To update the ComfyUI application, perform the following steps:
-
Navigate to the application directory:
cd /root/ComfyUI. -
Pull the latest changes from the repository:
git pull. -
Update dependencies:
pip install -r requirements.txt. -
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.