aboutsummaryrefslogtreecommitdiffstats
path: root/CLAUDE.md
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-05-12 11:32:46 +0200
committerDanilo M. <danix@danix.xyz>2026-05-12 11:32:46 +0200
commit86af08a80d9fbfdcde71f80cd0bebd5034ab8a3b (patch)
tree31464907358dbdb8c20e3878604a86624d3c3a31 /CLAUDE.md
parent5f0710065f3696d83163909192208b3324439fbd (diff)
downloadollama-runpod-86af08a80d9fbfdcde71f80cd0bebd5034ab8a3b.tar.gz
ollama-runpod-86af08a80d9fbfdcde71f80cd0bebd5034ab8a3b.zip
feat: patch transart.py and my-publisher config on session startHEADmaster
Add patch_external_configs() to update OLLAMA_HOST in transart.py and ollama_host in my-publisher/config.toml with the live pod URL on each session start. Paths are configurable via TRANSART_SCRIPT and PUBLISHER_CONFIG in config; skipped when empty or file missing. Also replace hardcoded danixland-storage default with generic my-storage, add .gitignore, and update README/CLAUDE.md to document the new behavior. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'CLAUDE.md')
-rw-r--r--CLAUDE.md10
1 files changed, 7 insertions, 3 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 4b1b242..734c6bb 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## What this is
-Single bash script (`runpod-session.sh`) that manages RunPod GPU pod lifecycle for running Ollama models, then patches `~/.config/opencode/opencode.jsonc` so opencode points at the live pod.
+Single bash script (`runpod-session.sh`) that manages RunPod GPU pod lifecycle for running Ollama models, then patches `~/.config/opencode/opencode.jsonc`, `transart.py`, and `my-publisher/config.toml` so all tools point at the live pod.
## Running / testing
@@ -31,14 +31,16 @@ All logic is in `main()` which runs these steps in order:
2. **Pod creation** — if none found: picks cheapest secure-cloud GPU under `MAX_PRICE_PER_HR`, creates pod with `ollama/ollama:latest` image, network volume mounted at `/workspace`
3. **Wait for Ollama** — polls `https://<pod-id>-11434.proxy.runpod.net/api/tags` until `.models` appears
4. **Patch opencode.json** — updates `baseURL`, active `model`, and merges `WARMUP_MODELS` into provider models block using jq `*` merge (existing config wins on conflicts)
-5. **Warmup** — POST to `/api/generate` with a dummy prompt to load model into VRAM at `WARMUP_NUM_CTX` context length
-6. **Save state** — writes `~/.config/runpod-session/state.json` with pod_id, url, model, timestamp
+5. **Patch external configs** — `patch_external_configs()` rewrites `OLLAMA_HOST` in `transart.py` and `ollama_host` in `my-publisher/config.toml` using `sed`; paths set via `TRANSART_SCRIPT` / `PUBLISHER_CONFIG` in config; skipped if empty or file missing
+6. **Warmup** — POST to `/api/generate` with a dummy prompt to load model into VRAM at `WARMUP_NUM_CTX` context length
+7. **Save state** — writes `~/.config/runpod-session/state.json` with pod_id, url, model, timestamp
## Key design constraints
- All RunPod calls go through `gql()` — single curl wrapper that exits on API errors
- Pod is identified by name matching `test("ollama"; "i")` — not by ID — so the name `ollama-session` set at creation must not change
- `patch_opencode_config()` writes a `.bak` before touching opencode.jsonc; jq `*` merge means existing per-model settings survive
+- `patch_external_configs()` uses `sed -i` on the bare pod URL (no `/v1`); writes `.bak` before each file; skips silently when var is empty, warns when path set but missing
- `OLLAMA_MODELS_PATH` env var on the pod is not set by the script — must be set in config if models live outside default location on the network volume
- GPU selection only queries `secureCloud == true` pods; community cloud is excluded
@@ -49,3 +51,5 @@ All logic is in `main()` which runs these steps in order:
| `~/.config/runpod-session/config` | Sourced as bash; holds API key, defaults |
| `~/.config/runpod-session/state.json` | Last session record (pod_id, url, model, timestamp) |
| `~/.config/opencode/opencode.jsonc` | Patched in-place; `.bak` written before changes |
+| `$TRANSART_SCRIPT` | `OLLAMA_HOST` rewritten on each session start; `.bak` written first |
+| `$PUBLISHER_CONFIG` | `ollama_host` rewritten on each session start; `.bak` written first |