Add stack Update, ComfyUI model manager, and slim ComfyUI stack.
Server UI gains Update on stack cards, ComfyUI Models tab with workflow scan and downloads, and centralized comfyui_config. Model catalog and download scripts move from stacks/comfyui to server-ui so ComfyUI stays a minimal Docker wrapper for easier image updates.
This commit is contained in:
@@ -2,17 +2,34 @@
|
||||
# Print API key + browser instructions (shared by install scripts and show-api-key.sh).
|
||||
set -euo pipefail
|
||||
|
||||
print_api_key_instructions() {
|
||||
local env_file="${1:-/opt/control-plane/.env}"
|
||||
local ui_port="${2:-8091}"
|
||||
_read_api_key() {
|
||||
local env_file="$1"
|
||||
local api_key=""
|
||||
local lan_ip=""
|
||||
|
||||
if [[ -r "${env_file}" ]]; then
|
||||
api_key="$(grep '^API_KEY=' "${env_file}" 2>/dev/null | cut -d= -f2- || true)"
|
||||
elif [[ -f "${env_file}" ]]; then
|
||||
api_key="$(sudo grep '^API_KEY=' "${env_file}" 2>/dev/null | cut -d= -f2- || true)"
|
||||
fi
|
||||
if [[ -z "${api_key}" ]]; then
|
||||
local pid
|
||||
pid="$(pgrep -f '/opt/server-ui/app.py' 2>/dev/null | head -1 || true)"
|
||||
if [[ -n "${pid}" && -r "/proc/${pid}/environ" ]]; then
|
||||
api_key="$(tr '\0' '\n' < "/proc/${pid}/environ" 2>/dev/null | grep '^API_KEY=' | cut -d= -f2- || true)"
|
||||
fi
|
||||
fi
|
||||
printf '%s' "${api_key}"
|
||||
}
|
||||
|
||||
print_api_key_instructions() {
|
||||
local env_file="${1:-/opt/control-plane/.env}"
|
||||
local ui_port="${2:-8091}"
|
||||
local dev_env="${3:-}"
|
||||
local api_key=""
|
||||
local dev_key=""
|
||||
local lan_ip=""
|
||||
local verify_ok=0
|
||||
|
||||
api_key="$(_read_api_key "${env_file}")"
|
||||
|
||||
lan_ip="$(hostname -I 2>/dev/null | awk '{print $1}')"
|
||||
[[ -n "${lan_ip}" ]] || lan_ip="<IP-serwera>"
|
||||
@@ -30,6 +47,33 @@ print_api_key_instructions() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ -n "${dev_env}" && -f "${dev_env}" ]]; then
|
||||
dev_key="$(_read_api_key "${dev_env}")"
|
||||
if [[ -n "${dev_key}" && "${dev_key}" != "${api_key}" ]]; then
|
||||
echo "OSTRZEŻENIE: klucz dev różni się od produkcji!"
|
||||
echo " prod: ${env_file}"
|
||||
echo " dev: ${dev_env}"
|
||||
echo " Napraw: sudo bash stacks/server-ui/scripts/setup-control-plane-env.sh"
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
if curl -sf -X POST "http://127.0.0.1:${ui_port}/api/auth/verify" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"api_key\":\"${api_key}\"}" >/dev/null 2>&1; then
|
||||
verify_ok=1
|
||||
fi
|
||||
|
||||
echo "Plik klucza: ${env_file}"
|
||||
if [[ "${verify_ok}" -eq 1 ]]; then
|
||||
echo "Weryfikacja live (server-ui :${ui_port}): OK"
|
||||
else
|
||||
echo "Weryfikacja live (server-ui :${ui_port}): FAIL"
|
||||
echo " Sprawdź: systemctl status server-ui"
|
||||
echo " Lub: bash stacks/server-ui/scripts/verify-api-key.sh"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "1. Twój klucz API (skopiuj):"
|
||||
echo ""
|
||||
echo " ${api_key}"
|
||||
@@ -45,13 +89,20 @@ print_api_key_instructions() {
|
||||
echo " d) Kliknij „Sprawdź klucz” (powinno być: Klucz poprawny)"
|
||||
echo " e) Dopiero potem Start/Stop, CLI, Pliki, GPU Fan"
|
||||
echo ""
|
||||
echo "4. Stary klucz w przeglądarce?"
|
||||
echo " a) W panelu kliknij „Wyczyść klucz”"
|
||||
echo " b) Lub F12 → Application → Local Storage → usuń server-ui-api-key"
|
||||
echo " c) Ctrl+F5, potem kroki 2–3"
|
||||
echo ""
|
||||
echo "Plik klucza (na przyszłość):"
|
||||
echo " sudo grep ^API_KEY= ${env_file}"
|
||||
echo ""
|
||||
echo "══════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
[[ "${verify_ok}" -eq 1 ]]
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
print_api_key_instructions "${1:-/opt/control-plane/.env}" "${2:-8091}"
|
||||
print_api_key_instructions "${1:-/opt/control-plane/.env}" "${2:-8091}" "${3:-}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user