Files
gpu-rent/docs/extensions.md
T
Leonid Pershin 71f4e4c2e3 Update extensions and documentation for LLM integration and CLI enhancements
- Added support for a new extension, `swarm-assistent`, in `extensions.example.yaml` with a requirement for `ollama`.
- Enhanced the README.md to clarify the setup process and provide a quick start guide for using extensions.
- Updated documentation in `llm.md` to reflect the opt-in nature of LLM support and provide clearer instructions for enabling it.
- Improved the `autocomplete.md` to detail the automatic setup of word lists during the initial launch.
- Revised `cli.md` to include new commands and options related to LLM runtime handling and extension management.
- Enhanced the `spike-notes.md` to guide users through the first live run with a focus on LLM integration.
2026-08-21 05:49:34 +03:00

98 lines
5.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Расширения: git-репы на bootstrap
## Быстрый старт
```powershell
copy extensions.example.yaml extensions.yaml
# добавь url реп (публичные — без GIT_TOKEN)
.\gpu-rent.ps1 up --yes
# доклонировать на уже живой VM:
.\gpu-rent.ps1 seed-extensions
```
Срабатывает на каждом `up``seed-extensions`):
- нет каталога → `git clone`;
- каталог есть → по умолчанию `fetch` + `reset --hard` на `ref` (или текущую ветку для уже установленных вне yaml);
- `--no-update` / `UPDATE_GIT=false` → существующие репы не трогаем, только недостающие clone.
Также обновляется сам SwarmUI в `/opt/swarmui` (тот же флаг).
Два разных мира — не путать:
| Вид | Куда клонировать | Что это |
| --- | --- | --- |
| `swarmui` | `/mnt/swarm_data/Extensions/<dir>``/opt/swarmui/src/Extensions/<dir>` | C# extension SwarmUI (класс `: Extension`). После рестарта подхватывается сам |
| `comfy` | `/mnt/swarm_data/DLNodes/<dir>``…/ComfyUIBackend/DLNodes/<dir>` | Custom nodes ComfyUI (Python). `requirements.txt` ставит SwarmUI/Comfy при первом старте backend |
Пустой манифест или его нет — ничего не клонируем, SwarmUI как из коробки. Это не связано с Civitai-токеном.
## Манифест
Пример: [`extensions.example.yaml`](../extensions.example.yaml). Рабочая копия: `extensions.yaml` в корне репо (или `EXTENSIONS_MANIFEST`).
```yaml
swarmui:
- url: https://gitea.hsrv.site/mrleo1nid/swarm-assistent.git
ref: main
dir: swarm-assistent
requires: ollama # none | ollama | llamacpp | any-llm; default none = always
- url: https://github.com/example/SwarmUI-SomeExt.git
ref: main
dir: SomeExt
comfy:
- url: https://github.com/example/ComfyUI-Something.git
ref: v1.2.0
```
| `requires` | Когда клонировать |
| --- | --- |
| `none` (или поле отсутствует) | всегда |
| `ollama` | только при `LLM_RUNTIME=ollama` |
| `llamacpp` | только при `LLM_RUNTIME=llamacpp` |
| `any-llm` | при `ollama` или `llamacpp` |
Строки с несовпавшим `requires` пропускаются (лог), остальные ставятся как обычно. В `extensions.example.yaml` по умолчанию — **swarm-assistent** с `requires: ollama` (чат/vision под Krea 2).
В git репозитория gpu-rent не коммитить рабочий список с лишними приватными URL сверх примера.
## Когда в жизненном цикле
Idle-killer ещё не вооружён. Git нужен на VM (`apt` в bootstrap, если нет в образе).
1. Маркер FS data volume.
2. **Clone extensions** (этот документ). Маркер `/mnt/swarm_data/.gpu-rent-extensions-seeded` после успешного прохода всех строк.
3. Civitai-seed моделей ([models.md](models.md)), если есть токен.
4. Первый `systemctl start swarmui`: видит `src/Extensions`, собирает их; ComfyUI ставит pip из DLNodes.
5. Backend Idle → idle-killer.
Порядок 2→3 важен: расширения до старта UI, модели тоже до старта (чтобы не качать дефолт SwarmUI).
Позже: `gpu-rent seed-extensions` — те же clone/fetch на живом диске, затем **рестарт** SwarmUI (иначе новый C# extension не подхватится). CLI предупреждает и делает `systemctl restart swarmui`, если VM жива.
## Clone на VM
- `git clone --recurse-submodules`.
- Если `ref` — ветка/тег: `--depth 1` + `checkout`.
- Если `ref` похож на SHA: fetch этого commit (shallow может не хватить).
- Каталог уже есть и `remote origin` совпадает с `url``fetch` + `checkout ref`, не `rm -rf`.
- Каталог есть, origin другой → fail этой строки, не молча перезаписывать.
Публичный HTTPS без секретов. Приватный репозиторий:
- `GIT_TOKEN` в `.env` (GitHub: `x-access-token`; GitLab: `oauth2` / PAT). CLI подставляет в URL **только на VM**, не пишет токен в yaml и не в cloud-init.
- Либо отдельный deploy key `<repo>/.gpu-rent/git_deploy` — v1.1, не обязательно сейчас.
Не использовать `git://`. Только `https://` и `git@` + ключ.
## Сбой
Одна строка упала (404, auth, сеть) — остальные можно продолжить; `up` в конце ненулевой, маркер seeded не ставить, повтор доклонирует. Не оставлять полупустой `.git`.
## Конфиг
```env
EXTENSIONS_MANIFEST= # пусто = <repo>/extensions.yaml
GIT_TOKEN= # опционально, для приватных https
```