container-superposition 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -15
- package/dist/scripts/init.js +1 -1537
- package/dist/scripts/init.js.map +1 -1
- package/dist/tool/cli/args.d.ts +20 -0
- package/dist/tool/cli/args.d.ts.map +1 -0
- package/dist/tool/cli/args.js +325 -0
- package/dist/tool/cli/args.js.map +1 -0
- package/dist/tool/cli/run.d.ts +2 -0
- package/dist/tool/cli/run.d.ts.map +1 -0
- package/dist/tool/cli/run.js +318 -0
- package/dist/tool/cli/run.js.map +1 -0
- package/dist/tool/commands/doctor.d.ts.map +1 -1
- package/dist/tool/commands/doctor.js +141 -6
- package/dist/tool/commands/doctor.js.map +1 -1
- package/dist/tool/commands/explain.d.ts.map +1 -1
- package/dist/tool/commands/explain.js +9 -0
- package/dist/tool/commands/explain.js.map +1 -1
- package/dist/tool/commands/migrate.d.ts +7 -0
- package/dist/tool/commands/migrate.d.ts.map +1 -0
- package/dist/tool/commands/migrate.js +52 -0
- package/dist/tool/commands/migrate.js.map +1 -0
- package/dist/tool/questionnaire/answers.d.ts +16 -0
- package/dist/tool/questionnaire/answers.d.ts.map +1 -0
- package/dist/tool/questionnaire/answers.js +102 -0
- package/dist/tool/questionnaire/answers.js.map +1 -0
- package/dist/tool/questionnaire/composer.d.ts +3 -3
- package/dist/tool/questionnaire/composer.d.ts.map +1 -1
- package/dist/tool/questionnaire/composer.js +691 -27
- package/dist/tool/questionnaire/composer.js.map +1 -1
- package/dist/tool/questionnaire/presets.d.ts +60 -0
- package/dist/tool/questionnaire/presets.d.ts.map +1 -0
- package/dist/tool/questionnaire/presets.js +164 -0
- package/dist/tool/questionnaire/presets.js.map +1 -0
- package/dist/tool/questionnaire/questionnaire.d.ts +10 -0
- package/dist/tool/questionnaire/questionnaire.d.ts.map +1 -0
- package/dist/tool/questionnaire/questionnaire.js +580 -0
- package/dist/tool/questionnaire/questionnaire.js.map +1 -0
- package/dist/tool/schema/manifest-migrations.d.ts +5 -0
- package/dist/tool/schema/manifest-migrations.d.ts.map +1 -1
- package/dist/tool/schema/manifest-migrations.js +45 -0
- package/dist/tool/schema/manifest-migrations.js.map +1 -1
- package/dist/tool/schema/overlay-loader.d.ts.map +1 -1
- package/dist/tool/schema/overlay-loader.js +24 -0
- package/dist/tool/schema/overlay-loader.js.map +1 -1
- package/dist/tool/schema/project-config.d.ts +13 -1
- package/dist/tool/schema/project-config.d.ts.map +1 -1
- package/dist/tool/schema/project-config.js +183 -9
- package/dist/tool/schema/project-config.js.map +1 -1
- package/dist/tool/schema/target-rules.d.ts +78 -0
- package/dist/tool/schema/target-rules.d.ts.map +1 -0
- package/dist/tool/schema/target-rules.js +367 -0
- package/dist/tool/schema/target-rules.js.map +1 -0
- package/dist/tool/schema/types.d.ts +38 -1
- package/dist/tool/schema/types.d.ts.map +1 -1
- package/dist/tool/utils/parameters.d.ts +76 -0
- package/dist/tool/utils/parameters.d.ts.map +1 -0
- package/dist/tool/utils/parameters.js +125 -0
- package/dist/tool/utils/parameters.js.map +1 -0
- package/dist/tool/utils/paths.d.ts +2 -0
- package/dist/tool/utils/paths.d.ts.map +1 -0
- package/dist/tool/utils/paths.js +31 -0
- package/dist/tool/utils/paths.js.map +1 -0
- package/docs/deployment-targets.md +88 -56
- package/docs/examples.md +20 -17
- package/docs/filesystem-contract.md +5 -0
- package/docs/minimal-and-editor.md +65 -5
- package/docs/overlay-imports.md +92 -14
- package/docs/overlays.md +113 -28
- package/docs/specs/007-init-project-file/spec.md +66 -0
- package/docs/specs/007-target-aware-generation/spec.md +126 -0
- package/docs/specs/008-project-file-canonical/spec.md +83 -0
- package/docs/specs/009-project-env/spec.md +147 -0
- package/docs/specs/010-compose-env-materialization/spec.md +130 -0
- package/docs/specs/011-overlay-parameters/spec.md +235 -0
- package/overlays/.shared/README.md +27 -2
- package/overlays/.shared/compose/nvidia-gpu-devcontainer.yml +22 -0
- package/overlays/comfyui/.env.example +34 -0
- package/overlays/comfyui/README.md +342 -0
- package/overlays/comfyui/devcontainer.patch.json +15 -0
- package/overlays/comfyui/docker-compose.yml +39 -0
- package/overlays/comfyui/overlay.yml +20 -0
- package/overlays/comfyui/setup.sh +36 -0
- package/overlays/comfyui/verify.sh +103 -0
- package/overlays/k3d/README.md +201 -0
- package/overlays/k3d/devcontainer.patch.json +9 -0
- package/overlays/k3d/overlay.yml +19 -0
- package/overlays/k3d/setup.sh +34 -0
- package/overlays/k3d/verify.sh +38 -0
- package/overlays/ollama/.env.example +14 -0
- package/overlays/ollama/README.md +325 -0
- package/overlays/ollama/devcontainer.patch.json +14 -0
- package/overlays/ollama/docker-compose.yml +24 -0
- package/overlays/ollama/overlay.yml +22 -0
- package/overlays/ollama/setup.sh +106 -0
- package/overlays/ollama/verify.sh +99 -0
- package/overlays/open-webui/.env.example +5 -0
- package/overlays/open-webui/README.md +162 -0
- package/overlays/open-webui/devcontainer.patch.json +14 -0
- package/overlays/open-webui/docker-compose.yml +23 -0
- package/overlays/open-webui/overlay.yml +38 -0
- package/overlays/pgvector/.env.example +6 -0
- package/overlays/pgvector/README.md +215 -0
- package/overlays/pgvector/devcontainer.patch.json +23 -0
- package/overlays/pgvector/docker-compose.yml +32 -0
- package/overlays/pgvector/overlay.yml +44 -0
- package/overlays/postgres/.env.example +5 -5
- package/overlays/postgres/devcontainer.patch.json +4 -4
- package/overlays/postgres/docker-compose.yml +10 -6
- package/overlays/postgres/overlay.yml +19 -1
- package/overlays/qdrant/.env.example +4 -0
- package/overlays/qdrant/README.md +216 -0
- package/overlays/qdrant/devcontainer.patch.json +20 -0
- package/overlays/qdrant/docker-compose.yml +25 -0
- package/overlays/qdrant/overlay.yml +40 -0
- package/overlays/skaffold/README.md +256 -0
- package/overlays/skaffold/devcontainer.patch.json +9 -0
- package/overlays/skaffold/overlay.yml +20 -0
- package/overlays/skaffold/setup.sh +33 -0
- package/overlays/skaffold/verify.sh +24 -0
- package/package.json +3 -2
- package/tool/schema/config.schema.json +31 -1
- package/tool/schema/overlay-manifest.schema.json +33 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ComfyUI Configuration
|
|
2
|
+
|
|
3
|
+
# ComfyUI models storage strategy:
|
|
4
|
+
#
|
|
5
|
+
# Option A (default) — named Docker volume (no host path needed):
|
|
6
|
+
# Leave COMFYUI_MODELS_HOST_PATH unset. Models persist in the Docker volume
|
|
7
|
+
# named "comfyui-models" and are shared between devcontainer and ComfyUI.
|
|
8
|
+
#
|
|
9
|
+
# Option B — bind mount to host directory (also accessible from host tools):
|
|
10
|
+
# Set COMFYUI_MODELS_HOST_PATH to an absolute host path.
|
|
11
|
+
# Docker creates the directory if it does not exist.
|
|
12
|
+
# Note: Docker Compose does not expand '~' in .env files; always use full absolute paths.
|
|
13
|
+
# macOS/Linux examples:
|
|
14
|
+
# COMFYUI_MODELS_HOST_PATH=/home/you/.cache/comfyui/models
|
|
15
|
+
# COMFYUI_MODELS_HOST_PATH=/home/you/ComfyUI/models
|
|
16
|
+
# Windows (Docker Desktop — use absolute path, no tilde):
|
|
17
|
+
# COMFYUI_MODELS_HOST_PATH=C:/Users/you/.cache/comfyui/models
|
|
18
|
+
#
|
|
19
|
+
# COMFYUI_MODELS_HOST_PATH=
|
|
20
|
+
|
|
21
|
+
# Where ComfyUI-generated images/videos are saved.
|
|
22
|
+
# Leave unset to use the named Docker volume "comfyui-output" (default),
|
|
23
|
+
# or set to an absolute host path to save outputs to the host filesystem.
|
|
24
|
+
# COMFYUI_OUTPUT_PATH=
|
|
25
|
+
|
|
26
|
+
# ComfyUI Docker image tag. Use 'latest-cuda' for NVIDIA GPU, 'latest-rocm' for AMD/ROCm, or 'latest-cpu' for CPU-only.
|
|
27
|
+
COMFYUI_VERSION=latest-cuda
|
|
28
|
+
|
|
29
|
+
# Host port for the ComfyUI web UI. Default: 8188.
|
|
30
|
+
COMFYUI_PORT=8188
|
|
31
|
+
|
|
32
|
+
# Extra CLI arguments passed to ComfyUI at startup.
|
|
33
|
+
# --listen 0.0.0.0 is required to accept connections from outside the container.
|
|
34
|
+
CLI_ARGS=--listen 0.0.0.0
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
# ComfyUI Overlay
|
|
2
|
+
|
|
3
|
+
Runs [ComfyUI](https://github.com/comfyanonymous/ComfyUI) as a Docker Compose service, providing a reproducible, containerised node-based image and video generation environment with a shared models directory accessible from both the devcontainer and the ComfyUI sidecar.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Node-based workflow UI** — Visual node editor for building Stable Diffusion and generative AI pipelines, accessible at `http://localhost:8188`
|
|
8
|
+
- **REST and WebSocket API** — Programmatically submit workflows and receive results via ComfyUI's built-in API
|
|
9
|
+
- **Custom node support** — Install community custom nodes to extend workflows with new models and operations
|
|
10
|
+
- **Shared models directory** — Single volume root (`/opt/comfyui-models`) mounted into both the devcontainer and the ComfyUI sidecar; model files are accessible by scripts running in the devcontainer without going through the HTTP API
|
|
11
|
+
- **Output persistence** — Generated images and videos are saved to a named volume (or host path) so they survive container restarts
|
|
12
|
+
- **Port 8188** — Standard ComfyUI web UI port, auto-forwarded and opened in the browser
|
|
13
|
+
|
|
14
|
+
## How It Works
|
|
15
|
+
|
|
16
|
+
ComfyUI runs as a long-lived Docker Compose service (`comfyui`) alongside your devcontainer. The devcontainer reaches it via the hostname `comfyui` on port `8188`.
|
|
17
|
+
|
|
18
|
+
**Service configuration:**
|
|
19
|
+
|
|
20
|
+
- Image: `ghcr.io/ai-dock/comfyui:latest-cuda` (configurable via `COMFYUI_VERSION`)
|
|
21
|
+
- Network: `devnet` (shared with the dev container)
|
|
22
|
+
- Port: `8188` (ComfyUI web UI and REST API)
|
|
23
|
+
- Volumes: single models root shared between devcontainer and ComfyUI sidecar
|
|
24
|
+
|
|
25
|
+
The `COMFYUI_URL` environment variable is set to `http://comfyui:8188` in the devcontainer so scripts and tools can connect without hard-coding the address.
|
|
26
|
+
|
|
27
|
+
The `COMFYUI_MODELS_DIR` environment variable is set to `/opt/comfyui-models` in the devcontainer — the fixed path where the shared models volume is mounted.
|
|
28
|
+
|
|
29
|
+
## Shared Models Directory
|
|
30
|
+
|
|
31
|
+
`/opt/comfyui-models` is the single models root visible to **both** the devcontainer and the ComfyUI sidecar. Files written to this directory from any side are immediately visible to the other — no restart required.
|
|
32
|
+
|
|
33
|
+
### Subdirectory Layout
|
|
34
|
+
|
|
35
|
+
`setup.sh` pre-creates all expected subdirectories on first run:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
/opt/comfyui-models/
|
|
39
|
+
├── checkpoints/ — Stable Diffusion base models (.safetensors, .ckpt)
|
|
40
|
+
├── loras/ — LoRA fine-tuning weights
|
|
41
|
+
├── controlnet/ — ControlNet guidance models
|
|
42
|
+
├── clip_vision/ — CLIP Vision models
|
|
43
|
+
├── vae/ — VAE decoder models
|
|
44
|
+
├── embeddings/ — Textual inversion embeddings
|
|
45
|
+
└── upscale_models/ — Image upscaling models (ESRGAN, etc.)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Tier 1 (default): Named Docker Volume
|
|
49
|
+
|
|
50
|
+
When `COMFYUI_MODELS_HOST_PATH` is **not** set (the default), a named Docker Compose volume `comfyui-models` is used. Models persist across container rebuilds without any host-side setup and work on all platforms.
|
|
51
|
+
|
|
52
|
+
```yaml
|
|
53
|
+
# docker-compose.yml (simplified)
|
|
54
|
+
volumes:
|
|
55
|
+
comfyui-models:
|
|
56
|
+
name: comfyui-models
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Tier 2 (opt-in): Bind Mount to Host Path
|
|
60
|
+
|
|
61
|
+
Set `COMFYUI_MODELS_HOST_PATH` in `.devcontainer/.env` to switch to a bind mount — the same Compose config handles both cases with no structural change:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# .devcontainer/.env
|
|
65
|
+
# Note: Docker Compose does not expand '~' in .env files; always use full absolute paths.
|
|
66
|
+
|
|
67
|
+
# macOS / Linux
|
|
68
|
+
COMFYUI_MODELS_HOST_PATH=/home/you/.cache/comfyui/models
|
|
69
|
+
|
|
70
|
+
# Windows (Docker Desktop — use absolute path, no tilde)
|
|
71
|
+
COMFYUI_MODELS_HOST_PATH=C:/Users/you/.cache/comfyui/models
|
|
72
|
+
|
|
73
|
+
# Reuse an existing local ComfyUI install
|
|
74
|
+
COMFYUI_MODELS_HOST_PATH=/home/you/ComfyUI/models
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Reusing an Existing Local ComfyUI Install
|
|
78
|
+
|
|
79
|
+
Point `COMFYUI_MODELS_HOST_PATH` at your existing models directory to avoid re-downloading multi-GB files:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Use the full absolute path — Docker Compose does not expand '~' in .env files
|
|
83
|
+
COMFYUI_MODELS_HOST_PATH=/home/you/ComfyUI/models
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Downloading Models from the Devcontainer
|
|
87
|
+
|
|
88
|
+
Use `curl`, `wget`, or `huggingface-cli` inside the devcontainer to download models directly into the shared directory — they are immediately visible in ComfyUI's model browser:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Download a checkpoint
|
|
92
|
+
curl -L -o "${COMFYUI_MODELS_DIR}/checkpoints/my-model.safetensors" \
|
|
93
|
+
"https://huggingface.co/.../resolve/main/my-model.safetensors"
|
|
94
|
+
|
|
95
|
+
# Download with wget
|
|
96
|
+
wget -P "${COMFYUI_MODELS_DIR}/checkpoints/" \
|
|
97
|
+
"https://huggingface.co/.../resolve/main/my-model.safetensors"
|
|
98
|
+
|
|
99
|
+
# Download with huggingface-cli (requires huggingface_hub)
|
|
100
|
+
huggingface-cli download org/repo my-model.safetensors \
|
|
101
|
+
--local-dir "${COMFYUI_MODELS_DIR}/checkpoints/"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Files written to `$COMFYUI_MODELS_DIR` are **immediately visible in ComfyUI** — no restart is needed because the volume is live-mounted.
|
|
105
|
+
|
|
106
|
+
### Windows Note
|
|
107
|
+
|
|
108
|
+
Docker Compose does not expand `~` in `.env` files on any platform. Always use full absolute paths for `COMFYUI_MODELS_HOST_PATH`:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Windows — use absolute path with forward slashes
|
|
112
|
+
COMFYUI_MODELS_HOST_PATH=C:/Users/you/.cache/comfyui/models
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Common Workflows
|
|
116
|
+
|
|
117
|
+
### Open the Web UI
|
|
118
|
+
|
|
119
|
+
Once the container is running, open `http://localhost:8188` in your browser. The node editor loads automatically.
|
|
120
|
+
|
|
121
|
+
### Load a Workflow
|
|
122
|
+
|
|
123
|
+
1. Download a workflow JSON file (e.g. from [ComfyUI workflows](https://comfyworkflows.com/))
|
|
124
|
+
2. In the ComfyUI UI, click **Load** and select the JSON file
|
|
125
|
+
3. Connect missing model nodes to your available checkpoints and click **Queue Prompt**
|
|
126
|
+
|
|
127
|
+
### Run Inference via CLI
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Submit a workflow JSON via the ComfyUI API from inside the devcontainer
|
|
131
|
+
curl -X POST http://comfyui:8188/prompt \
|
|
132
|
+
-H "Content-Type: application/json" \
|
|
133
|
+
-d @workflow_api.json
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Save Outputs
|
|
137
|
+
|
|
138
|
+
Generated images appear in the `comfyui-output` named volume by default, or at the path configured in `COMFYUI_OUTPUT_PATH`.
|
|
139
|
+
|
|
140
|
+
## GPU Acceleration
|
|
141
|
+
|
|
142
|
+
GPU passthrough is enabled out of the box. The `comfyui` service receives `gpus: all` via the `deploy.resources.reservations.devices` block in the overlay's `docker-compose.yml`:
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
deploy:
|
|
146
|
+
resources:
|
|
147
|
+
reservations:
|
|
148
|
+
devices:
|
|
149
|
+
- driver: nvidia
|
|
150
|
+
count: all
|
|
151
|
+
capabilities: [gpu]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Prerequisites
|
|
155
|
+
|
|
156
|
+
GPU passthrough requires the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) installed and configured on the host:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Verify NVIDIA driver is installed on the host
|
|
160
|
+
nvidia-smi
|
|
161
|
+
|
|
162
|
+
# Verify NVIDIA Container Toolkit
|
|
163
|
+
docker run --rm --gpus all nvidia/cuda:12.0-base nvidia-smi
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
> **Note:** On machines without an NVIDIA GPU or without the NVIDIA Container Toolkit, Docker Compose may warn about unresolvable device requests. Use `COMFYUI_VERSION=latest-cpu` to switch to CPU-only mode (see below).
|
|
167
|
+
|
|
168
|
+
**See also:** The [`cuda`](../cuda/README.md) overlay installs NVIDIA CUDA toolkit support in the devcontainer itself.
|
|
169
|
+
|
|
170
|
+
### CPU-Only Mode
|
|
171
|
+
|
|
172
|
+
If you do not have an NVIDIA GPU, switch to the CPU image by setting `COMFYUI_VERSION` in `.devcontainer/.env`:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
COMFYUI_VERSION=latest-cpu
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
CPU inference is significantly slower but works on any machine.
|
|
179
|
+
|
|
180
|
+
### AMD GPU (ROCm)
|
|
181
|
+
|
|
182
|
+
For AMD GPU support, use a ROCm-compatible image tag:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
COMFYUI_VERSION=latest-rocm
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**See also:** The [`rocm`](../rocm/README.md) overlay for ROCm toolkit support in the devcontainer.
|
|
189
|
+
|
|
190
|
+
## Custom Nodes
|
|
191
|
+
|
|
192
|
+
Custom nodes extend ComfyUI with new model types, loaders, and processing steps. To persist custom nodes across container rebuilds, add a named volume for the custom nodes directory via a custom Docker Compose patch in `.devcontainer/custom/docker-compose.patch.yml`:
|
|
193
|
+
|
|
194
|
+
```yaml
|
|
195
|
+
services:
|
|
196
|
+
comfyui:
|
|
197
|
+
volumes:
|
|
198
|
+
- comfyui-custom-nodes:/opt/ComfyUI/custom_nodes
|
|
199
|
+
|
|
200
|
+
volumes:
|
|
201
|
+
comfyui-custom-nodes:
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Then install custom nodes from inside the running container:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
docker compose exec comfyui bash -c \
|
|
208
|
+
"cd /opt/ComfyUI/custom_nodes && git clone https://github.com/example/custom-node"
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## API Usage
|
|
212
|
+
|
|
213
|
+
ComfyUI exposes a REST and WebSocket API for programmatic workflow execution.
|
|
214
|
+
|
|
215
|
+
### Submit a Workflow
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# POST a workflow (in API format) to the queue
|
|
219
|
+
curl -X POST http://comfyui:8188/prompt \
|
|
220
|
+
-H "Content-Type: application/json" \
|
|
221
|
+
-d '{"prompt": { /* workflow nodes */ }, "client_id": "my-client"}'
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Check Queue Status
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
curl http://comfyui:8188/queue
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Retrieve Output Files
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# List generated images
|
|
234
|
+
curl http://comfyui:8188/history
|
|
235
|
+
|
|
236
|
+
# Download a specific file by filename
|
|
237
|
+
curl -O http://comfyui:8188/view?filename=ComfyUI_00001_.png&type=output
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### WebSocket (real-time progress)
|
|
241
|
+
|
|
242
|
+
```python
|
|
243
|
+
import websocket, json
|
|
244
|
+
|
|
245
|
+
ws = websocket.WebSocket()
|
|
246
|
+
ws.connect("ws://comfyui:8188/ws?clientId=my-client")
|
|
247
|
+
while True:
|
|
248
|
+
message = json.loads(ws.recv())
|
|
249
|
+
print(message) # progress updates, execution events, etc.
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Configuration
|
|
253
|
+
|
|
254
|
+
### Environment Variables
|
|
255
|
+
|
|
256
|
+
Set these in `.devcontainer/.env` (copy from `.devcontainer/.env.example`):
|
|
257
|
+
|
|
258
|
+
| Variable | Default | Description |
|
|
259
|
+
| -------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
260
|
+
| `COMFYUI_MODELS_DIR` | `/opt/comfyui-models` | Path inside devcontainer where models are accessible (set in devcontainer.patch.json; do not change) |
|
|
261
|
+
| `COMFYUI_MODELS_HOST_PATH` | _(unset)_ | Host-side bind mount source; when unset the named volume `comfyui-models` is used |
|
|
262
|
+
| `COMFYUI_OUTPUT_PATH` | _(unset)_ | Host path for generated outputs; when unset the named volume `comfyui-output` is used |
|
|
263
|
+
| `COMFYUI_VERSION` | `latest-cuda` | Docker image tag (`latest-cuda`, `latest-cpu`, `latest-rocm`) |
|
|
264
|
+
| `COMFYUI_PORT` | `8188` | Host port for the web UI |
|
|
265
|
+
| `CLI_ARGS` | `--listen 0.0.0.0` | Extra CLI arguments passed to ComfyUI at startup |
|
|
266
|
+
|
|
267
|
+
### Example `.env`
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
# Option A (default) — named Docker volume, no host path needed:
|
|
271
|
+
# Leave COMFYUI_MODELS_HOST_PATH unset.
|
|
272
|
+
|
|
273
|
+
# Option B — bind mount to host directory:
|
|
274
|
+
# macOS/Linux:
|
|
275
|
+
# COMFYUI_MODELS_HOST_PATH=~/.cache/comfyui/models
|
|
276
|
+
# Windows (Docker Desktop):
|
|
277
|
+
# COMFYUI_MODELS_HOST_PATH=C:/Users/you/.cache/comfyui/models
|
|
278
|
+
|
|
279
|
+
# Where generated outputs are saved (named volume by default):
|
|
280
|
+
# COMFYUI_OUTPUT_PATH=~/.cache/comfyui/output
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Troubleshooting
|
|
284
|
+
|
|
285
|
+
### Missing Model Files
|
|
286
|
+
|
|
287
|
+
**Symptom:** ComfyUI loads but shows "model not found" errors when running a workflow.
|
|
288
|
+
|
|
289
|
+
**Solution:** Ensure model files exist in the correct subdirectory inside the shared models root:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
ls "${COMFYUI_MODELS_DIR}/checkpoints/" # Should list .safetensors files
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
If `COMFYUI_MODELS_HOST_PATH` is set, verify the host directory contains the expected subdirectories.
|
|
296
|
+
|
|
297
|
+
### CUDA / GPU Not Detected
|
|
298
|
+
|
|
299
|
+
**Symptom:** ComfyUI runs on CPU despite having an NVIDIA GPU.
|
|
300
|
+
|
|
301
|
+
**Solutions:**
|
|
302
|
+
|
|
303
|
+
1. Ensure the `deploy.resources.reservations.devices` block is present in the compose service (see [GPU Acceleration](#gpu-acceleration) above)
|
|
304
|
+
2. Verify NVIDIA Container Toolkit is installed on the host: `nvidia-smi`
|
|
305
|
+
3. Switch to `COMFYUI_VERSION=latest-cuda` if using a different tag
|
|
306
|
+
|
|
307
|
+
### Port 8188 Already in Use
|
|
308
|
+
|
|
309
|
+
**Symptom:** Container fails to start with "port already in use".
|
|
310
|
+
|
|
311
|
+
**Solution:** Change the host port in `.devcontainer/.env`:
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
COMFYUI_PORT=8288
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Then rebuild the container (`Dev Containers: Rebuild Container`).
|
|
318
|
+
|
|
319
|
+
### Container Starts but UI is Unreachable
|
|
320
|
+
|
|
321
|
+
**Symptom:** Browser shows "connection refused" on `http://localhost:8188`.
|
|
322
|
+
|
|
323
|
+
**Solutions:**
|
|
324
|
+
|
|
325
|
+
1. Check the container is running: `docker compose ps`
|
|
326
|
+
2. Check logs for startup errors: `docker compose logs comfyui`
|
|
327
|
+
3. Ensure `CLI_ARGS` includes `--listen 0.0.0.0` so ComfyUI accepts external connections
|
|
328
|
+
|
|
329
|
+
## References
|
|
330
|
+
|
|
331
|
+
- [ComfyUI GitHub Repository](https://github.com/comfyanonymous/ComfyUI)
|
|
332
|
+
- [ComfyUI API Documentation](https://github.com/comfyanonymous/ComfyUI/tree/master/script_examples)
|
|
333
|
+
- [ai-dock/comfyui Docker Image](https://github.com/ai-dock/comfyui)
|
|
334
|
+
- [ComfyUI Workflows Community](https://comfyworkflows.com/)
|
|
335
|
+
- [Civitai — Model Downloads](https://civitai.com/)
|
|
336
|
+
|
|
337
|
+
**Related Overlays:**
|
|
338
|
+
|
|
339
|
+
- [`cuda`](../cuda/README.md) — NVIDIA CUDA toolkit for GPU-accelerated workloads
|
|
340
|
+
- [`rocm`](../rocm/README.md) — AMD ROCm toolkit for GPU-accelerated workloads
|
|
341
|
+
- [`python`](../python/README.md) — Python runtime for automation scripts
|
|
342
|
+
- [`ollama`](../ollama/README.md) — Local LLM inference server
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.base.schema.json",
|
|
3
|
+
"runServices": ["comfyui"],
|
|
4
|
+
"forwardPorts": [8188],
|
|
5
|
+
"portsAttributes": {
|
|
6
|
+
"8188": {
|
|
7
|
+
"label": "ComfyUI",
|
|
8
|
+
"onAutoForward": "openBrowser"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"remoteEnv": {
|
|
12
|
+
"COMFYUI_URL": "http://comfyui:8188",
|
|
13
|
+
"COMFYUI_MODELS_DIR": "/opt/comfyui-models"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
version: '3.8'
|
|
2
|
+
|
|
3
|
+
services:
|
|
4
|
+
devcontainer:
|
|
5
|
+
volumes:
|
|
6
|
+
# Mount shared models root into devcontainer for direct filesystem access.
|
|
7
|
+
# When COMFYUI_MODELS_HOST_PATH is set this becomes a bind mount to that path;
|
|
8
|
+
# otherwise the named volume comfyui-models is used.
|
|
9
|
+
- ${COMFYUI_MODELS_HOST_PATH:-comfyui-models}:/opt/comfyui-models
|
|
10
|
+
|
|
11
|
+
comfyui:
|
|
12
|
+
image: ghcr.io/ai-dock/comfyui:${COMFYUI_VERSION:-latest-cuda}
|
|
13
|
+
restart: unless-stopped
|
|
14
|
+
volumes:
|
|
15
|
+
# Single root mount — ComfyUI discovers checkpoints/, loras/, etc. natively.
|
|
16
|
+
# Same source as the devcontainer mount above so both services share one copy.
|
|
17
|
+
- ${COMFYUI_MODELS_HOST_PATH:-comfyui-models}:/opt/ComfyUI/models
|
|
18
|
+
# Persist generated outputs (named volume by default, host path when COMFYUI_OUTPUT_PATH is set)
|
|
19
|
+
- ${COMFYUI_OUTPUT_PATH:-comfyui-output}:/opt/ComfyUI/output
|
|
20
|
+
environment:
|
|
21
|
+
- CLI_ARGS=${CLI_ARGS:---listen 0.0.0.0}
|
|
22
|
+
ports:
|
|
23
|
+
- '${COMFYUI_PORT:-8188}:8188'
|
|
24
|
+
deploy:
|
|
25
|
+
resources:
|
|
26
|
+
reservations:
|
|
27
|
+
devices:
|
|
28
|
+
- driver: nvidia
|
|
29
|
+
count: all
|
|
30
|
+
capabilities: [gpu]
|
|
31
|
+
networks:
|
|
32
|
+
- devnet
|
|
33
|
+
|
|
34
|
+
volumes:
|
|
35
|
+
comfyui-models:
|
|
36
|
+
comfyui-output:
|
|
37
|
+
|
|
38
|
+
networks:
|
|
39
|
+
devnet:
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
id: comfyui
|
|
2
|
+
name: ComfyUI
|
|
3
|
+
description: Node-based image/video generation UI for Stable Diffusion and generative AI workflows
|
|
4
|
+
category: dev
|
|
5
|
+
supports:
|
|
6
|
+
- compose
|
|
7
|
+
requires: []
|
|
8
|
+
suggests:
|
|
9
|
+
- cuda
|
|
10
|
+
- python
|
|
11
|
+
- ollama
|
|
12
|
+
conflicts: []
|
|
13
|
+
tags:
|
|
14
|
+
- dev
|
|
15
|
+
- ai
|
|
16
|
+
- image-generation
|
|
17
|
+
- stable-diffusion
|
|
18
|
+
- comfyui
|
|
19
|
+
ports:
|
|
20
|
+
- 8188
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# ComfyUI setup script — initializes the shared models directory
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
echo "🔧 Setting up ComfyUI..."
|
|
7
|
+
|
|
8
|
+
# Pre-create all expected model subdirectories inside the shared models root.
|
|
9
|
+
# Both the devcontainer and the ComfyUI sidecar mount this directory, so the
|
|
10
|
+
# subdirectories must exist before ComfyUI starts (it does not create them).
|
|
11
|
+
MODELS_DIR="${COMFYUI_MODELS_DIR:-/opt/comfyui-models}"
|
|
12
|
+
|
|
13
|
+
echo "📁 Initializing model subdirectories at ${MODELS_DIR}..."
|
|
14
|
+
|
|
15
|
+
# Ensure the root models directory exists and is writable by the current user.
|
|
16
|
+
if ! mkdir -p "${MODELS_DIR}" 2>/dev/null; then
|
|
17
|
+
# Likely a permission issue on a mounted volume; try with sudo if available.
|
|
18
|
+
if command -v sudo >/dev/null 2>&1; then
|
|
19
|
+
echo "⚠️ ${MODELS_DIR} is not writable, attempting to create it with sudo..."
|
|
20
|
+
sudo mkdir -p "${MODELS_DIR}"
|
|
21
|
+
sudo chown "$(id -u):$(id -g)" "${MODELS_DIR}"
|
|
22
|
+
else
|
|
23
|
+
echo "❌ Failed to create ${MODELS_DIR} (permission denied and sudo not available)." >&2
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
if [ ! -w "${MODELS_DIR}" ]; then
|
|
29
|
+
echo "❌ ${MODELS_DIR} is not writable by user $(id -un). Please adjust permissions and retry." >&2
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
for subdir in checkpoints loras controlnet clip_vision vae embeddings upscale_models; do
|
|
34
|
+
mkdir -p "${MODELS_DIR}/${subdir}"
|
|
35
|
+
done
|
|
36
|
+
echo "✓ ComfyUI model subdirectories initialized at ${MODELS_DIR}"
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Verification script for ComfyUI overlay
|
|
3
|
+
# Confirms the shared models directory is set up correctly and the ComfyUI service is accessible
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "🔍 Verifying ComfyUI overlay..."
|
|
8
|
+
echo ""
|
|
9
|
+
|
|
10
|
+
# Check shared models directory
|
|
11
|
+
echo "1️⃣ Checking shared models directory..."
|
|
12
|
+
MODELS_DIR="${COMFYUI_MODELS_DIR:-/opt/comfyui-models}"
|
|
13
|
+
|
|
14
|
+
if [ ! -d "${MODELS_DIR}" ]; then
|
|
15
|
+
echo " ❌ Models directory not found: ${MODELS_DIR}"
|
|
16
|
+
echo ""
|
|
17
|
+
echo "❌ ComfyUI overlay verification failed"
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
echo " ✅ Models directory exists: ${MODELS_DIR}"
|
|
21
|
+
|
|
22
|
+
if [ ! -w "${MODELS_DIR}" ]; then
|
|
23
|
+
echo " ❌ Models directory is not writable: ${MODELS_DIR}"
|
|
24
|
+
echo ""
|
|
25
|
+
echo "❌ ComfyUI overlay verification failed"
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
echo " ✅ Models directory is writable"
|
|
29
|
+
|
|
30
|
+
EXPECTED_SUBDIRS=(checkpoints loras controlnet clip_vision vae embeddings upscale_models)
|
|
31
|
+
MISSING_SUBDIRS=()
|
|
32
|
+
for subdir in "${EXPECTED_SUBDIRS[@]}"; do
|
|
33
|
+
if [ ! -d "${MODELS_DIR}/${subdir}" ]; then
|
|
34
|
+
MISSING_SUBDIRS+=("${subdir}")
|
|
35
|
+
fi
|
|
36
|
+
done
|
|
37
|
+
|
|
38
|
+
if [ ${#MISSING_SUBDIRS[@]} -gt 0 ]; then
|
|
39
|
+
echo " ❌ Missing model subdirectories: ${MISSING_SUBDIRS[*]}"
|
|
40
|
+
echo ""
|
|
41
|
+
echo "❌ ComfyUI overlay verification failed"
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
echo " ✅ All expected model subdirectories present"
|
|
45
|
+
|
|
46
|
+
# Check if curl is available
|
|
47
|
+
echo ""
|
|
48
|
+
echo "2️⃣ Checking curl availability..."
|
|
49
|
+
if ! command -v curl &> /dev/null; then
|
|
50
|
+
echo " ❌ curl not found"
|
|
51
|
+
echo ""
|
|
52
|
+
echo "❌ ComfyUI overlay verification failed (curl is required but not installed)"
|
|
53
|
+
exit 1
|
|
54
|
+
fi
|
|
55
|
+
echo " ✅ curl found"
|
|
56
|
+
|
|
57
|
+
# Check ComfyUI web UI
|
|
58
|
+
echo ""
|
|
59
|
+
echo "3️⃣ Checking ComfyUI service..."
|
|
60
|
+
COMFYUI_URL="${COMFYUI_URL:-http://comfyui:8188}"
|
|
61
|
+
COMFYUI_READY=false
|
|
62
|
+
|
|
63
|
+
set +e
|
|
64
|
+
for i in {1..30}; do
|
|
65
|
+
if curl -sf "${COMFYUI_URL}/" &> /dev/null; then
|
|
66
|
+
echo " ✅ ComfyUI service is ready"
|
|
67
|
+
COMFYUI_READY=true
|
|
68
|
+
break
|
|
69
|
+
fi
|
|
70
|
+
sleep 2
|
|
71
|
+
done
|
|
72
|
+
set -e
|
|
73
|
+
|
|
74
|
+
if [ "$COMFYUI_READY" = false ]; then
|
|
75
|
+
echo " ❌ ComfyUI service not ready after 60 seconds"
|
|
76
|
+
echo ""
|
|
77
|
+
echo " Tip: ComfyUI may take a while to start on first launch while it loads models."
|
|
78
|
+
echo " Check logs with: docker compose logs comfyui"
|
|
79
|
+
echo ""
|
|
80
|
+
echo "❌ ComfyUI overlay verification failed"
|
|
81
|
+
exit 1
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
# Check system stats endpoint
|
|
85
|
+
echo ""
|
|
86
|
+
echo "4️⃣ Checking ComfyUI system stats..."
|
|
87
|
+
set +e
|
|
88
|
+
STATS_JSON=$(curl -sf "${COMFYUI_URL}/system_stats")
|
|
89
|
+
CURL_STATUS=$?
|
|
90
|
+
set -e
|
|
91
|
+
|
|
92
|
+
if [ $CURL_STATUS -eq 0 ] && [ -n "$STATS_JSON" ]; then
|
|
93
|
+
echo " ✅ ComfyUI API is responding"
|
|
94
|
+
else
|
|
95
|
+
echo " ⚠️ Could not reach /system_stats endpoint (service may still be loading)"
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
echo ""
|
|
99
|
+
echo "✅ ComfyUI overlay verification complete"
|
|
100
|
+
echo " Models directory: ${MODELS_DIR}"
|
|
101
|
+
echo " Web UI: ${COMFYUI_URL}"
|
|
102
|
+
echo " API (example): ${COMFYUI_URL}/system_stats"
|
|
103
|
+
echo " Docs: https://github.com/comfyanonymous/ComfyUI"
|