# Deployment Handoff — Resume Here

## Where We Left Off

Phase 2 (AI stack) is fully deployed and verified on PlausibleDeniability (10.5.30.6). We were about to verify Gotify (Phase 1) and then deploy n8n (Phase 3).

## What's Done

### Phase 2 — AI Stack (COMPLETE)
All 6 containers running and verified on PD (10.5.30.6):
- **Ollama:** port 11434 — qwen2.5:14b loaded
- **OpenWebUI:** port 8282 (→8080)
- **Qdrant:** port 6333 (HTTP), 6334 (gRPC)
- **LiteLLM:** port 4000 — auth working, inference verified (medium tier → qwen2.5:14b)
- **Reranker (TEI):** port 8787 (→80) — bge-reranker-v2-m3 via safetensors
- **Whisper:** port 8786 (→8000)

### Key Fixes Applied (reference for future troubleshooting)
1. **TrueNAS Scale Docker quirk:** `curl localhost:PORT` returns 000. Always use `curl 10.5.30.6:PORT`.
2. **Reranker image:** Use `cpu-latest` not `cpu-1.5` (hf-hub bug).
3. **LiteLLM config:** Remove `database_url` (newer versions try Prisma/PostgreSQL). Set `master_key: "os.environ/LITELLM_MASTER_KEY"` to read from env var.

### Phase 1 — Gotify (DEPLOYED, NOT VERIFIED)
Gotify was deployed previously but hasn't been verified this session.

## What's Next (in order)

### 1. Verify Gotify
Run these on PD and confirm output:
```bash
docker ps --filter name=gotify --format "table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}"
docker logs gotify --tail 20
docker inspect gotify --format '{{json .Mounts}}' | python3 -m json.tool
docker inspect gotify --format '{{json .NetworkSettings.Networks}}' | python3 -m json.tool
curl -sw "\n%{http_code}" http://10.5.30.6:8484/health
ls -la /mnt/docker-ssd/docker/compose/automation/
cat /mnt/docker-ssd/docker/compose/automation/docker-compose.yaml
```

### 2. Deploy n8n (Phase 3)
Per HOMELAB_BUILDOUT_PLAN.md Phase 3:
- Create postgres user/db for n8n on shared-postgres
- Scaffold `/mnt/tank/docker/appdata/n8n` (chown 1000:1000)
- Update automation compose to add n8n alongside Gotify
- Generate secrets for .env (N8N_DB_PASS, N8N_ENCRYPTION_KEY)
- Deploy and verify (DB migration, network connectivity, UI access)

### 3. Pending Config (do whenever)
- OpenWebUI → add LiteLLM as OpenAI connection (`http://litellm:4000/v1`)
- OpenWebUI → optionally set RAG vector DB to Qdrant (`http://qdrant:6333`)

## Network Reference
| Network | Purpose |
|---------|---------|
| ai-services | Cross-stack: AI containers ↔ n8n, future services |
| ix-databases_shared-databases | Shared postgres/redis access |
| pangolin | Reverse proxy / external exposure |

## Machine IPs
- **PlausibleDeniability (PD):** 10.5.30.6 — TrueNAS Scale, RTX 2080 Ti
- **ROCINANTE:** 10.5.30.112 — RTX 4090
- **N.O.M.A.D.:** 10.5.30.7 — Ubuntu, GTX 1080

## LiteLLM .env Secrets (on PD at /mnt/docker-ssd/docker/compose/ai/.env)
Already configured — do not regenerate. Master key is in the .env file as LITELLM_MASTER_KEY.
