diff --git a/index.html b/index.html index 8b7d47a..92bd47c 100644 --- a/index.html +++ b/index.html @@ -1258,7 +1258,29 @@

+echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc + +# ARM64 fix 1 — remove litellm-proxy-extras before it causes DB migration failures +# This package ships with LiteLLM and runs `prisma migrate deploy` on startup. +# On a fresh ARM64 database the migrations conflict and leave the schema +# incomplete, breaking the Admin UI and all virtual-key management. +pip uninstall litellm-proxy-extras -y --break-system-packages + +# ARM64 fix 2 — fetch the ARM64 prisma query engine binary +# LiteLLM's startup routine does not detect the correct binary target on +# aarch64 Ubuntu 24.04. Without this, prisma connects, prints a false +# "prisma package not found" warning, and then fails silently to +# build the DB schema. Run this once after every litellm upgrade. +cd ~/.local/lib/python3.12/site-packages/litellm/proxy/ +DATABASE_URL="postgresql://litellm:litellm@localhost:5432/litellm" \ + PRISMA_BINARY_TARGET=linux-arm64-openssl-3.0.x prisma py fetch +DATABASE_URL="postgresql://litellm:litellm@localhost:5432/litellm" \ + prisma generate --schema schema.prisma +cd ~/sparky-ai-stack + +
+ +
On x86 the prisma binary is auto-detected. On ARM64 (GB10/Grace CPU) it is not downloaded during litellm[proxy] installation. Without it, the prisma query engine process spawns but immediately exits, LiteLLM logs prisma-query-engine PID N is dead; reconnecting in a loop, and the Admin UI shows No connected db. Re-run the prisma py fetch and prisma generate commands after every pip install --upgrade litellm.

#### spark-02 — generate the client master key

@@ -1323,9 +1345,17 @@

@@ -1347,31 +1377,40 @@

On spark-01, tail -f ~/sparky-ai-stack/logs/litellm.log shows nothing — your LiteLLM is not in the path. Instead, run docker logs --tail 20 vllm_node on spark-01 — you should see the new request reach the vLLM head. -

Step 3d — PostgreSQL for the client Admin UI and virtual keys (required)

-

Same constraint as Step 02: the LiteLLM Admin UI and virtual-key generation require PostgreSQL — SQLite is not supported because LiteLLM's Prisma schema is hardcoded for PostgreSQL. spark-02 doesn't run a docker-compose stack, so we use a standalone postgres container.

+

Step 3d — PostgreSQL and Prisma schema (spark-02)

+

The client LiteLLM needs its own independent Postgres database. Do not share spark-01's database — each side must have completely separate spend tracking, virtual keys, and Admin UI.

-

#### spark-02 — standalone postgres container

+

#### spark-02 — bring up the litellm-db container

bash
-
docker run -d --name litellm-db --restart unless-stopped \
+      
docker run -d \
+  --name litellm-db \
+  --restart unless-stopped \
+  -e POSTGRES_DB=litellm \
   -e POSTGRES_USER=litellm \
   -e POSTGRES_PASSWORD=litellm \
-  -e POSTGRES_DB=litellm \
-  -p 5432:5432 \
-  -v litellm_db:/var/lib/postgresql/data \
-  postgres:16
+ -v litellm-db:/var/lib/postgresql/data \ + --network host \ + postgres:16 + +# Wait for postgres to finish initialising +sleep 5 +docker exec litellm-db pg_isready -U litellm
+
+
+ +
Why --network host: The LiteLLM systemd service runs on the host network. Using host networking on the Postgres container means localhost:5432 resolves correctly from the service without extra bridge network configuration.
-

#### spark-02 — apply the Prisma schema

+

#### spark-02 — push the Prisma schema

+

Do not run prisma migrate deploylitellm-proxy-extras (now uninstalled) was responsible for that command, and its migration history conflicts on a fresh database. Use db push --force-reset instead, which creates the full schema in one shot with no migration history to conflict:

bash
-
pip install prisma --break-system-packages
-
+      
cd ~/.local/lib/python3.12/site-packages/litellm/proxy/
 DATABASE_URL="postgresql://litellm:litellm@localhost:5432/litellm" \
-  prisma db push \
-  --schema /home/YOUR_USERNAME/.local/lib/python3.12/site-packages/litellm/proxy/schema.prisma
+ prisma db push --schema schema.prisma --force-reset --skip-generate
-
Expected: Your database is now in sync with your Prisma schema.
+
Expected: 🚀 Your database is now in sync with your Prisma schema.

#### spark-02 — wire the database into the client litellm-config.yaml

database_url goes under general_settings, alongside the existing master_key. Add store_model_in_db: true under litellm_settings:

@@ -1384,12 +1423,30 @@

#### spark-02 — restart LiteLLM and verify

bash
-
sudo systemctl restart litellm
-sudo systemctl status litellm --no-pager
+
sudo systemctl restart litellm.service
+sleep 5
+sudo journalctl -u litellm.service -n 20 --no-pager | grep -iE 'startup|prisma|error'
+
+
Expected: INFO: Application startup complete. with no TableNotFoundError lines. A Unable to connect to DB. DATABASE_URL found in environment, but prisma package not found. warning may still appear on ARM64 — this is a false negative and does not prevent the proxy from functioning.
+ +

#### spark-02 — confirm the Admin UI has database access

+
+
bash
+
curl -s http://localhost:8001/ui 2>/dev/null | head -5
+# Navigate to http://SPARK02_IP:8001/ui in a browser
+# Virtual Keys page should show "Loading keys..." then display the table
+# (not "No connected db")
Client UI is at http://spark-02:8001/ui — log in with admin and the client master key. The client generates their own per-app virtual keys from the Virtual Keys tab; you never see them.
+ +
+ +
After upgrading LiteLLM on spark-02, re-run the prisma py fetch and prisma generate commands from Step 3a, then re-run the prisma db push --force-reset from this step, before restarting the service. Upgrades may change the schema; --force-reset is safe on the client node since no production data accumulates between upgrades.
+
+
If a virtual key was generated before the schema was fully applied (e.g. you generated a key, then re-ran prisma db push), the old key will appear in the UI but lookups will fail with Virtual key not found in LiteLLM_VerificationTokenTable. Delete it in the UI, restart LiteLLM, then generate a new one.
@@ -1438,6 +1495,18 @@

+ +
The OPENAI_API_KEY value must exactly match the master_key in spark-02's litellm-config.yaml. These two values are set independently — if they were ever different (for example, if Open WebUI was launched before the LiteLLM master key was set, or if it was copied from spark-01's config), every Open WebUI request will return 401 Unauthorized and chat will appear broken. To check: +
+
bash
+
grep master_key ~/sparky-ai-stack/litellm-config.yaml
+docker inspect open-webui | grep -i api_key
+
+ Both values must be identical. If they differ, stop and recreate the container with the correct key. +
+

+

#### spark-02 — directory and run

bash
@@ -2162,6 +2231,34 @@

Backup targets

+ +
+
ARM64: litellm-proxy-extras breaks fresh database migrations (spark-02 only)
+
SymptomTableNotFoundError: The table public.LiteLLM_Config does not exist in logs, "No connected db" in the Admin UI.
+
Causelitellm-proxy-extras is a companion package that ships with litellm[proxy] and intercepts the Prisma schema setup on startup, replacing the default db push path with prisma migrate deploy. On ARM64 Ubuntu 24.04 with a fresh database the migration history conflicts (type and column errors in migrations 20250329084805 and 20260224203854), leaving the schema incomplete.
+
FixUninstall the package immediately after installing litellm (see Step 03 install). The default db push path works correctly without it.
+
+ +
+
ARM64: prisma query engine binary not auto-downloaded (spark-02 only)
+
SymptomLiteLLM logs prisma-query-engine PID N is dead; reconnecting in a tight loop and the Admin UI shows No connected db.
+
CauseOn aarch64 (GB10/Grace CPU) the prisma query engine binary for linux-arm64-openssl-3.0.x is not downloaded automatically when litellm[proxy] is installed. The binary can be run directly and works correctly — the issue is only with LiteLLM's internal discovery of its location.
+
FixRun prisma py fetch with PRISMA_BINARY_TARGET=linux-arm64-openssl-3.0.x explicitly (see Step 03 install). Re-run after every pip install --upgrade litellm.
+
+ +
+
ARM64: DATABASE_URL must be in the systemd service environment (spark-02 only)
+
SymptomThe prisma query engine connects briefly then exits with engine_process_death reconnect loops.
+
CauseLiteLLM spawns the prisma query engine as a child process, and that child process reads DATABASE_URL from its own environment — not from litellm-config.yaml. On x86 this is typically set via Docker, but on bare-metal systemd the variable must be explicitly injected via a drop-in override.
+
FixSet DATABASE_URL in /etc/systemd/system/litellm.service.d/override.conf (see Step 03 systemd service).
+
+ +
+
Open WebUI OPENAI_API_KEY must match LiteLLM master_key exactly (spark-02)
+
SymptomEvery chat request returns 401 Unauthorized and chat appears broken.
+
CauseIf Open WebUI on spark-02 was launched before master_key was set in LiteLLM's config, or if the key was copied from spark-01's config, the two values drift. They are set independently in separate commands and are easy to let diverge.
+
FixStop and recreate the Open WebUI container with the correct key matching master_key in ~/sparky-ai-stack/litellm-config.yaml (see Step 05 callout).
+