docs: update deploy path and file upload note

This commit is contained in:
Claude-51124 2025-12-17 18:55:00 +09:00
parent 4964d9da62
commit 0b53ead850
2 changed files with 19 additions and 17 deletions

View File

@ -56,7 +56,7 @@ docker compose down
- SSH 포트: 51124 (커스텀 포트) - SSH 포트: 51124 (커스텀 포트)
2. **정확한 경로**: 2. **정확한 경로**:
- 51124 서버: `/home/admin/ivada_project/skill-email` - 51124 서버: `/home/admin/ivada_project/skill_email` (디렉토리명 확인 필수)
- git pull 방식으로 코드 업데이트 - git pull 방식으로 코드 업데이트
#### 수정된 워크플로우 #### 수정된 워크플로우
@ -72,7 +72,7 @@ docker compose down
- name: Deploy to 51124 Server - name: Deploy to 51124 Server
run: | run: |
ssh -p 51124 -i ~/.ssh/deploy_key admin@${{ secrets.SSH_HOST_51124 }} << 'EOF' ssh -p 51124 -i ~/.ssh/deploy_key admin@${{ secrets.SSH_HOST_51124 }} << 'EOF'
cd /home/admin/ivada_project/skill-email cd /home/admin/ivada_project/skill_email
git pull origin main --rebase git pull origin main --rebase
docker compose down || echo "Container was not running" docker compose down || echo "Container was not running"
docker compose up -d --build docker compose up -d --build
@ -215,4 +215,4 @@ git push → Gitea Actions (51123) → SSH (포트 51124) → 51124 서버
--- ---
**문서 끝** **문서 끝**

View File

@ -36,20 +36,22 @@ coldmail_briefing.py:207에서 document_id를 attachment에 전달하지만, Sla
- `from app.api import upload, search, download` - `from app.api import upload, search, download`
- `app.include_router(download.router, prefix="/api", tags=["download"])` - `app.include_router(download.router, prefix="/api", tags=["download"])`
### 2단계: skill-slack 파일 업로드 API 추가 ### 2단계: skill-slack 파일 업로드 API 추가
**파일**: skill-slack/app/api/endpoints/files.py (신규) **파일**: skill-slack/app/api/endpoints/files.py (신규)
**import**: lists.py:4-9 참고 (FastAPI, settings, verify_api_key) **import**: lists.py:4-9 참고 (FastAPI, settings, verify_api_key)
- `from slack_sdk import WebClient` (test_lists_with_file.py:4) - `from slack_sdk import WebClient` (test_lists_with_file.py:4)
**router**: `@router.post("/files/upload", dependencies=[Depends(verify_api_key)])` **router**: `@router.post("/files/upload", dependencies=[Depends(verify_api_key)])`
**파라미터**: file (UploadFile), title (str), token (Optional[str]) **파라미터**: file (UploadFile), title (str), token (Optional[str])
**업로드**: test_lists_with_file.py:18, 21-24 패턴 **업로드**: test_lists_with_file.py:18, 21-24 패턴
- `client = WebClient(token or settings.SLACK_BOT_TOKEN)` - `client = WebClient(token or settings.SLACK_BOT_TOKEN)`
- 임시 파일 저장 → `client.files_upload_v2(file=temp_path, title=title)` - 임시 파일 저장 → `client.files_upload_v2(file=temp_path, title=title)`
- 업로드 후 임시 파일 삭제 - 업로드 후 임시 파일 삭제
**주의**: 임시 파일 저장 시 원본 filename 유지 필요 **주의**:
**반환**: `{"file_id": result["file"]["id"], "url_private": result["file"]["url_private"]}` - 임시 파일 경로에 원본 filename을 그대로 쓰면 `Errno 36 (File name too long)`로 실패할 수 있음 → `NamedTemporaryFile(delete=False, suffix=.pdf)` 등으로 안전한 temp 경로 사용
**에러**: HTTPException(400 or 500) - 원본 filename은 로그/메타데이터 용도로만 유지
**등록**: skill-slack/app/api/__init__.py:4, 13 수정 **반환**: `{"file_id": result["file"]["id"], "url_private": result["file"]["url_private"]}`
**에러**: HTTPException(400 or 500)
**등록**: skill-slack/app/api/__init__.py:4, 13 수정
### 3단계: coldmail_briefing.py 통합 ### 3단계: coldmail_briefing.py 통합