From 473cfdc93a66b7c52c5bc3a980fe2ebd3eed2f23 Mon Sep 17 00:00:00 2001 From: kflame99 <261674183+kflame99@users.noreply.github.com> Date: Sun, 15 Feb 2026 10:57:47 +0000 Subject: [PATCH] Reorganize Runpod_Comfy into setup/image/core layout --- DECISIONS.md | 9 ++- Runpod_Comfy/README.md | 71 ++----------------- Runpod_Comfy/{ => core}/docker/Dockerfile | 4 +- Runpod_Comfy/{ => core}/docker/start.sh | 2 +- Runpod_Comfy/{ => core}/scripts/bootstrap.sh | 6 +- .../{ => core}/scripts/download_models.sh | 2 +- .../scripts/install_custom_nodes.sh | 2 +- .../{config => image/active}/comfyui.lock | 2 +- .../active}/custom_nodes.lock.json | 0 .../{config => image/active}/models.json | 0 Runpod_Comfy/{ => image}/builds/.gitkeep | 0 Runpod_Comfy/setup/USER_README.md | 62 ++++++++++++++++ .../{ => setup}/docs/DEPLOY_RUNPOD.md | 2 +- .../features/runpod_Container_REQUIRMENTS.md | 0 .../references/github-repos_andOr_LINKS.md | 0 .../recipes}/examples/models.example.yaml | 0 .../recipes}/examples/nodes.example.yaml | 0 .../recipes}/examples/runpod.example.yaml | 0 .../recipes}/examples/urls.example.txt | 0 .../{ => setup}/tools/compile_profile.sh | 16 ++--- Runpod_Comfy/{ => setup}/tools/new_profile.sh | 6 +- 21 files changed, 95 insertions(+), 89 deletions(-) rename Runpod_Comfy/{ => core}/docker/Dockerfile (74%) rename Runpod_Comfy/{ => core}/docker/start.sh (86%) mode change 100644 => 100755 rename Runpod_Comfy/{ => core}/scripts/bootstrap.sh (80%) mode change 100644 => 100755 rename Runpod_Comfy/{ => core}/scripts/download_models.sh (95%) mode change 100644 => 100755 rename Runpod_Comfy/{ => core}/scripts/install_custom_nodes.sh (94%) mode change 100644 => 100755 rename Runpod_Comfy/{config => image/active}/comfyui.lock (73%) rename Runpod_Comfy/{config => image/active}/custom_nodes.lock.json (100%) rename Runpod_Comfy/{config => image/active}/models.json (100%) rename Runpod_Comfy/{ => image}/builds/.gitkeep (100%) create mode 100644 Runpod_Comfy/setup/USER_README.md rename Runpod_Comfy/{ => setup}/docs/DEPLOY_RUNPOD.md (95%) rename Runpod_Comfy/{ => setup}/docs/features/runpod_Container_REQUIRMENTS.md (100%) rename Runpod_Comfy/{ => setup}/docs/references/github-repos_andOr_LINKS.md (100%) rename Runpod_Comfy/{admin_recipes => setup/recipes}/examples/models.example.yaml (100%) rename Runpod_Comfy/{admin_recipes => setup/recipes}/examples/nodes.example.yaml (100%) rename Runpod_Comfy/{admin_recipes => setup/recipes}/examples/runpod.example.yaml (100%) rename Runpod_Comfy/{admin_recipes => setup/recipes}/examples/urls.example.txt (100%) rename Runpod_Comfy/{ => setup}/tools/compile_profile.sh (93%) rename Runpod_Comfy/{ => setup}/tools/new_profile.sh (83%) diff --git a/DECISIONS.md b/DECISIONS.md index b4be2e9..0dc98d4 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -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//`. - Compiler supports explicit args (`--id`, `--out`, `--image-tag`, `--no-activate`). -- Generated artifacts are stored under `builds//` and can be activated to `config/`. +- Default outputs go to `image/builds//` and can be activated to `image/active/`. diff --git a/Runpod_Comfy/README.md b/Runpod_Comfy/README.md index c2c1fc6..9cb89f6 100644 --- a/Runpod_Comfy/README.md +++ b/Runpod_Comfy/README.md @@ -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 [--out ] [--image-tag ] [--no-activate] -``` - -Backward compatible: - -```bash -Runpod_Comfy/tools/compile_profile.sh -``` +Start here: +- `Runpod_Comfy/setup/USER_README.md` diff --git a/Runpod_Comfy/docker/Dockerfile b/Runpod_Comfy/core/docker/Dockerfile similarity index 74% rename from Runpod_Comfy/docker/Dockerfile rename to Runpod_Comfy/core/docker/Dockerfile index 558b32c..03fc462 100644 --- a/Runpod_Comfy/docker/Dockerfile +++ b/Runpod_Comfy/core/docker/Dockerfile @@ -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"] diff --git a/Runpod_Comfy/docker/start.sh b/Runpod_Comfy/core/docker/start.sh old mode 100644 new mode 100755 similarity index 86% rename from Runpod_Comfy/docker/start.sh rename to Runpod_Comfy/core/docker/start.sh index c6eaa0b..959e81f --- a/Runpod_Comfy/docker/start.sh +++ b/Runpod_Comfy/core/docker/start.sh @@ -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" diff --git a/Runpod_Comfy/scripts/bootstrap.sh b/Runpod_Comfy/core/scripts/bootstrap.sh old mode 100644 new mode 100755 similarity index 80% rename from Runpod_Comfy/scripts/bootstrap.sh rename to Runpod_Comfy/core/scripts/bootstrap.sh index 8de63a9..0f1049e --- a/Runpod_Comfy/scripts/bootstrap.sh +++ b/Runpod_Comfy/core/scripts/bootstrap.sh @@ -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" diff --git a/Runpod_Comfy/scripts/download_models.sh b/Runpod_Comfy/core/scripts/download_models.sh old mode 100644 new mode 100755 similarity index 95% rename from Runpod_Comfy/scripts/download_models.sh rename to Runpod_Comfy/core/scripts/download_models.sh index b1fcc4d..a0f382c --- a/Runpod_Comfy/scripts/download_models.sh +++ b/Runpod_Comfy/core/scripts/download_models.sh @@ -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" diff --git a/Runpod_Comfy/scripts/install_custom_nodes.sh b/Runpod_Comfy/core/scripts/install_custom_nodes.sh old mode 100644 new mode 100755 similarity index 94% rename from Runpod_Comfy/scripts/install_custom_nodes.sh rename to Runpod_Comfy/core/scripts/install_custom_nodes.sh index b3a6fa2..2035762 --- a/Runpod_Comfy/scripts/install_custom_nodes.sh +++ b/Runpod_Comfy/core/scripts/install_custom_nodes.sh @@ -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" diff --git a/Runpod_Comfy/config/comfyui.lock b/Runpod_Comfy/image/active/comfyui.lock similarity index 73% rename from Runpod_Comfy/config/comfyui.lock rename to Runpod_Comfy/image/active/comfyui.lock index 9899970..f493005 100644 --- a/Runpod_Comfy/config/comfyui.lock +++ b/Runpod_Comfy/image/active/comfyui.lock @@ -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 diff --git a/Runpod_Comfy/config/custom_nodes.lock.json b/Runpod_Comfy/image/active/custom_nodes.lock.json similarity index 100% rename from Runpod_Comfy/config/custom_nodes.lock.json rename to Runpod_Comfy/image/active/custom_nodes.lock.json diff --git a/Runpod_Comfy/config/models.json b/Runpod_Comfy/image/active/models.json similarity index 100% rename from Runpod_Comfy/config/models.json rename to Runpod_Comfy/image/active/models.json diff --git a/Runpod_Comfy/builds/.gitkeep b/Runpod_Comfy/image/builds/.gitkeep similarity index 100% rename from Runpod_Comfy/builds/.gitkeep rename to Runpod_Comfy/image/builds/.gitkeep diff --git a/Runpod_Comfy/setup/USER_README.md b/Runpod_Comfy/setup/USER_README.md new file mode 100644 index 0000000..24c9d79 --- /dev/null +++ b/Runpod_Comfy/setup/USER_README.md @@ -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 [--out ] [--image-tag ] [--no-activate] +``` diff --git a/Runpod_Comfy/docs/DEPLOY_RUNPOD.md b/Runpod_Comfy/setup/docs/DEPLOY_RUNPOD.md similarity index 95% rename from Runpod_Comfy/docs/DEPLOY_RUNPOD.md rename to Runpod_Comfy/setup/docs/DEPLOY_RUNPOD.md index 1d56fc1..c4376ef 100644 --- a/Runpod_Comfy/docs/DEPLOY_RUNPOD.md +++ b/Runpod_Comfy/setup/docs/DEPLOY_RUNPOD.md @@ -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 ``` diff --git a/Runpod_Comfy/docs/features/runpod_Container_REQUIRMENTS.md b/Runpod_Comfy/setup/docs/features/runpod_Container_REQUIRMENTS.md similarity index 100% rename from Runpod_Comfy/docs/features/runpod_Container_REQUIRMENTS.md rename to Runpod_Comfy/setup/docs/features/runpod_Container_REQUIRMENTS.md diff --git a/Runpod_Comfy/docs/references/github-repos_andOr_LINKS.md b/Runpod_Comfy/setup/docs/references/github-repos_andOr_LINKS.md similarity index 100% rename from Runpod_Comfy/docs/references/github-repos_andOr_LINKS.md rename to Runpod_Comfy/setup/docs/references/github-repos_andOr_LINKS.md diff --git a/Runpod_Comfy/admin_recipes/examples/models.example.yaml b/Runpod_Comfy/setup/recipes/examples/models.example.yaml similarity index 100% rename from Runpod_Comfy/admin_recipes/examples/models.example.yaml rename to Runpod_Comfy/setup/recipes/examples/models.example.yaml diff --git a/Runpod_Comfy/admin_recipes/examples/nodes.example.yaml b/Runpod_Comfy/setup/recipes/examples/nodes.example.yaml similarity index 100% rename from Runpod_Comfy/admin_recipes/examples/nodes.example.yaml rename to Runpod_Comfy/setup/recipes/examples/nodes.example.yaml diff --git a/Runpod_Comfy/admin_recipes/examples/runpod.example.yaml b/Runpod_Comfy/setup/recipes/examples/runpod.example.yaml similarity index 100% rename from Runpod_Comfy/admin_recipes/examples/runpod.example.yaml rename to Runpod_Comfy/setup/recipes/examples/runpod.example.yaml diff --git a/Runpod_Comfy/admin_recipes/examples/urls.example.txt b/Runpod_Comfy/setup/recipes/examples/urls.example.txt similarity index 100% rename from Runpod_Comfy/admin_recipes/examples/urls.example.txt rename to Runpod_Comfy/setup/recipes/examples/urls.example.txt diff --git a/Runpod_Comfy/tools/compile_profile.sh b/Runpod_Comfy/setup/tools/compile_profile.sh similarity index 93% rename from Runpod_Comfy/tools/compile_profile.sh rename to Runpod_Comfy/setup/tools/compile_profile.sh index 43cfdef..93ed578 100755 --- a/Runpod_Comfy/tools/compile_profile.sh +++ b/Runpod_Comfy/setup/tools/compile_profile.sh @@ -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 # backward-compatible Defaults: - recipes-dir: Runpod_Comfy/admin_recipes - out: Runpod_Comfy/builds/ - activate: true (copies generated files to Runpod_Comfy/config) + recipes-dir: Runpod_Comfy/setup/recipes + out: Runpod_Comfy/image/builds/ + 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}', diff --git a/Runpod_Comfy/tools/new_profile.sh b/Runpod_Comfy/setup/tools/new_profile.sh similarity index 83% rename from Runpod_Comfy/tools/new_profile.sh rename to Runpod_Comfy/setup/tools/new_profile.sh index 0d6337e..17eb1a7 100755 --- a/Runpod_Comfy/tools/new_profile.sh +++ b/Runpod_Comfy/setup/tools/new_profile.sh @@ -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"