24 lines
840 B
Bash
24 lines
840 B
Bash
#!/usr/bin/env bash
|
|
# Copy host "ai-insight/chroma_db" into the running rag container volume.
|
|
# Named volume rag-chroma mounts over the image-baked index — seed after first up.
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
SRC="$ROOT/ai-insight/chroma_db"
|
|
CID="${RAG_CONTAINER:-dashboard-cpsp-rag}"
|
|
|
|
if [[ ! -d "$SRC" ]]; then
|
|
echo "Missing $SRC — run: cd ai-insight && python populate_db.py" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! docker inspect "$CID" >/dev/null 2>&1; then
|
|
echo "Container $CID not found. Start with: docker compose up -d rag" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Seeding Chroma into $CID:/app/chroma_db from $SRC"
|
|
docker exec "$CID" sh -c 'rm -rf /app/chroma_db/* /app/chroma_db/.[!.]* 2>/dev/null || true'
|
|
docker cp "$SRC/." "$CID:/app/chroma_db/"
|
|
docker restart "$CID"
|
|
echo "Done. Check: curl -fsS http://127.0.0.1:5002/health"
|