Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 43 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help check-deps fix-docker-group build build-comfyui build-swarmui up down sui sui-rebuild cui llm llm-pull llm-import-hf llm-list llm-rm llm-logs swarmui-rebuild swarmui-extensions-check restart logs clean
.PHONY: help check-deps fix-docker-group build build-comfyui build-swarmui up down sui sui-rebuild swarmui-update cui llm llm-pull llm-import-hf llm-list llm-rm llm-logs swarmui-rebuild swarmui-extensions-check restart logs clean

help: ## Show this help message
@echo 'Usage: make [target]'
Expand Down Expand Up @@ -46,8 +46,44 @@ build-no-cache: ## Build all images without cache
up: ## Start all services
docker compose up -d

sui: ## SwarmUI + Ollama (stops other compose services first)
docker compose down && docker compose up -d swarmui ollama
sui: ## SwarmUI + Ollama (stops ComfyUI first; updates SwarmUI; preserves running containers)
-docker compose stop comfyui 2>/dev/null || true
docker compose up -d swarmui ollama
@$(MAKE) swarmui-update

swarmui-update: ## Pull latest SwarmUI, rebuild if needed, and restart (requires swarmui container)
@docker ps >/dev/null 2>&1 || (echo "Error: Docker not accessible. Run: make fix-docker-group, then newgrp docker" && exit 1)
@docker compose up -d swarmui 2>/dev/null || true
@i=0; while [ $$i -lt 90 ]; do \
status=$$(docker compose ps swarmui --format '{{.Health}}' 2>/dev/null); \
echo "$$status" | grep -q healthy && break; \
docker compose ps swarmui --status running -q 2>/dev/null | grep -q . || { sleep 1; i=$$((i+1)); continue; }; \
[ -z "$$status" ] && break; \
i=$$((i+1)); sleep 1; \
done
@docker compose ps swarmui --status running -q 2>/dev/null | grep -q . \
|| (echo "Error: SwarmUI not running. Start with: docker compose up -d swarmui" && exit 1)
@echo "Updating SwarmUI (git pull + dotnet build if needed)..."
@docker compose exec -T swarmui bash -c 'set -e; cd /app/SwarmUI; \
prior=$$(git rev-parse HEAD); \
for attempt in 1 2 3 4 5; do \
if git fetch origin master && git reset --hard origin/master; then break; fi; \
[ "$$attempt" -eq 5 ] && exit 1; \
echo "Git fetch failed (attempt $$attempt), retrying..."; sleep 2; \
done; \
new=$$(git rev-parse HEAD); \
rm -f src/bin/must_rebuild; \
if [ "$$prior" != "$$new" ] || [ ! -f src/bin/live_release/SwarmUI.dll ]; then \
echo "Building SwarmUI ($$prior -> $$new)..."; \
dotnet build src/SwarmUI.csproj -c Release -o src/bin/live_release; \
touch src/bin/.swarmui_restarted; \
else \
echo "SwarmUI source already up to date; skipping build."; \
fi'
@if docker compose exec -T swarmui test -f /app/SwarmUI/src/bin/.swarmui_restarted 2>/dev/null; then \
docker compose exec -T swarmui rm -f /app/SwarmUI/src/bin/.swarmui_restarted; \
docker compose restart swarmui; \
fi

sui-rebuild: ## Restart SwarmUI + Ollama (SwarmUI builds extensions at startup; use after adding extension via UI)
@docker ps >/dev/null 2>&1 || (echo "Error: Docker not accessible. Run: make fix-docker-group, then newgrp docker" && exit 1)
Expand Down Expand Up @@ -89,10 +125,11 @@ shell-comfyui: ## Open shell in ComfyUI container
shell-swarmui: ## Open shell in SwarmUI container
docker compose exec swarmui /bin/bash

swarmui-rebuild: ## [Debug] Force rebuild inside container; normally not needed (SwarmUI builds at startup). Then: make down && make sui
swarmui-rebuild: ## [Debug] Force rebuild inside container without git pull. Prefer: make swarmui-update
@docker ps >/dev/null 2>&1 || (echo "Error: Docker not accessible. Run: make fix-docker-group, then newgrp docker" && exit 1)
@docker compose ps swarmui 2>/dev/null | grep -q Up || (echo "Error: SwarmUI not running. Start with: make sui" && exit 1)
docker compose exec swarmui bash -c "cd /app/SwarmUI/src && dotnet build SwarmUI.csproj -c Release -o ../bin/live_release"
docker compose exec swarmui bash -c "set -e; cd /app/SwarmUI && dotnet build src/SwarmUI.csproj -c Release -o src/bin/live_release"
docker compose restart swarmui

swarmui-extensions-check: ## [Debug] List extensions dir and run build; use if extension not showing after restart
@docker ps >/dev/null 2>&1 || (echo "Error: Docker not accessible. Run: make fix-docker-group, then newgrp docker" && exit 1)
Expand All @@ -102,7 +139,7 @@ swarmui-extensions-check: ## [Debug] List extensions dir and run build; use if e
@echo "=== Extension subdirs (.cs) ==="
@docker compose exec swarmui find /app/SwarmUI/src/Extensions -maxdepth 2 -type f -name "*.cs" 2>/dev/null || true
@echo "=== Manual build (SwarmUI usually builds at startup) ==="
docker compose exec swarmui bash -c "cd /app/SwarmUI/src && dotnet build SwarmUI.csproj -c Release -o ../bin/live_release -v minimal"
docker compose exec swarmui bash -c "set -e; cd /app/SwarmUI && dotnet build src/SwarmUI.csproj -c Release -o src/bin/live_release -v minimal"

llm-pull: ## Download Ollama model (usage: make llm-pull MODEL=dolphin3)
@if [ -z "$(MODEL)" ]; then \
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ make help # Show all available commands
make build # Build all Docker images
make up # Start all services
make down # Stop all services
make sui # SwarmUI + Ollama only (stops others first)
make sui # SwarmUI + Ollama (stops others first; updates SwarmUI)
make cui # ComfyUI only (stops others first)
make llm # Ollama only (stops others first)
make swarmui-rebuild # [Debug] Recompile extensions manually; normally use Server → Extensions → Install in UI
make swarmui-update # Pull latest SwarmUI, rebuild, and restart
make swarmui-rebuild # Rebuild SwarmUI from current source (no git pull)
make logs # View logs from all services
make restart # Restart services
make status # Show service status and URLs
Expand Down
10 changes: 10 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ freya/
- `./swarmui/extensions` → SwarmUI Extensions source (e.g. MagicPrompt)
- `./swarmui/bin` → SwarmUI build output (persisted so recompiled app with extensions is used after restart)

**Updates:** The Freya container does not use SwarmUI’s native `launch-linux.sh` startup path, so the in-UI **Server → Update** button will not rebuild the running app. Use **`make swarmui-update`** to `git pull`, rebuild to `src/bin/live_release`, and restart. **`make sui`** runs this automatically when starting SwarmUI + Ollama. To refresh the Docker image itself (re-clone at build time): **`make build-swarmui`**. ComfyUI backend updates inside SwarmUI are separate — configure **Server → Backends → AutoUpdate**.

### Ollama

- **Image**: `ollama/ollama:0.24.0`
Expand All @@ -86,4 +88,12 @@ make build-swarmui
make build-no-cache
```

### Update SwarmUI (Docker Compose)

```bash
make swarmui-update # git pull + dotnet build + restart (container must be running)
make sui # start SwarmUI + Ollama and run swarmui-update
make build-swarmui # rebuild image from latest upstream (slower; use when in-container update fails)
```

**Note**: First build may take 15-30 minutes as it clones repositories and installs dependencies.
2 changes: 2 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,5 @@ The steps below work on **Linux** and on **Windows** (inside a WSL2 terminal). R
make llm-pull MODEL=dolphin3
```
See [SwarmUI MagicPrompt](swarmui-magicprompt.md) for configuration.

8. **Updating SwarmUI:** The in-UI update button does not rebuild the app in Freya’s Docker setup. Use **`make swarmui-update`**, or **`make sui`** (which updates automatically). See [Troubleshooting — SwarmUI updates](troubleshooting.md#swarmui-in-ui-update-button-does-not-work).
2 changes: 1 addition & 1 deletion docs/swarmui-magicprompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Extensions live in `swarmui/extensions/` (source); the compiled app lives in `sw

## Install via UI (recommended)

1. **Start SwarmUI and Ollama** (e.g. `make sui`).
1. **Start SwarmUI and Ollama** (e.g. `make sui` — also updates SwarmUI core to the latest git revision).
2. **Pull an Ollama model** (if needed). Default for most control and compatibility: **[dolphin3](https://ollama.com/library/dolphin3)** (Dolphin 3.0 Llama 3.1 8B, ~4.9GB, 128K context):
```bash
make llm-pull MODEL=dolphin3
Expand Down
27 changes: 25 additions & 2 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,36 @@ args: ["--launch_mode", "none"]
```
Then re-apply and restart: `kubectl apply -f k8s/swarmui/deployment.yaml && kubectl rollout restart deployment/swarmui -n freya`.

### SwarmUI: In-UI update button does not work

**Symptom:** SwarmUI shows many updates available (e.g. “230 update(s) available”) but clicking **Update** does nothing useful — the version does not change after restart.

**Cause:** On a native install, SwarmUI’s update flow runs `git pull`, sets a rebuild flag, and recompiles via `launch-linux.sh`. Freya’s container uses a custom startup script that runs the existing `SwarmUI.dll` from the mounted `swarmui/bin` volume and skips that rebuild step. The UI may pull new source, but the running binary stays old.

**Fix (Docker Compose):**

```bash
make swarmui-update
```

This runs `git pull`, builds to `src/bin/live_release`, and restarts SwarmUI. **`make sui`** runs `swarmui-update` automatically when starting SwarmUI + Ollama.

To re-clone SwarmUI at image build time instead:

```bash
make build-swarmui
make sui
```

**ComfyUI backend updates** (under `swarmui/dlbackend`) are separate — use **Server → Backends → Edit → AutoUpdate** in the SwarmUI UI.

### SwarmUI: Extensions not persisting or UI not detecting them after reboot

**Symptom:** Extensions (e.g. MagicPrompt) disappear after container or host reboot, or the extension files are in `swarmui/extensions/` but the UI doesn't show the extension.

**Recommended: Use the UI for extensions.** Install entirely via **Server → Extensions → Install** in SwarmUI. SwarmUI downloads, compiles at startup, and persists the build to `swarmui/bin/`. No manual rebuild commands needed.

**Fix:** Run **`make setup`** (creates `swarmui/extensions` and `swarmui/bin`), then **`make sui`**. In SwarmUI use **Server → Extensions → Install**. SwarmUI builds extensions at startup; no `make swarmui-rebuild` needed.
**Fix:** Run **`make setup`** (creates `swarmui/extensions` and `swarmui/bin`), then **`make sui`**. In SwarmUI use **Server → Extensions → Install**. SwarmUI builds extensions when it starts.

**Extension still not showing?** SwarmUI builds extensions when it starts. If the build fails (e.g. "Could not locate assembly SwarmUI"), the extension project expects `SwarmUI.dll` at `src/bin/live_release/`. The Freya image provides a symlink fallback. Rebuild: **`make build-swarmui`** then **`make down && make sui`**. Run **`make swarmui-extensions-check`** to see build errors.
**Extension still not showing?** SwarmUI builds extensions when it starts. If the build fails (e.g. "Could not locate assembly SwarmUI"), the extension project expects `SwarmUI.dll` at `src/bin/live_release/`. The Freya image provides a symlink fallback. Run **`make swarmui-update`** or **`make build-swarmui`** then **`make sui`**. Run **`make swarmui-extensions-check`** to see build errors.

Loading