2025-11-21 20:41:43 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
#
|
|
|
|
|
# ComfyUI Startup Script
|
|
|
|
|
# Starts ComfyUI server on port 8188
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
WORKSPACE_DIR="${WORKSPACE_DIR:-/workspace}"
|
|
|
|
|
COMFYUI_DIR="${WORKSPACE_DIR}/ComfyUI"
|
|
|
|
|
HF_CACHE="${WORKSPACE_DIR}/huggingface_cache"
|
|
|
|
|
|
|
|
|
|
# Set environment variables
|
|
|
|
|
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
|
|
|
|
|
export HF_HOME="${HF_CACHE}"
|
2025-11-22 21:17:04 +01:00
|
|
|
export TQDM_DISABLE=1
|
2025-11-21 20:41:43 +01:00
|
|
|
|
|
|
|
|
# Navigate to ComfyUI directory
|
|
|
|
|
cd "${COMFYUI_DIR}" || exit 1
|
|
|
|
|
|
2025-11-23 08:38:14 +01:00
|
|
|
# Determine which Python to use
|
|
|
|
|
if [ -f "venv/bin/python" ]; then
|
|
|
|
|
PYTHON_BIN="venv/bin/python"
|
|
|
|
|
echo "Using ComfyUI virtual environment Python..."
|
2025-11-23 06:57:51 +01:00
|
|
|
else
|
2025-11-23 08:38:14 +01:00
|
|
|
PYTHON_BIN="python3"
|
2025-11-23 06:57:51 +01:00
|
|
|
echo "WARNING: venv not found, using system Python"
|
|
|
|
|
fi
|
|
|
|
|
|
2025-11-21 20:41:43 +01:00
|
|
|
echo "Starting ComfyUI on port 8188..."
|
|
|
|
|
echo "Access at: http://localhost:8188"
|
|
|
|
|
echo "Using HuggingFace cache: ${HF_CACHE}"
|
2025-11-23 08:38:14 +01:00
|
|
|
echo "Python: ${PYTHON_BIN}"
|
2025-11-21 20:41:43 +01:00
|
|
|
|
|
|
|
|
# Start ComfyUI with GPU support
|
2025-11-23 08:38:14 +01:00
|
|
|
exec "${PYTHON_BIN}" main.py \
|
2025-11-21 20:41:43 +01:00
|
|
|
--listen 0.0.0.0 \
|
|
|
|
|
--port 8188 \
|
|
|
|
|
--enable-cors-header \
|
|
|
|
|
--preview-method auto
|
|
|
|
|
|
|
|
|
|
echo "ComfyUI stopped"
|