diff --git a/troubleshooting/250915_skill-rag-file_초기_구축.md b/troubleshooting/250915_skill-rag-file_초기_구축.md new file mode 100644 index 0000000..e7d54a2 --- /dev/null +++ b/troubleshooting/250915_skill-rag-file_초기_구축.md @@ -0,0 +1,50 @@ +# skill-rag-file RAG 시스템 초기 구축 + +## 작성일: 2025-09-15 +## 작성자: Claude (51123 서버 관리자) +## 관련 문서: [RAG 파일 처리 아키텍처](../ideas/250909_RAG_file_processing_architecture.md) + +## 1. 구현 사항 + +### PostgreSQL 테이블 생성 (51123) +- **테이블명**: team_document +- **주요 컬럼**: team_id, filename, file_hash, storage_path, text_content, metadata +- **인덱스**: idx_team_doc_hash (team_id, file_hash) UNIQUE +- **외래키**: team_id → team(id) +- **metadata 활용**: uploaded_by를 JSONB에 저장 (삼각형 의존성 회피) + +### 파일 저장 구조 설정 +- **51123 디렉토리**: /mnt/hdd/data/documents/ +- **51124 마운트**: /mnt/51123data/ (SSHFS) +- **SSHFS 명령**: `sshfs -o IdentityFile=/home/admin/.ssh/id_rsa_deploy,reconnect,uid=$(id -u),gid=$(id -g) admin@192.168.219.45:/mnt/hdd/data /mnt/51123data -p 51123` +- **권한**: admin:xusers (읽기/쓰기 가능) + +### 서비스 구성 +- **서비스명**: skill-rag-file +- **포트**: 8508 +- **저장 경로**: /mnt/51123data/documents/{team_id}/YYYY-MM/ +- **Gitea 레포**: https://git.ro-being.com/ivada_Ro-being/skill-rag-file + +## 2. 핵심 결정 사항 + +### 저장 위치 변경 +- **기존 계획**: /mnt/hdd/uploads/ +- **변경**: /mnt/hdd/data/documents/ (업계 표준 준수) +- **이유**: data/ 구조가 더 확장 가능 (logs/, models/ 추가 가능) + +### uploaded_by 처리 +- **문제**: user → team, team_document → team, team_document → user (삼각형) +- **해결**: uploaded_by 컬럼 제거, metadata JSONB에 기록 +- **조회**: `metadata->>'uploaded_by'` + +### SSHFS 활용 +- **기존**: /mnt/51123logs (로그 전용) +- **추가**: /mnt/51123data (데이터/문서 전용) +- **장점**: 51124 로컬 쓰기 → 51123 HDD 직접 저장 + +## 3. 다음 단계 +1. skill-rag-file 프로젝트 구조 설정 +2. FastAPI 기본 서버 구현 (/upload, /search, /healthz) +3. PyPDF2, python-docx 텍스트 추출 +4. ChromaDB team_{team_id}_documents 컬렉션 설정 +5. Docker 컨테이너화 (포트 8508) \ No newline at end of file