File size: 8,563 Bytes
ea12399 aa41821 ea12399 aa41821 ea12399 aa41821 ea12399 ce5f943 97a2226 ce5f943 97a2226 ce5f943 97a2226 ea12399 aa41821 ea12399 aa41821 ea12399 a748f63 ea12399 9888be9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | #!/usr/bin/env bash
# ํ์์ ์คํํ๋ค. tools/pod_bootstrap.py script ๊ฐ ๋ง๋ ๋ค.
set -euo pipefail
COMFY_ROOT="${COMFY_ROOT:-}"
STAGE="$(mktemp -d)"
trap 'rm -rf "$STAGE"' EXIT
# ComfyUI ๋ณธ์ฒด ๊ฒฝ๋ก๋ ์ด๋ฏธ์ง๋ง๋ค ๋ค๋ฅด๋ค(runpod/comfyui ๋ /workspace/runpod-slim/ComfyUI).
if [ -z "$COMFY_ROOT" ]; then
for candidate in /workspace/ComfyUI /workspace/runpod-slim/ComfyUI /ComfyUI /root/ComfyUI /app/ComfyUI; do
if [ -f "$candidate/main.py" ]; then COMFY_ROOT="$candidate"; break; fi
done
fi
if [ ! -f "$COMFY_ROOT/main.py" ]; then
echo "ComfyUI ๋ณธ์ฒด๋ฅผ ์ฐพ์ง ๋ชปํ์ต๋๋ค. COMFY_ROOT=/์ค์ /๊ฒฝ๋ก ๋ก ์ง์ ํด ๋ค์ ์คํํ์ธ์." >&2
exit 1
fi
echo "ComfyUI: $COMFY_ROOT"
# ComfyUI ๊ฐ ์ฐ๋ ์ธํฐํ๋ฆฌํฐ(์ด๋ฏธ์ง์ ์ ์ฉ venv ๊ฐ ์๋ค).
# glob ์ ls ๋ก ํ๋ฉด ๋งค์น๊ฐ ์์ ๋ exit 2 ๊ฐ ๋๊ณ , pipefail ๋๋ฌธ์ ์กฐ์ฉํ ์ฃฝ๋๋ค.
PY=""
for candidate in "$COMFY_ROOT"/.venv*/bin/python; do
if [ -x "$candidate" ]; then PY="$candidate"; break; fi
done
if [ -z "$PY" ]; then PY="$(command -v python3 || command -v python || true)"; fi
# hf CLI ๋ ์ด๋ฏธ์ง์ ์์ ์ ์๋ค. ์์ผ๋ฉด ๊ฐ์ ์ธํฐํ๋ฆฌํฐ์ huggingface_hub ๋ก ๋ฐ๋๋ค.
HF="${HF:-}"
for candidate in "$COMFY_ROOT"/.venv*/bin/hf; do
if [ -x "$candidate" ]; then HF="$candidate"; break; fi
done
if [ -z "$HF" ]; then HF="$(command -v hf || true)"; fi
if [ -z "$HF" ]; then echo "hf CLI ๊ฐ ์์ด ํ์ด์ฌ API๋ก ๋ด๋ ค๋ฐ์ต๋๋ค." >&2; fi
fetch() {
local repo="$1" name="$2" dest="$3"
if [ -n "$HF" ]; then
"$HF" download "$repo" "$name" --local-dir "$dest" >/dev/null
else
"$PY" -c 'import sys;from huggingface_hub import hf_hub_download;hf_hub_download(sys.argv[1],sys.argv[2],local_dir=sys.argv[3])' "$repo" "$name" "$dest" >/dev/null
fi
}
# ๋ชจ๋ธ: ๊ณต๊ฐ ์ ์ฅ์๋ผ ํ ํฐ์ด ํ์ ์๋ค. ๋ฐ์ ๋ค ์ด๋ฆ์ผ๋ก ์ฐพ์ ์ ์๋ฆฌ์ ์ฎ๊ธด๋ค.
pull() {
local repo="$1" name="$2" target="$3" src
fetch "$repo" "$name" "$STAGE/$repo"
src="$(find "$STAGE/$repo" -name "$name" -print -quit || true)"
if [ -z "$src" ]; then echo "HF์ ์์: $repo/$name" >&2; return 1; fi
install -D -m 644 "$src" "$COMFY_ROOT/models/$target"
# ๋น ํ์ผ์ด๋ฉด ์คํจ๋ก ๋๋ธ๋ค - ํ์ผ๋ช
๋ง ๋ณด๋ ์ ๊ฒ์ ์ด๊ฑธ ๋ชป ์ก๋๋ค(์ค์ ๋ก ๋ชป ์ก์๋ค).
if [ ! -s "$COMFY_ROOT/models/$target" ]; then
echo "๋ด๋ ค๋ฐ๊ธฐ ์คํจ(๋น ํ์ผ): $target" >&2; return 1
fi
# ํ์ ํด๋ ๋ชจ๋ธ์ ์ญ์ฌ๋์ ์ด๋ฆ ์ฌ๋ณผ๋ฆญ ๋งํฌ๋ ๋ง๋ ๋ค. ComfyUI ๋ ํด๋ ๋ชฉ๋ก์
# os.sep ๋ก ๋ง๋ค๊ธฐ ๋๋ฌธ์(folder_paths.py) ์๋์ฐ์์ ์ ์ฅ๋ ์ํฌํ๋ก์
# 'bodyparts\x' ๊ฐ์ด ๋ฆฌ๋
์ค ํ์์๋ ์ด๋ค ์ฝค๋ณด์๋ ์ ๋ง๋๋ค. ๋งํฌ๋ฅผ ๋ง๋ค์ด
# ์๋ณธ ์ํฌํ๋ก๋ฅผ ๊ณ ์น์ง ์๊ณ ๋ ์์ชฝ์์ ๊ฐ์ ๊ฐ์ด ๋งค์นญ๋๊ฒ ํ๋ค.
# ํ์ ํด๋๊ฐ ์๋ ๊ฒฝ์ฐ์๋ง ๋ณ์นญ์ ๋ง๋ ๋ค(*/* ๋ก ๋๋ฉด unet/x.gguf ์ฒ๋ผ
# ํด๋ ๋ฐ๋ก ์๋ ํ์ผ๋ ๋งค์น๋์ด ์ ์๋ฆฌ๋ฅผ ๊ฐ๋ฆฌํค๋ ๋งํฌ๋ก ์ค์ ํ์ผ์ ์ง์ด๋ค).
case "$target" in
*/*/*)
local root="${target%%/*}" rest="${target#*/}" win
win="$(printf %s "$rest" | tr "/" "\\")"
ln -sf "$rest" "$COMFY_ROOT/models/$root/$win"
;;
esac
}
mkdir -p "$COMFY_ROOT/models/unet" "$COMFY_ROOT/models/vae" \
"$COMFY_ROOT/models/text_encoders" "$COMFY_ROOT/models/loras" \
"$COMFY_ROOT/custom_nodes"
pull bjooo/wan2.2_loras "SVI_v2_PRO_Wan2.2-I2V-A14B_HIGH_lora_rank_128_fp16.safetensors" "loras/SVI_v2_PRO_Wan2.2-I2V-A14B_HIGH_lora_rank_128_fp16.safetensors"
pull bjooo/wan2.2_loras "SVI_v2_PRO_Wan2.2-I2V-A14B_LOW_lora_rank_128_fp16.safetensors" "loras/SVI_v2_PRO_Wan2.2-I2V-A14B_LOW_lora_rank_128_fp16.safetensors"
pull bjooo/wan2.2_loras "Wan2.1_I2V_14B_FusionX_LoRA.safetensors" "loras/Wan2.1_I2V_14B_FusionX_LoRA.safetensors"
pull bjooo/wan2.2_loras "Wan_2_2_I2V_A14B_HIGH_lightx2v_4step_lora_v1030_rank_64_bf16.safetensors" "loras/Wan_2_2_I2V_A14B_HIGH_lightx2v_4step_lora_v1030_rank_64_bf16.safetensors"
pull bjooo/wan2.2_loras "Wan_2_2_I2V_A14B_LOW_lightx2v_4step_lora_260412_rank_256_fp16.safetensors" "loras/Wan_2_2_I2V_A14B_LOW_lightx2v_4step_lora_260412_rank_256_fp16.safetensors"
pull bjooo/wan2.2_loras "2.2-I2V Reveal Penis_000003000_high_noise.safetensors" "loras/bodyparts/2.2-I2V Reveal Penis_000003000_high_noise.safetensors"
pull bjooo/wan2.2_loras "2.2-I2V Reveal Penis_000003000_low_noise.safetensors" "loras/bodyparts/2.2-I2V Reveal Penis_000003000_low_noise.safetensors"
pull bjooo/wan2.2_loras "PENISLORA_22_i2v_HIGH_e320.safetensors" "loras/bodyparts/PENISLORA_22_i2v_HIGH_e320.safetensors"
pull bjooo/wan2.2_loras "PENISLORA_22_i2v_LOW_e496.safetensors" "loras/bodyparts/PENISLORA_22_i2v_LOW_e496.safetensors"
pull bjooo/wan2.2_loras "erect_penis_epoch_80.safetensors" "loras/bodyparts/erect_penis_epoch_80.safetensors"
pull bjooo/wan2.2_loras "masturbation_cumshot_v1.1_e310.safetensors" "loras/masturbation/masturbation_cumshot_v1.1_e310.safetensors"
pull bjooo/clips "nsfw_wan_umt5-xxl_fp8_scaled.safetensors" "text_encoders/nsfw_wan_umt5-xxl_fp8_scaled.safetensors"
pull bjooo/unet "Wan2.2-I2V-A14B-HighNoise-Q8_0.gguf" "unet/Wan2.2-I2V-A14B-HighNoise-Q8_0.gguf"
pull bjooo/unet "Wan2.2-I2V-A14B-LowNoise-Q8_0.gguf" "unet/Wan2.2-I2V-A14B-LowNoise-Q8_0.gguf"
pull bjooo/clips "Wan2_1_VAE_bf16.safetensors" "vae/Wan2_1_VAE_bf16.safetensors"
# ์ด๋ฏธ์ง์ ๊ฐ์ ๊ณ์ด ํฉ์ด ๋ค์ด ์์ผ๋ฉด custom_nodes ๋ฐ์ผ๋ก ์ฎ๊ธด๋ค. ๋ฆฌ๋
์ค๋
# ๋์๋ฌธ์๋ฅผ ๊ตฌ๋ถํ๋ฏ๋ก ComfyUI-KJNodes ์ ์ฐ๋ฆฌ comfyui-kjnodes ๊ฐ ๊ณต์กดํ๋ฉด
# ๊ฐ์ ํด๋์ค๊ฐ ๋ ๋ฒ ๋ฑ๋ก๋๋ค. (.disabled ์ ๋ฏธ์ฌ๋ ComfyUI ๊ฐ ๋ฌด์ํ๋ค๋ ๋ณด์ฅ์ด ์ฝํ๋ค)
mkdir -p "$COMFY_ROOT/.parked_nodes"
for collide in ComfyUI-KJNodes; do
if [ -d "$COMFY_ROOT/custom_nodes/$collide" ]; then
mv "$COMFY_ROOT/custom_nodes/$collide" "$COMFY_ROOT/.parked_nodes/$collide"
echo "์ถฉ๋ ํฉ์ ์ฎ๊ฒผ์ต๋๋ค: $collide -> .parked_nodes/"
fi
done
# ๋
ธ๋: ๋ก์ปฌ ์ค์น๋ณธ ๋ฒ๋ค + ํด๋ก ๊ฐ๋ฅํ ํฉ
fetch bjooo/customNode node_bundle.tar.gz "$STAGE/bundle"
tar -xzf "$STAGE/bundle/node_bundle.tar.gz" -C "$COMFY_ROOT/custom_nodes"
# ํค๋ฅผ ๋
ธ๋ ํด๋ .env ๋ก๋ ๋จ๊ธด๋ค. ํ ์ปจํ
์ด๋๊ฐ ์ฌ์์๋๋ฉด(์ด๋ฏธ์ง๊ฐ ๋์ฐ๋ฏ๋ก)
# ์คํ ํ๊ฒฝ๋ณ์๋ ์ด๊ธฐํ๋์ง๋ง .env ๋ ๋ณผ๋ฅจ์ ๋จ๊ณ prestartup_script.py ๊ฐ ์ฝ๋๋ค.
if [ -n "${OPENROUTER_API_KEY:-}" ] && [ -d "$COMFY_ROOT/custom_nodes/dolphin_nodes" ]; then
printf "OPENROUTER_API_KEY=%s\n" "$OPENROUTER_API_KEY" > "$COMFY_ROOT/custom_nodes/dolphin_nodes/.env"
chmod 600 "$COMFY_ROOT/custom_nodes/dolphin_nodes/.env"
echo "OPENROUTER_API_KEY ๋ฅผ ๋
ธ๋ ํด๋ .env ์ ๋จ๊ฒผ์ต๋๋ค(์ฌ์์์๋ ์ ์ง)."
fi
[ -d "$COMFY_ROOT/custom_nodes/RES4LYF" ] || git clone --depth 1 https://github.com/ClownsharkBatwing/RES4LYF "$COMFY_ROOT/custom_nodes/RES4LYF"
# ํฉ๋ณ ํ์ด์ฌ ์์กด์ฑ์ ComfyUI ๊ฐ ์ฐ๋ ์ธํฐํ๋ฆฌํฐ์ ๋ฃ์ด์ผ ํ๋ค.
for req in "$COMFY_ROOT"/custom_nodes/*/requirements.txt; do
[ -f "$req" ] || continue
"$PY" -m pip install -q -r "$req" || echo "์์กด์ฑ ์ค์น ์คํจ: $req" >&2
done
# ๊ฐ๋
๋
ธ๋๊ฐ ์คํ ์ค OpenRouter๋ฅผ ๋ถ๋ฅธ๋ค. ์์ผ๋ฉด ๋ ๋๊ฐ ์์ํ์๋ง์ ์ฃฝ๋๋ค.
if [ -z "${OPENROUTER_API_KEY:-}" ]; then
echo "๊ฒฝ๊ณ : OPENROUTER_API_KEY ๊ฐ ์์ต๋๋ค. SVI ๊ฐ๋
๋
ธ๋๊ฐ ์ฆ์ ์คํจํฉ๋๋ค." >&2
fi
# ์ ๋
ธ๋๋ฅผ ๋ฑ๋กํ๋ ค๋ฉด ComfyUI ํ๋ก์ธ์ค๋ง ๋ค์ ๋์ด๋ค. ํ ์ฌ์์์ ์ปจํ
์ด๋ ๋์คํฌ๋ฅผ
# ํต์งธ๋ก ์ด๊ธฐํํด์ ๋ฐฉ๊ธ ๋ฐ์ ๋ชจ๋ธ๊น์ง ๋ค ๋ ์๊ฐ๋ค(2026-09-30 ์ค์ธก). ์ ๋ ์ฐ์ง ๋ง ๊ฒ.
ARGS="--listen 0.0.0.0 --port 8188 --enable-cors-header"
if command -v pkill >/dev/null 2>&1; then
pkill -f "main.py --listen" || true
sleep 3
else
echo "pkill ์ด ์์ด ์๋ ์ฌ์์์ ๊ฑด๋๋๋๋ค. ComfyUI๋ฅผ ์ง์ ์ฌ์์ํ์ธ์." >&2
fi
cd "$COMFY_ROOT"
nohup "$PY" main.py $ARGS > /tmp/comfyui_bootstrap.log 2>&1 &
for _ in $(seq 1 60); do
sleep 2
if curl -fsS -o /dev/null "http://127.0.0.1:8188/system_stats"; then
echo "์๋ฃ. ComfyUI๊ฐ ์ ๋
ธ๋๋ก ์ฌ๋ผ์์ต๋๋ค. ์ฌ์ด๋๋ฐ Runpod ๋ ๋ ํญ์์ ํ๋ฆฌํ๋ผ์ดํธ๋ฅผ ๋๋ฆฌ์ธ์."
exit 0
fi
done
echo "ComfyUI๊ฐ 2๋ถ ์์ ์๋ตํ์ง ์์์ต๋๋ค. /tmp/comfyui_bootstrap.log ๋ฅผ ํ์ธํ์ธ์." >&2
tail -20 /tmp/comfyui_bootstrap.log >&2
exit 1
|