diff --git a/.env.example b/.env.example index 671efaf..3c08612 100644 --- a/.env.example +++ b/.env.example @@ -20,3 +20,8 @@ COMFYUI_FLAGS=--listen 0.0.0.0 --port 8188 --disable-pinned-memory --force-fp16 # Build refs (pin to specific commits/tags for reproducibility) COMFYUI_REF=master SAGEATTN_REF=main + +# ComfyUIMini - Mobile-friendly UI (optional) +# Access at http://:3000 +COMFYUIMINI_PORT=3000 +COMFYUIMINI_REF=main diff --git a/README.md b/README.md index b2f569f..7637882 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Standard ComfyUI containers and PyTorch wheels don't support sm_121. SparkyUI so - **ComfyUI** (latest master branch) - **ComfyUI-Manager** - auto-installed on first run for easy custom node management +- **ComfyUIMini** - mobile-friendly web UI for phones/tablets (separate container) - **SageAttention** - compiled natively for sm_121 (Blackwell tensor cores) - **PyTorch 2.9.1+cu130** - ARM64 wheels with CUDA 13.0 support @@ -73,7 +74,9 @@ docker compose up -d docker compose logs -f ``` -**Access:** http://localhost:8188 (or your DGX Spark's IP on LAN) +**Access:** +- **ComfyUI (Desktop):** http://localhost:8188 +- **ComfyUIMini (Mobile):** http://localhost:3000 ## Requirements @@ -102,24 +105,26 @@ SAGEATTN_REF=main ## Architecture ``` -┌─────────────────────────────────────────────────────────────┐ -│ DGX Spark Host │ -│ Ubuntu 24.04 (DGX OS 7) / Driver 580.x │ -│ │ -│ ┌─────────────────────────────────────────────────────┐ │ -│ │ Docker Container (sparkyui:cu130) │ │ -│ │ │ │ -│ │ CUDA 13.0.2 + PyTorch 2.9.1+cu130 │ │ -│ │ SageAttention 2.2.0 (compiled for sm_121) │ │ -│ │ ComfyUI 0.7.x + ComfyUI-Manager │ │ -│ │ │ │ -│ │ Key env vars: │ │ -│ │ TORCH_CUDA_ARCH_LIST="12.1" │ │ -│ │ TORCHDYNAMO_DISABLE="1" │ │ -│ └─────────────────────────────────────────────────────┘ │ -│ │ │ -│ Port 8188 (LAN) │ -└─────────────────────────────────────────────────────────────┘ +┌──────────────────────────────────────────────────────────────────┐ +│ DGX Spark Host │ +│ Ubuntu 24.04 (DGX OS 7) / Driver 580.x │ +│ │ +│ ┌────────────────────────────────────────────────────────────┐ │ +│ │ Docker Network (sparky_net) │ │ +│ │ │ │ +│ │ ┌─────────────────────────┐ ┌──────────────────────────┐ │ │ +│ │ │ comfyui (sparkyui:cu130)│ │ comfyuimini (node:20) │ │ │ +│ │ │ │ │ │ │ │ +│ │ │ CUDA 13.0.2 + PyTorch │◄─┤ Mobile-friendly UI │ │ │ +│ │ │ SageAttention (sm_121) │ │ REST + WebSocket proxy │ │ │ +│ │ │ ComfyUI + Manager │ │ │ │ │ +│ │ │ │ │ Shares /output volume │ │ │ +│ │ └───────────┬─────────────┘ └────────────┬─────────────┘ │ │ +│ │ │ │ │ │ +│ └──────────────┼─────────────────────────────┼────────────────┘ │ +│ │ │ │ +│ Port 8188 (Desktop) Port 3000 (Mobile) │ +└──────────────────────────────────────────────────────────────────┘ ``` ## Version Compatibility @@ -184,6 +189,31 @@ nvidia-smi --query-gpu=clocks.sm,clocks.max.sm,persistence_mode --format=csv **Note:** GPU clock settings don't persist across reboots due to GB10 firmware behavior. Re-apply after each boot. +## ComfyUIMini (Mobile UI) + +SparkyUI includes [ComfyUIMini](https://github.com/ImDarkTom/ComfyUIMini) - a lightweight, mobile-friendly web UI that runs in a separate container. + +**Features:** +- Responsive design optimized for phones and tablets +- Simplified workflow execution interface +- Built-in image gallery (reads from shared output directory) +- Import workflows from ComfyUI in "API Format" +- Multiple themes (dark, light, aurora, nord, etc.) + +**How it works:** +- Runs as a Node.js Express server in its own container (~150MB) +- Connects to ComfyUI via internal Docker network (`http://comfyui:8188`) +- Proxies REST API calls and WebSocket connections +- Shares the output directory for gallery viewing + +**Access:** `http://:3000` + +**Build only ComfyUIMini** (if ComfyUI already built): +```bash +docker compose build comfyuimini +docker compose up -d comfyuimini +``` + ## SageAttention Notes SageAttention PR #297 added sm_121 support but was merged then reverted due to stability issues. Our approach: @@ -204,8 +234,9 @@ When these land, SparkyUI can be simplified: ## Credits - Unified memory architecture insights from [HurbaLurba's DGX-SPARK-COMFYUI-DOCKER](https://github.com/HurbaLurba/DGX-SPARK-COMFYUI-DOCKER) -- SageAttention by [thu-ml](https://github.com/thu-ml/SageAttention) -- ComfyUI by [comfyanonymous](https://github.com/comfyanonymous/ComfyUI) +- [ComfyUIMini](https://github.com/ImDarkTom/ComfyUIMini) by ImDarkTom +- [SageAttention](https://github.com/thu-ml/SageAttention) by thu-ml +- [ComfyUI](https://github.com/comfyanonymous/ComfyUI) by comfyanonymous ## License diff --git a/comfyuimini/.dockerignore b/comfyuimini/.dockerignore new file mode 100644 index 0000000..4b38425 --- /dev/null +++ b/comfyuimini/.dockerignore @@ -0,0 +1,21 @@ +# Node.js +node_modules/ +npm-debug.log* + +# Git +.git/ +.gitignore + +# Documentation +*.md +LICENSE + +# Environment +.env* + +# IDE +.vscode/ +.idea/ + +# Build artifacts (will be generated in container) +dist/ diff --git a/comfyuimini/Dockerfile b/comfyuimini/Dockerfile new file mode 100644 index 0000000..7419cac --- /dev/null +++ b/comfyuimini/Dockerfile @@ -0,0 +1,42 @@ +# ComfyUIMini - Mobile-friendly UI for ComfyUI +# Lightweight Node.js container that proxies to ComfyUI +FROM node:20-alpine + +LABEL maintainer="SparkyUI" +LABEL description="ComfyUIMini mobile UI for ComfyUI on DGX Spark" + +WORKDIR /app + +# Install git for cloning, then clean up +RUN apk add --no-cache git + +# Clone ComfyUIMini +ARG COMFYUIMINI_REF=main +RUN git clone https://github.com/ImDarkTom/ComfyUIMini.git . && \ + git checkout ${COMFYUIMINI_REF} + +# Install all deps, build TypeScript, then prune dev dependencies +RUN npm ci && \ + npm run build && \ + npm prune --omit=dev + +# Create config directory and default config +# Config is overridden at runtime via NODE_CONFIG env var +RUN mkdir -p config && \ + cp config/default.example.json config/default.json + +# Create directories for workflows and ensure proper permissions +RUN mkdir -p workflows && \ + chown -R node:node /app + +# Switch to non-root user +USER node + +EXPOSE 3000 + +# Health check - verify the server responds +HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ + CMD wget --no-verbose --tries=1 --spider http://localhost:3000/ || exit 1 + +# Project uses tsx to run TypeScript directly (not compiled to dist/) +CMD ["npm", "start"] diff --git a/docker-compose.yml b/docker-compose.yml index ecbcee8..9d1c817 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -63,4 +63,63 @@ services: # Wheel cache (optional - for prebuilt wheels) - ${SPARKYUI_DATA_PATH}/wheels:/opt/wheels + networks: + - sparky_net + + # Health check - ComfyUI takes time to load, so generous start period + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8188/"] + interval: 30s + timeout: 10s + start_period: 120s + retries: 3 + restart: unless-stopped + + # ComfyUIMini - Mobile-friendly UI + # Access at http://:3000 + comfyuimini: + build: + context: ./comfyuimini + dockerfile: Dockerfile + args: + COMFYUIMINI_REF: "${COMFYUIMINI_REF:-main}" + + image: comfyuimini:latest + container_name: comfyuimini + + ports: + - "${COMFYUIMINI_PORT:-3000}:3000" + + environment: + # node-config override - connects to comfyui container via docker network + NODE_CONFIG: >- + { + "app_port": 3000, + "comfyui_url": "http://comfyui:8188", + "comfyui_ws_url": "ws://comfyui:8188", + "output_dir": "/shared/output", + "reject_unauthorised_cert": false + } + + volumes: + # Share output directory with ComfyUI for gallery feature (read-only) + - ${SPARKYUI_DATA_PATH}/output:/shared/output:ro + # Persist server-side workflows + - comfyuimini_workflows:/app/workflows + + networks: + - sparky_net + + depends_on: + comfyui: + condition: service_healthy + + restart: unless-stopped + +networks: + sparky_net: + driver: bridge + +volumes: + comfyuimini_workflows: