diff --git a/Runpod_Comfy/core/docker/Dockerfile b/Runpod_Comfy/core/docker/Dockerfile index 7d70195..9cc76ca 100644 --- a/Runpod_Comfy/core/docker/Dockerfile +++ b/Runpod_Comfy/core/docker/Dockerfile @@ -8,7 +8,6 @@ ENV DEBIAN_FRONTEND=noninteractive \ PYTHONUNBUFFERED=1 \ COMFYUI_PORT=8188 \ JUPYTER_PORT=8888 \ - JUPYTER_TOKEN=runpod \ COMFYUI_WORKDIR=/workspace/ComfyUI \ RUNPOD_VOLUME_ROOT=/workspace diff --git a/Runpod_Comfy/core/docker/start.sh b/Runpod_Comfy/core/docker/start.sh index b8adbd6..cf50ad2 100755 --- a/Runpod_Comfy/core/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}" JUPYTER_PORT="${JUPYTER_PORT:-8888}" -JUPYTER_TOKEN="${JUPYTER_TOKEN:-runpod}" +JUPYTER_TOKEN="${JUPYTER_TOKEN:-}" "$ROOT/core/scripts/bootstrap.sh" @@ -17,15 +17,30 @@ if [[ -f "$LOCK" ]]; then fi if [[ "$ENABLE_JUPYTER_LOCK" == "true" ]]; then - echo "[jupyter] starting on 0.0.0.0:${JUPYTER_PORT}" - jupyter lab \ - --ip=0.0.0.0 \ - --port "$JUPYTER_PORT" \ - --no-browser \ - --allow-root \ - --IdentityProvider.token="$JUPYTER_TOKEN" \ - --ServerApp.root_dir="$WORKDIR" \ - >/tmp/jupyter.log 2>&1 & + if ! command -v jupyter >/dev/null 2>&1; then + echo "[jupyter] WARNING: ENABLE_JUPYTER=true but jupyter binary not found (likely built with ENABLE_JUPYTER=false)" + else + if [[ -z "$JUPYTER_TOKEN" ]]; then + JUPYTER_TOKEN="$(python3 -c 'import secrets; print(secrets.token_hex(16))')" + echo "[jupyter] generated token: $JUPYTER_TOKEN" + fi + + echo "[jupyter] starting on 0.0.0.0:${JUPYTER_PORT}" + jupyter lab \ + --ip=0.0.0.0 \ + --port "$JUPYTER_PORT" \ + --no-browser \ + --allow-root \ + --IdentityProvider.token="$JUPYTER_TOKEN" \ + --ServerApp.root_dir="$WORKDIR" \ + >/tmp/jupyter.log 2>&1 & + + JUPYTER_PID=$! + sleep 2 + if ! kill -0 "$JUPYTER_PID" 2>/dev/null; then + echo "[jupyter] WARNING: failed to start, check /tmp/jupyter.log" + fi + fi fi cd "$WORKDIR" diff --git a/Runpod_Comfy/image/DEPLOY_RUNPOD.md b/Runpod_Comfy/image/DEPLOY_RUNPOD.md index fa0adb4..5d810a9 100644 --- a/Runpod_Comfy/image/DEPLOY_RUNPOD.md +++ b/Runpod_Comfy/image/DEPLOY_RUNPOD.md @@ -33,7 +33,7 @@ docker push ${IMAGE_NAME}:${IMAGE_TAG} - `COMFYUI_PORT=8188` - `JUPYTER_PORT=8888` -- `JUPYTER_TOKEN=...` (default in image is `runpod`) +- `JUPYTER_TOKEN=...` (recommended to set explicitly; if unset, container auto-generates and logs a token) - `COMFYUI_WORKDIR=/workspace/ComfyUI` - `HF_TOKEN=...` (if needed) - `CIVITAI_TOKEN=...` (if needed)