Managed ComfyUI picks up Comfy-Desktop shared models/input/output automatically

This commit is contained in:
mram
2026-09-21 22:34:10 +02:00
parent 45bc9fe27c
commit 507af1dbff
4 changed files with 65 additions and 2 deletions
+7 -1
View File
@@ -15,6 +15,8 @@ import (
"os/signal"
"path/filepath"
"syscall"
"gpu-turnstile/internal/supervise"
)
// Name matches the Windows service name; the systemd unit is Name + ".service".
@@ -66,7 +68,8 @@ func Run(run func(ctx context.Context) error) error {
// BindPaths hole through ProtectHome/ProtectSystem: it reads its venv and
// writes output/temp/user data under COMFY_DIR. A venv whose base
// interpreter (pyvenv.cfg home) lives outside COMFY_DIR gets an additional
// read-only bind.
// read-only bind, and a Comfy-Desktop shared data dir (models, input,
// output) a read-write one.
func renderUnit(exePath, configPath, comfyDir string) string {
bind := ""
if comfyDir != "" {
@@ -74,6 +77,9 @@ func renderUnit(exePath, configPath, comfyDir string) string {
if home := comfyVenvHome(comfyDir); home != "" {
bind += "BindReadOnlyPaths=" + home + "\n"
}
if shared := supervise.DesktopSharedDir(comfyDir); shared != "" {
bind += "BindPaths=" + shared + "\n"
}
}
return fmt.Sprintf(`[Unit]
Description=gpu-turnstile GPU arbitration proxy for Ollama and ComfyUI
+9
View File
@@ -24,6 +24,8 @@ import (
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/svc"
"golang.org/x/sys/windows/svc/mgr"
"gpu-turnstile/internal/supervise"
)
// Name is the Windows service name.
@@ -382,6 +384,13 @@ func grantAll(exe, configPath string) error {
return err
}
}
// Comfy-Desktop keeps models/input/output in a shared dir next
// to the install; the managed instance writes output there.
if shared := supervise.DesktopSharedDir(comfyDir); shared != "" {
if err := grantAccessTree(shared, "(OI)(CI)(M)"); err != nil {
return err
}
}
}
}
return nil