From d3a90ccc0d4bdbd4af5dce4c792941e27ff8c284 Mon Sep 17 00:00:00 2001 From: JeLuF Date: Sat, 5 Nov 2022 23:30:40 +0100 Subject: [PATCH] Windows error handling - cd to the script location on start of 'Start Stable Diffusion UI.cmd' - Bail out when downloading micromamba fails - add env variables SD_UI_BIND_IP and SD_UI_BIND_PORT to configure uvicorn --- scripts/Start Stable Diffusion UI.cmd | 1 + scripts/bootstrap.bat | 6 ++++++ scripts/on_sd_start.bat | 5 ++++- scripts/on_sd_start.sh | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/Start Stable Diffusion UI.cmd b/scripts/Start Stable Diffusion UI.cmd index 7f7d0539..231a6c3d 100644 --- a/scripts/Start Stable Diffusion UI.cmd +++ b/scripts/Start Stable Diffusion UI.cmd @@ -1,5 +1,6 @@ @echo off +cd /d %~dp0 set PATH=C:\Windows\System32;%PATH% @rem set legacy installer's PATH, if it exists diff --git a/scripts/bootstrap.bat b/scripts/bootstrap.bat index 27004ca2..e334deb9 100644 --- a/scripts/bootstrap.bat +++ b/scripts/bootstrap.bat @@ -37,6 +37,12 @@ if "%PACKAGES_TO_INSTALL%" NEQ "" ( mkdir "%MAMBA_ROOT_PREFIX%" call curl -L "%MICROMAMBA_DOWNLOAD_URL%" > "%MAMBA_ROOT_PREFIX%\micromamba.exe" + if "%ERRORLEVEL%" NEQ "0" ( + echo "There was a problem downloading micromamba. Cannot continue." + pause + exit /b + ) + @rem test the mamba binary echo Micromamba version: call "%MAMBA_ROOT_PREFIX%\micromamba.exe" --version diff --git a/scripts/on_sd_start.bat b/scripts/on_sd_start.bat index 3b7ed0ca..b82d48dd 100644 --- a/scripts/on_sd_start.bat +++ b/scripts/on_sd_start.bat @@ -343,6 +343,9 @@ call python --version @set SD_UI_PATH=%cd%\ui @cd stable-diffusion -@uvicorn server:app --app-dir "%SD_UI_PATH%" --port 9000 --host 0.0.0.0 +@if NOT DEFINED SD_UI_BIND_PORT set SD_UI_BIND_PORT=9000 +@if NOT DEFINED SD_UI_BIND_IP set SD_UI_BIND_PORT=0.0.0.0 +@uvicorn server:app --app-dir "%SD_UI_PATH%" --port %SD_UI_BIND_PORT% --host %SD_UI_BIND_IP% + @pause diff --git a/scripts/on_sd_start.sh b/scripts/on_sd_start.sh index a5c6c8d4..da0f2357 100755 --- a/scripts/on_sd_start.sh +++ b/scripts/on_sd_start.sh @@ -283,6 +283,6 @@ cd .. export SD_UI_PATH=`pwd`/ui cd stable-diffusion -uvicorn server:app --app-dir "$SD_UI_PATH" --port ${SDUI_BIND_PORT:-9000} --host ${SDUI_BIND_IP:-0.0.0.0} +uvicorn server:app --app-dir "$SD_UI_PATH" --port ${SD_UI_BIND_PORT:-9000} --host ${SD_UI_BIND_IP:-0.0.0.0} read -p "Press any key to continue"