Add ComfyUI as an optional service in the installer

- Updated .env.example to include COMFYUI_HOSTNAME for configuration.
- Modified Caddyfile to add a reverse proxy for ComfyUI at the specified hostname.
- Enhanced docker-compose.yml to include a new ComfyUI service with persistent storage and health checks.
- Updated scripts to integrate ComfyUI into the setup wizard and final report.
- Documented the integration process and reflections in the memory bank for future reference.
This commit is contained in:
Yury Kossakovsky
2025-08-07 22:13:01 -06:00
parent a2d298fca5
commit 51d46d9144
8 changed files with 152 additions and 0 deletions

View File

@@ -138,6 +138,7 @@ PROMETHEUS_HOSTNAME=prometheus.yourdomain.com
PORTAINER_HOSTNAME=portainer.yourdomain.com
LETTA_HOSTNAME=letta.yourdomain.com
QDRANT_HOSTNAME=qdrant.yourdomain.com
COMFYUI_HOSTNAME=comfyui.yourdomain.com
LETSENCRYPT_EMAIL=
# Everything below this point is optional.

View File

@@ -73,6 +73,11 @@
reverse_proxy qdrant:6333
}
# ComfyUI
{$COMFYUI_HOSTNAME} {
reverse_proxy comfyui:8188
}
# Neo4j
{$NEO4J_HOSTNAME} {
reverse_proxy neo4j:7474

View File

@@ -30,6 +30,8 @@ The installer also makes the following powerful open-source tools **available fo
✅ [**Flowise**](https://flowiseai.com/) - A no-code/low-code AI agent builder that complements n8n perfectly, allowing you to create sophisticated AI applications with ease.
✅ [**ComfyUI**](https://github.com/comfyanonymous/ComfyUI) - A powerful, node-based UI for Stable Diffusion workflows. Build and run image-generation pipelines visually, with support for custom nodes and extensions.
✅ [**Dify**](https://dify.ai/) - An open-source AI application development platform that provides comprehensive LLMOps capabilities, including workflow management, prompt engineering, RAG pipelines, and AI agent orchestration. Perfect for building production-ready AI applications.
✅ [**Qdrant**](https://qdrant.tech/) - A high-performance open-source vector store, specialized for AI. While Supabase also offers vector capabilities, Qdrant is included for its speed, making it ideal for demanding AI tasks.
@@ -134,6 +136,7 @@ After successful installation, your services are up and running! Here's how to g
- **SearXNG:** `searxng.yourdomain.com`
- **Prometheus:** `prometheus.yourdomain.com` (Typically used as a data source for Grafana)
- **Portainer:** `portainer.yourdomain.com` (Protected by Caddy basic auth; on first login, complete Portainer admin setup)
- **ComfyUI:** `comfyui.yourdomain.com` (Node-based Stable Diffusion UI)
2. **Explore n8n:**

View File

@@ -16,6 +16,7 @@ volumes:
letta_data:
weaviate_data:
portainer_data:
comfyui_data:
x-n8n: &service-n8n
build:
@@ -214,6 +215,7 @@ services:
- SEARXNG_USERNAME=${SEARXNG_USERNAME}
- SEARXNG_PASSWORD_HASH=${SEARXNG_PASSWORD_HASH}
- PORTAINER_HOSTNAME=${PORTAINER_HOSTNAME}
- COMFYUI_HOSTNAME=${COMFYUI_HOSTNAME}
cap_drop:
- ALL
cap_add:
@@ -581,3 +583,18 @@ services:
volumes:
- portainer_data:/data
- ${DOCKER_SOCKET_LOCATION:-/var/run/docker.sock}:/var/run/docker.sock
comfyui:
image: yanwk/comfyui-boot:cu124-slim
container_name: comfyui
profiles: ["comfyui"]
restart: unless-stopped
environment:
- CLI_ARGS=--listen 0.0.0.0
volumes:
- comfyui_data:/home/runner
healthcheck:
test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:8188"]
interval: 10s
timeout: 5s
retries: 5

View File

@@ -0,0 +1,34 @@
# Reflection: ComfyUI Integration (Level 2)
## Summary
Added ComfyUI as an optional service using Docker Compose profile `comfyui`, proxied via Caddy at `COMFYUI_HOSTNAME`. Default CPU support, optional GPU planned. Updated `.env.example`, `docker-compose.yml`, `Caddyfile`, `scripts/04_wizard.sh`, `scripts/06_final_report.sh`, and `README.md`.
## What Went Well
- Followed existing installer patterns (profiles, Caddy host blocks, env generation/wizard/reporting) with minimal, clear edits
- Simple reverse proxy through Caddy; WebSocket support expected to work without extra config
- Compose config validated successfully
## Challenges
- No single “official” Docker image; community images differ in volume layout and flags
- Volume paths for models/output/custom_nodes vary by image; chose a conservative mount point for persistence
- GPU enablement requires NVIDIA toolkit and compose device reservations (not universally available)
## Lessons Learned
- Keep defaults CPU-first to minimize friction; add GPU as an opt-in
- Abstract image details behind a validation checklist (port 8188, volume paths, CLI flags)
- Document model storage and persistence expectations explicitly
## Improvements / Next Steps
- Consider adding a GPU-specific profile variant (e.g., `comfyui-gpu-nvidia`) when environment supports it
- Evaluate switching to a more widely adopted/maintained image and standardize volume mappings
- Extend final report with quick pointers to model directories and basic usage tips
## Verification Checklist
- Implementation reviewed end-to-end: YES
- Successes documented: YES
- Challenges documented: YES
- Lessons learned documented: YES
- Process/Technical improvements identified: YES
## Impact
- New optional service enabling visual Stable Diffusion workflows in the installer with minimal complexity

View File

@@ -466,3 +466,87 @@ Integrate Portainer Community Edition as an optional service to manage the local
### Archiving Status (Portainer)
- [x] Archive document created: `memory-bank/archive/feature-portainer-integration_20250808.md`
- [x] tasks.md marked COMPLETE for Portainer
---
## New Task: Add ComfyUI Service (Node-based UI for SD Workflows)
### Description
Integrate ComfyUI as an optional service in the installer, proxied by Caddy at a configurable hostname. Default to CPU-only for simplicity; allow optional GPU via NVIDIA Container Toolkit if present.
### Complexity
- Level: 2 (Simple Enhancement)
- Type: Add-on service via Docker Compose profile + Caddy
### Options Considered (Research)
- Dockerized ComfyUI service using a maintained community image (e.g., ghcr.io/ai-dock/comfyui or equivalent)
- Bare-metal Python install managed by scripts (higher maintenance, not aligned with project patterns)
- Integrate as an extension of AUTOMATIC1111 (not applicable to this projects stack)
- Build our own image from source (heavier maintenance)
→ Recommended: Use a maintained ComfyUI Docker image exposing port 8188, mount persistent volumes for models and custom nodes, reverse-proxy with Caddy. GPU support remains optional via compose flags when host supports NVIDIA.
### Technology Stack
- Image: Maintained ComfyUI Docker image (to be validated during tech gate)
- Port: 8188 (internal)
- Reverse proxy: Caddy with HTTPS at `COMFYUI_HOSTNAME`
- Storage: Named volume `comfyui_data` (models, input, output, custom_nodes)
- GPU: Optional via NVIDIA toolkit (compose device reservations)
### Files to Modify
- `.env.example`: add `COMFYUI_HOSTNAME`
- `docker-compose.yml`: add `comfyui` service with `profiles: ["comfyui"]`, volumes, healthcheck, optional GPU stanza
- `Caddyfile`: add host block for `{$COMFYUI_HOSTNAME}``reverse_proxy comfyui:8188`
- `scripts/04_wizard.sh`: add `comfyui` option with description
- `scripts/06_final_report.sh`: add ComfyUI section with URL
- `scripts/03_generate_secrets.sh`: generate default hostname `COMFYUI_HOSTNAME`
### Implementation Steps
1) `.env.example`
- Add `COMFYUI_HOSTNAME=comfyui.yourdomain.com`
2) Wizard
- Add `comfyui` to selectable services list
3) docker-compose
- Add `comfyui` service (image, port 8188, volumes: `comfyui_data:/data` or image-appropriate paths)
- Add `comfyui_data:` to top-level volumes
- Optional GPU: add NVIDIA device reservations when available
4) Caddy
- Add site for `{$COMFYUI_HOSTNAME}` with `reverse_proxy comfyui:8188`
5) Final report
- Print ComfyUI URL when profile active
6) Secrets script
- Generate/populate `COMFYUI_HOSTNAME` similar to other hostnames
### Potential Challenges
- Large model storage footprint; ensure persistent volume and document where to place models
- GPU optionality: only enable when NVIDIA toolkit exists; keep CPU default to avoid install friction
- WebSockets: Caddy generally handles WS automatically; verify UI works via proxy
### Technology Validation Checkpoints
- [ ] Confirm maintained image name and tag
- [ ] Verify port 8188 and container paths for volumes (models/custom_nodes)
- [ ] Validate Caddy reverse proxy works (incl. websockets)
- [ ] Optional: Validate GPU flags on a host with NVIDIA toolkit
### Testing Strategy
- Start only Caddy + ComfyUI with profile enabled
- Access `https://COMFYUI_HOSTNAME` and verify UI loads and basic workflow runs
- Confirm persistence of uploads/outputs in `comfyui_data`
### Next Mode Recommendation
- Implement Mode (no creative phase required)
### Reflection Status (ComfyUI)
- [x] Implementation thoroughly reviewed
- [x] Successes documented
- [x] Challenges and solutions analyzed
- [x] Lessons Learned documented
- [x] Process/Technical improvements identified
- [x] reflection-comfyui-integration.md created
- [x] tasks.md updated with reflection status
### Reflection Highlights (ComfyUI)
- **What Went Well**: Minimal changes following established patterns (profiles, Caddy, wizard, README, final report); compose validated successfully.
- **Challenges**: Lack of a clearly “official” image; differing volume paths across images; optional GPU support trade-offs.
- **Lessons Learned**: Default to CPU for broad compatibility; keep image choice abstract to allow swapping; add validation checklist for volumes and websockets.
- **Improvements**: Consider adding a GPU sub-profile and documenting model storage locations; later evaluate swapping to a more authoritative image with stable volume conventions.

View File

@@ -66,6 +66,7 @@ base_services_data=(
"open-webui" "Open WebUI (ChatGPT-like Interface)"
"searxng" "SearXNG (Private Metasearch Engine)"
"ollama" "Ollama (Local LLM Runner - select hardware in next step)"
"comfyui" "ComfyUI (Node-based Stable Diffusion UI)"
)
services=() # This will be the final array for whiptail

View File

@@ -135,6 +135,13 @@ if is_profile_active "portainer"; then
echo "(Note: On first login, Portainer will prompt to set up an admin user.)"
fi
if is_profile_active "comfyui"; then
echo
echo "================================= ComfyUI ============================="
echo
echo "Host: ${COMFYUI_HOSTNAME:-<hostname_not_set>}"
fi
if is_profile_active "qdrant"; then
echo
echo "================================= Qdrant =============================="