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:
-
System Preparation: The system packages are updated and upgraded.
-
NVIDIA Driver Setup:
-
The existing NVIDIA drivers are checked. If the version is below 580, the current driver is purged.
-
Kernel headers and
dkmsare installed. -
The
nouveaudriver is blacklisted to prevent conflicts. -
The official NVIDIA CUDA repository is added, and the
nvidia-opendriver is installed. -
Application Deployment:
-
The ComfyUI repository is cloned into
/root/ComfyUI. -
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). -
All required Python packages from
requirements.txtare installed. -
Model and Workflow Setup:
-
The
flux1-dev-fp8.safetensorsmodel is downloaded directly into the checkpoints directory if it does not already exist. -
A default workflow JSON file (
flux1-dev-fp8.json) is deployed to the user workflows directory. -
Service Configuration:
-
The application settings are configured via
comfy.settings.json. -
A systemd service named
comfyuiis 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
rootuser via systemd. -
Permissions: Configuration files in
/root/nginxand 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
wgetto download the Flux model with resume capabilities to ensure large files are handled correctly. -
Environment Cleanup: The
/etc/hostsfile 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:
-
Navigate to the application directory:
cd /root/ComfyUI. -
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