diff --git a/index.html b/index.html index 8b7d47a..92bd47c 100644 --- a/index.html +++ b/index.html @@ -1258,7 +1258,29 @@
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.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.
- 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.
+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.
-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
+ --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.Do not run prisma migrate deploy — litellm-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:
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
Your database is now in sync with your Prisma schema.🚀 Your database is now in sync with your Prisma schema.database_url goes under general_settings, alongside the existing master_key. Add store_model_in_db: true under litellm_settings:
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'
+ 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.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")
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.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.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.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:
+ grep master_key ~/sparky-ai-stack/litellm-config.yaml
+docker inspect open-webui | grep -i api_key
+ litellm-proxy-extras breaks fresh database migrations (spark-02 only)TableNotFoundError: The table public.LiteLLM_Config does not exist in logs, "No connected db" in the Admin UI.litellm-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.db push path works correctly without it.prisma-query-engine PID N is dead; reconnecting in a tight loop and the Admin UI shows No connected db.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.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.DATABASE_URL must be in the systemd service environment (spark-02 only)engine_process_death reconnect loops.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.DATABASE_URL in /etc/systemd/system/litellm.service.d/override.conf (see Step 03 systemd service).OPENAI_API_KEY must match LiteLLM master_key exactly (spark-02)401 Unauthorized and chat appears broken.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.master_key in ~/sparky-ai-stack/litellm-config.yaml (see Step 05 callout).