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:
@@ -230,6 +230,14 @@ def _parse_stacks_yaml_simple(text: str) -> dict[str, Any]:
|
||||
return {"stacks": stacks}
|
||||
|
||||
|
||||
def find_compose_file(stack_dir: Path) -> Path | None:
|
||||
for name in ("compose.yaml", "docker-compose.yml", "docker-compose.yaml"):
|
||||
path = stack_dir / name
|
||||
if path.is_file():
|
||||
return path
|
||||
return None
|
||||
|
||||
|
||||
def _run_compose(
|
||||
stack: StackConfig,
|
||||
*args: str,
|
||||
@@ -240,10 +248,17 @@ def _run_compose(
|
||||
"compose",
|
||||
"--project-directory",
|
||||
stack.compose_dir,
|
||||
"--profile",
|
||||
stack.profile,
|
||||
*args,
|
||||
]
|
||||
compose_file = find_compose_file(stack.path)
|
||||
if compose_file is not None:
|
||||
cmd.extend(["-f", str(compose_file)])
|
||||
cmd.extend(
|
||||
[
|
||||
"--profile",
|
||||
stack.profile,
|
||||
*args,
|
||||
]
|
||||
)
|
||||
return subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
@@ -389,6 +404,36 @@ def stack_recreate(stack: StackConfig) -> str:
|
||||
return (proc.stdout + proc.stderr).strip()
|
||||
|
||||
|
||||
def stack_update(stack: StackConfig) -> str:
|
||||
state = get_container_state(stack)
|
||||
was_running = state["running"]
|
||||
|
||||
pull = _run_compose(stack, "pull", timeout=600)
|
||||
if pull.returncode != 0:
|
||||
raise ComposeError(
|
||||
pull.stderr.strip() or pull.stdout.strip() or "pull failed",
|
||||
pull.returncode,
|
||||
pull.stderr,
|
||||
)
|
||||
output = (pull.stdout + pull.stderr).strip()
|
||||
|
||||
if not was_running:
|
||||
suffix = "\n[server-ui] Obraz pobrany. Stack zatrzymany — użyj Start."
|
||||
return (output + suffix).strip() if output else suffix.strip()
|
||||
|
||||
proc = _run_compose(stack, "up", "-d", "--force-recreate", timeout=300)
|
||||
if proc.returncode != 0:
|
||||
raise ComposeError(
|
||||
proc.stderr.strip() or proc.stdout.strip() or "recreate failed",
|
||||
proc.returncode,
|
||||
proc.stderr,
|
||||
)
|
||||
recreate_out = (proc.stdout + proc.stderr).strip()
|
||||
if recreate_out:
|
||||
output = f"{output}\n{recreate_out}".strip() if output else recreate_out
|
||||
return output
|
||||
|
||||
|
||||
def set_stack_port(
|
||||
stack: StackConfig,
|
||||
port: int,
|
||||
|
||||
Reference in New Issue
Block a user