- Add comprehensive deployment guide in CLAUDE.md - Quick deploy commands for News API - Version management strategy (Major/Minor/Patch) - Rollback procedures - Add detailed DEPLOYMENT.md for News API service - Update docker-compose.yml with SAPIENS platform services - Add sapiens-web with PostgreSQL (port 3005, 5433) - Add sapiens-web2 with PostgreSQL (port 3006, 5434) - Configure health checks and dependencies 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
131 lines
3.4 KiB
Markdown
131 lines
3.4 KiB
Markdown
# News API Deployment Guide
|
|
|
|
## 버전 관리 규칙
|
|
|
|
- **Major 버전** (v2.0.0): Breaking changes, API 스펙 변경
|
|
- **Minor 버전** (v1.1.0): 새로운 기능 추가, 하위 호환성 유지
|
|
- **Patch 버전** (v1.0.1): 버그 수정, 작은 개선
|
|
|
|
## 배포 프로세스
|
|
|
|
### 1. 버전 결정
|
|
```bash
|
|
# 현재 버전 확인
|
|
cd /Users/jungwoochoi/Desktop/prototype/site11
|
|
git tag | grep news-api | tail -5
|
|
|
|
# 다음 버전 결정
|
|
export VERSION=v1.1.0 # 적절한 버전으로 변경
|
|
```
|
|
|
|
### 2. Docker 이미지 빌드 및 푸시
|
|
```bash
|
|
cd /Users/jungwoochoi/Desktop/prototype/site11/services/news-api
|
|
|
|
# 버전 태그와 latest 태그 동시 생성
|
|
docker build -t yakenator/news-api:${VERSION} -t yakenator/news-api:latest -f backend/Dockerfile backend
|
|
|
|
# 두 태그 모두 푸시
|
|
docker push yakenator/news-api:${VERSION}
|
|
docker push yakenator/news-api:latest
|
|
```
|
|
|
|
### 3. Kubernetes 배포
|
|
```bash
|
|
# 배포 재시작 (latest 태그 사용 시)
|
|
kubectl -n site11-news rollout restart deployment news-api-deployment
|
|
|
|
# 특정 버전으로 배포 (optional)
|
|
kubectl -n site11-news set image deployment/news-api-deployment news-api=yakenator/news-api:${VERSION}
|
|
|
|
# 롤아웃 상태 확인
|
|
kubectl -n site11-news rollout status deployment news-api-deployment
|
|
|
|
# Pod 상태 확인
|
|
kubectl -n site11-news get pods -l app=news-api
|
|
```
|
|
|
|
### 4. 배포 검증
|
|
```bash
|
|
# Port forward 설정
|
|
kubectl -n site11-news port-forward svc/news-api-service 8050:8000 &
|
|
|
|
# Health check
|
|
curl http://localhost:8050/health
|
|
|
|
# API 테스트
|
|
curl 'http://localhost:8050/api/v1/ko/articles?page_size=5'
|
|
curl 'http://localhost:8050/api/v1/outlets?category=people'
|
|
curl 'http://localhost:8050/api/v1/ko/outlets/온유/articles?page_size=5'
|
|
```
|
|
|
|
### 5. Git 태그 생성 (optional)
|
|
```bash
|
|
cd /Users/jungwoochoi/Desktop/prototype/site11
|
|
|
|
# 태그 생성
|
|
git tag -a news-api-${VERSION} -m "News API ${VERSION}: outlet 다국어 지원 및 동적 기사 쿼리"
|
|
|
|
# 태그 푸시
|
|
git push origin news-api-${VERSION}
|
|
```
|
|
|
|
## 롤백 프로세스
|
|
|
|
### 이전 버전으로 롤백
|
|
```bash
|
|
# 이전 버전 확인
|
|
kubectl -n site11-news rollout history deployment news-api-deployment
|
|
|
|
# 이전 버전으로 롤백
|
|
kubectl -n site11-news rollout undo deployment news-api-deployment
|
|
|
|
# 특정 버전으로 롤백
|
|
kubectl -n site11-news set image deployment/news-api-deployment news-api=yakenator/news-api:v1.0.0
|
|
```
|
|
|
|
## 트러블슈팅
|
|
|
|
### Docker 빌드 실패
|
|
```bash
|
|
# Docker daemon 상태 확인
|
|
docker info
|
|
|
|
# Docker 재시작 (macOS)
|
|
killall Docker && open /Applications/Docker.app
|
|
```
|
|
|
|
### Port forward 문제
|
|
```bash
|
|
# 기존 port forward 종료
|
|
lsof -ti:8050 | xargs kill -9 2>/dev/null
|
|
|
|
# 새로운 port forward 시작
|
|
kubectl -n site11-news port-forward svc/news-api-service 8050:8000 &
|
|
```
|
|
|
|
### Pod 상태 확인
|
|
```bash
|
|
# Pod 로그 확인
|
|
kubectl -n site11-news logs -f deployment/news-api-deployment
|
|
|
|
# Pod 상세 정보
|
|
kubectl -n site11-news describe pod <pod-name>
|
|
|
|
# Pod 이벤트 확인
|
|
kubectl -n site11-news get events --sort-by='.lastTimestamp'
|
|
```
|
|
|
|
## 버전 히스토리
|
|
|
|
### v1.1.0 (2025-10-12)
|
|
- Outlet 다국어 지원 추가 (name_translations, description_translations)
|
|
- 동적 기사 쿼리 구현 (entities 필드 활용)
|
|
- 정적 articles 배열 제거, source_keyword 기반 동적 조회로 변경
|
|
|
|
### v1.0.0 (Initial Release)
|
|
- 다국어 기사 API (ko, en, zh_cn, zh_tw, ja, fr, de, es, it)
|
|
- Outlets 관리 (people, topics, companies)
|
|
- 댓글 시스템
|
|
- MongoDB 기반 데이터 저장
|