Reorganize Runpod_Comfy into setup/image/core layout

This commit is contained in:
kflame99
2026-02-15 10:57:47 +00:00
parent 91a6abb178
commit b1296c2c6c
21 changed files with 95 additions and 89 deletions
+6 -3
View File
@@ -25,7 +25,10 @@
- Repo files (`TODO/WORKLOG/DECISIONS/WORKFLOW`) are continuity anchor across devices.
## 2026-02-15 — Recipe architecture for long-term readability
- Rename `profiles/` concept to `admin_recipes/` for clearer ownership/intent.
- Keep one recipe folder per image variant (`upscaler-v1`, `wan22-v1`, etc.).
- Use a 3-zone layout inside `Runpod_Comfy/`:
- `setup/` (operator-facing edits/docs/tools)
- `image/` (generated outputs + active locks)
- `core/` (runtime internals)
- Keep one recipe folder per image variant under `setup/recipes/<id>/`.
- Compiler supports explicit args (`--id`, `--out`, `--image-tag`, `--no-activate`).
- Generated artifacts are stored under `builds/<recipe-id>/` and can be activated to `config/`.
- Default outputs go to `image/builds/<recipe-id>/` and can be activated to `image/active/`.
+6 -65
View File
@@ -1,69 +1,10 @@
# Runpod_Comfy
Production-oriented scaffold for running ComfyUI on RunPod with pinned versions.
This module is organized in three top-level folders:
## Structure
- `setup/` → operator-facing inputs/docs/tools
- `image/` → generated build artifacts and active lock set
- `core/` → runtime internals (docker/scripts)
- `base/` → stable scaffold area (reserved for core runtime layout)
- `admin_recipes/` → **your editable inputs** (one recipe per image variant)
- `builds/` → generated lock outputs per recipe
- `config/` → active lock set consumed by runtime scripts
- `docker/` → image/runtime entrypoint
- `scripts/` → bootstrap installers
- `tools/` → recipe helpers (`new_profile.sh`, `compile_profile.sh`)
## Quick Start
### 1) Create a recipe
```bash
Runpod_Comfy/tools/new_profile.sh upscaler-v1
```
This creates:
- `admin_recipes/upscaler-v1/runpod.yaml`
- `admin_recipes/upscaler-v1/nodes.yaml`
- `admin_recipes/upscaler-v1/models.yaml`
- `admin_recipes/upscaler-v1/urls.txt` (optional helper)
### 2) Compile recipe
```bash
Runpod_Comfy/tools/compile_profile.sh --id upscaler-v1
```
Generated outputs:
- `builds/upscaler-v1/comfyui.lock`
- `builds/upscaler-v1/custom_nodes.lock.json`
- `builds/upscaler-v1/models.json`
By default, compile also **activates** this recipe by copying outputs to `config/`.
### 3) Build image
```bash
BASE_IMAGE=$(grep '^BASE_IMAGE=' Runpod_Comfy/config/comfyui.lock | cut -d= -f2-)
IMAGE_TAG=$(grep '^RUNPOD_IMAGE_TAG=' Runpod_Comfy/config/comfyui.lock | cut -d= -f2-)
docker build --build-arg BASE_IMAGE="$BASE_IMAGE" \
-t comfyui-koolook:${IMAGE_TAG} -f Runpod_Comfy/docker/Dockerfile .
```
### 4) Iterate safely
- Minor tweaks: keep same recipe folder, bump `image_tag` in `runpod.yaml`.
- Major changes: clone recipe to new id (`upscaler-v2`, `wan22-v1`).
- You can compile without activation using `--no-activate`.
## Compiler arguments
```bash
Runpod_Comfy/tools/compile_profile.sh --id <recipe-id> [--out <dir>] [--image-tag <tag>] [--no-activate]
```
Backward compatible:
```bash
Runpod_Comfy/tools/compile_profile.sh <recipe-id>
```
Start here:
- `Runpod_Comfy/setup/USER_README.md`
@@ -16,8 +16,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY Runpod_Comfy /opt/bootstrap/Runpod_Comfy
RUN chmod +x /opt/bootstrap/Runpod_Comfy/scripts/*.sh /opt/bootstrap/Runpod_Comfy/docker/start.sh
RUN chmod +x /opt/bootstrap/Runpod_Comfy/core/scripts/*.sh /opt/bootstrap/Runpod_Comfy/core/docker/start.sh
EXPOSE 8188
ENTRYPOINT ["/opt/bootstrap/Runpod_Comfy/docker/start.sh"]
ENTRYPOINT ["/opt/bootstrap/Runpod_Comfy/core/docker/start.sh"]
+1 -1
View File
@@ -5,7 +5,7 @@ ROOT=/opt/bootstrap/Runpod_Comfy
WORKDIR="${COMFYUI_WORKDIR:-/workspace/ComfyUI}"
PORT="${COMFYUI_PORT:-8188}"
"$ROOT/scripts/bootstrap.sh"
"$ROOT/core/scripts/bootstrap.sh"
cd "$WORKDIR"
+3 -3
View File
@@ -5,7 +5,7 @@ ROOT=/opt/bootstrap/Runpod_Comfy
WORKDIR="${COMFYUI_WORKDIR:-/workspace/ComfyUI}"
mkdir -p "$WORKDIR"
source "$ROOT/config/comfyui.lock"
source "$ROOT/image/active/comfyui.lock"
if [[ ! -f "$WORKDIR/main.py" ]]; then
echo "[bootstrap] Cloning ComfyUI from $COMFYUI_REPO"
@@ -21,7 +21,7 @@ git checkout "$COMFYUI_REF"
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
"$ROOT/scripts/install_custom_nodes.sh"
"$ROOT/scripts/download_models.sh"
"$ROOT/core/scripts/install_custom_nodes.sh"
"$ROOT/core/scripts/download_models.sh"
echo "[bootstrap] done"
@@ -3,7 +3,7 @@ set -euo pipefail
ROOT=/opt/bootstrap/Runpod_Comfy
WORKDIR="${COMFYUI_WORKDIR:-/workspace/ComfyUI}"
LOCK="$ROOT/config/models.json"
LOCK="$ROOT/image/active/models.json"
if [[ ! -f "$LOCK" ]]; then
echo "[models] lock file not found: $LOCK"
@@ -4,7 +4,7 @@ set -euo pipefail
ROOT=/opt/bootstrap/Runpod_Comfy
WORKDIR="${COMFYUI_WORKDIR:-/workspace/ComfyUI}"
NODES_DIR="$WORKDIR/custom_nodes"
LOCK="$ROOT/config/custom_nodes.lock.json"
LOCK="$ROOT/image/active/custom_nodes.lock.json"
mkdir -p "$NODES_DIR"
@@ -1,4 +1,4 @@
# Generated by Runpod_Comfy/tools/compile_profile.sh
# Generated by Runpod_Comfy/setup/tools/compile_profile.sh
PROFILE_ID=example
BASE_IMAGE=runpod/pytorch:2.6.0-py3.11-cuda12.4.1-devel-ubuntu22.04
COMFYUI_REPO=https://github.com/comfyanonymous/ComfyUI.git
+62
View File
@@ -0,0 +1,62 @@
# Runpod_Comfy Setup Guide
This package is split into 3 readable zones:
- `setup/` → what you edit (recipes, docs, helper tools)
- `image/` → generated outputs (build artifacts + active locks)
- `core/` → runtime internals (Docker + bootstrap scripts)
## Quick Start
### 1) Create a recipe
```bash
Runpod_Comfy/setup/tools/new_profile.sh upscaler-v1
```
Creates:
- `Runpod_Comfy/setup/recipes/upscaler-v1/runpod.yaml`
- `Runpod_Comfy/setup/recipes/upscaler-v1/nodes.yaml`
- `Runpod_Comfy/setup/recipes/upscaler-v1/models.yaml`
- `Runpod_Comfy/setup/recipes/upscaler-v1/urls.txt`
### 2) Compile recipe
```bash
Runpod_Comfy/setup/tools/compile_profile.sh --id upscaler-v1
```
Generates into:
- `Runpod_Comfy/image/builds/upscaler-v1/comfyui.lock`
- `Runpod_Comfy/image/builds/upscaler-v1/custom_nodes.lock.json`
- `Runpod_Comfy/image/builds/upscaler-v1/models.json`
By default compile also **activates** to:
- `Runpod_Comfy/image/active/comfyui.lock`
- `Runpod_Comfy/image/active/custom_nodes.lock.json`
- `Runpod_Comfy/image/active/models.json`
### 3) Build image
```bash
BASE_IMAGE=$(grep '^BASE_IMAGE=' Runpod_Comfy/image/active/comfyui.lock | cut -d= -f2-)
IMAGE_TAG=$(grep '^RUNPOD_IMAGE_TAG=' Runpod_Comfy/image/active/comfyui.lock | cut -d= -f2-)
docker build --build-arg BASE_IMAGE="$BASE_IMAGE" \
-t comfyui-koolook:${IMAGE_TAG} -f Runpod_Comfy/core/docker/Dockerfile .
```
## Iterate safely
- Minor tweaks: keep same recipe id, bump `image_tag` in `runpod.yaml`
- Major changes: clone to new id (`upscaler-v2`, `wan22-v1`)
- Optional no-activate compile:
```bash
Runpod_Comfy/setup/tools/compile_profile.sh --id upscaler-v1 --no-activate
```
## Compiler args
```bash
Runpod_Comfy/setup/tools/compile_profile.sh --id <recipe-id> [--out <dir>] [--image-tag <tag>] [--no-activate]
```
@@ -7,7 +7,7 @@ Use GitHub Container Registry or Docker Hub.
Example (GHCR):
```bash
docker build -t ghcr.io/malkuthro/comfyui-koolook:runpod-v1 -f Runpod_Comfy/docker/Dockerfile .
docker build -t ghcr.io/malkuthro/comfyui-koolook:runpod-v1 -f Runpod_Comfy/core/docker/Dockerfile .
docker push ghcr.io/malkuthro/comfyui-koolook:runpod-v1
```
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
RECIPE_ID=""
RECIPES_DIR="$ROOT/admin_recipes"
RECIPES_DIR="$ROOT/setup/recipes"
OUT_DIR=""
ACTIVATE=true
IMAGE_TAG_OVERRIDE=""
@@ -15,9 +15,9 @@ Usage:
$0 <recipe-id> # backward-compatible
Defaults:
recipes-dir: Runpod_Comfy/admin_recipes
out: Runpod_Comfy/builds/<recipe-id>
activate: true (copies generated files to Runpod_Comfy/config)
recipes-dir: Runpod_Comfy/setup/recipes
out: Runpod_Comfy/image/builds/<recipe-id>
activate: true (copies generated files to Runpod_Comfy/image/active)
EOF
}
@@ -38,14 +38,14 @@ else
fi
[[ -z "$RECIPE_ID" ]] && { usage; exit 1; }
[[ -z "$OUT_DIR" ]] && OUT_DIR="$ROOT/builds/$RECIPE_ID"
[[ -z "$OUT_DIR" ]] && OUT_DIR="$ROOT/image/builds/$RECIPE_ID"
RECIPE_DIR="$RECIPES_DIR/$RECIPE_ID"
RUNPOD_PROFILE="$RECIPE_DIR/runpod.yaml"
NODES_PROFILE="$RECIPE_DIR/nodes.yaml"
MODELS_PROFILE="$RECIPE_DIR/models.yaml"
URLS_FILE="$RECIPE_DIR/urls.txt"
CONFIG_DIR="$ROOT/config"
CONFIG_DIR="$ROOT/image/active"
for f in "$RUNPOD_PROFILE" "$NODES_PROFILE" "$MODELS_PROFILE"; do
[[ -f "$f" ]] || { echo "Missing: $f"; exit 1; }
@@ -130,7 +130,7 @@ for m in models:
models.extend(url_models)
comfy_lock='\n'.join([
'# Generated by Runpod_Comfy/tools/compile_profile.sh',
'# Generated by Runpod_Comfy/setup/tools/compile_profile.sh',
f'RECIPE_ID={recipe_id}',
f'BASE_IMAGE={base_image}',
f'IMAGE_NAME={image_name}',
@@ -8,8 +8,8 @@ if [[ $# -lt 1 ]]; then
fi
ID="$1"
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
RECIPES="$ROOT/admin_recipes"
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
RECIPES="$ROOT/setup/recipes"
EXAMPLES="$RECIPES/examples"
TARGET="$RECIPES/$ID"
@@ -39,4 +39,4 @@ fi
echo
echo "Next:"
echo " 1) edit $TARGET/{runpod.yaml,nodes.yaml,models.yaml,urls.txt}"
echo " 2) Runpod_Comfy/tools/compile_profile.sh --id $ID"
echo " 2) Runpod_Comfy/setup/tools/compile_profile.sh --id $ID"