# News Engine Console 뉴스 파이프라인 관리 및 모니터링 통합 콘솔 시스템 ## 프로젝트 개요 News Engine Console은 뉴스 파이프라인의 전체 lifecycle을 관리하고 모니터링하는 통합 관리 시스템입니다. ### 핵심 기능 1. **키워드 관리** - 파이프라인 키워드 CRUD, 활성화/비활성화 2. **파이프라인 모니터링** - 파이프라인별 처리 수량, 활용도 통계 3. **파이프라인 제어** - 스텝별 시작/중지, 스케줄링 4. **로깅 시스템** - 파이프라인 상태 로그, 에러 추적 5. **사용자 관리** - User CRUD, 역할 기반 권한 (Admin/Editor/Viewer) 6. **애플리케이션 관리** - OAuth2/JWT 기반 Application CRUD 7. **시스템 모니터링** - 서비스 헬스체크, 리소스 사용량 ## 기술 스택 ### Backend - FastAPI (Python 3.11) - Motor (MongoDB async driver) - Redis (캐싱, Pub/Sub) - JWT + OAuth2 인증 ### Frontend (예정) - React 18 + TypeScript - Material-UI v7 - React Query - Recharts (통계 차트) ### Infrastructure - Docker - Kubernetes - MongoDB (ai_writer_db) - Redis ## 프로젝트 구조 ``` services/news-engine-console/ ├── README.md ├── TODO.md # 상세 구현 계획 ├── backend/ │ ├── Dockerfile │ ├── requirements.txt │ ├── main.py │ ├── .env.example │ └── app/ │ ├── api/ # API 엔드포인트 │ │ ├── keywords.py # ✅ 키워드 관리 │ │ ├── pipelines.py # ✅ 파이프라인 제어/모니터링 │ │ ├── users.py # ✅ 사용자 관리 │ │ ├── applications.py # ✅ Application 관리 │ │ └── monitoring.py # ✅ 시스템 모니터링 │ ├── core/ # 핵심 설정 │ │ ├── config.py # ✅ 설정 관리 │ │ ├── database.py # ✅ MongoDB 연결 │ │ └── auth.py # ✅ JWT/OAuth2 인증 │ ├── models/ # 데이터 모델 (TODO) │ ├── services/ # 비즈니스 로직 (TODO) │ └── schemas/ # Pydantic 스키마 (TODO) ├── frontend/ # TODO │ └── src/ │ ├── api/ │ ├── components/ │ ├── pages/ │ └── types/ └── k8s/ # TODO ├── namespace.yaml ├── backend-deployment.yaml ├── frontend-deployment.yaml └── service.yaml ``` ## 현재 구현 상태 ### ✅ 완료 - [x] 프로젝트 디렉토리 구조 - [x] Backend 기본 설정 (config, database, auth) - [x] API 라우터 기본 구조 (5개 라우터) - Keywords API - Pipelines API - Users API - Applications API - Monitoring API ### 🚧 진행 중 - [ ] Backend 상세 구현 (models, services, schemas) - [ ] MongoDB 컬렉션 및 인덱스 설계 - [ ] Redis 연결 및 캐싱 로직 ### 📋 예정 - [ ] Frontend 구현 - [ ] Dockerfile 작성 - [ ] Kubernetes 배포 설정 - [ ] CI/CD 파이프라인 - [ ] API 문서 (OpenAPI/Swagger) ## API 엔드포인트 ### Keywords API (`/api/v1/keywords`) - `GET /` - 키워드 목록 조회 - `POST /` - 키워드 생성 - `PUT /{keyword_id}` - 키워드 수정 - `DELETE /{keyword_id}` - 키워드 삭제 ### Pipelines API (`/api/v1/pipelines`) - `GET /` - 파이프라인 목록 및 상태 - `GET /{pipeline_id}/stats` - 파이프라인 통계 - `POST /{pipeline_id}/start` - 파이프라인 시작 - `POST /{pipeline_id}/stop` - 파이프라인 중지 ### Users API (`/api/v1/users`) - `GET /` - 사용자 목록 - `POST /` - 사용자 생성 - `GET /me` - 현재 사용자 정보 ### Applications API (`/api/v1/applications`) - `GET /` - Application 목록 - `POST /` - Application 생성 (OAuth2 클라이언트 등록) ### Monitoring API (`/api/v1/monitoring`) - `GET /system` - 시스템 상태 - `GET /logs` - 파이프라인 로그 ## 로컬 개발 환경 설정 ### Prerequisites - Python 3.11+ - MongoDB (localhost:27017) - Redis (localhost:6379) ### Backend 실행 ```bash cd services/news-engine-console/backend # 가상환경 생성 (선택) python3 -m venv venv source venv/bin/activate # 의존성 설치 pip install -r requirements.txt # 환경 변수 설정 cp .env.example .env # .env 파일 수정 # 서버 실행 python main.py ``` 서버 실행 후: http://localhost:8100/docs (Swagger UI) ## 환경 변수 ```env # MongoDB MONGODB_URL=mongodb://localhost:27017 DB_NAME=ai_writer_db # Redis REDIS_URL=redis://localhost:6379 # JWT SECRET_KEY=your-secret-key-here ALGORITHM=HS256 ACCESS_TOKEN_EXPIRE_MINUTES=30 # Service SERVICE_NAME=news-engine-console API_V1_STR=/api/v1 PORT=8100 # CORS ALLOWED_ORIGINS=http://localhost:3000,http://localhost:3100 ``` ## 다음 단계 (TODO.md 참조) ### Phase 1: Backend 완성 (우선순위 높음) 1. MongoDB 스키마 설계 - keywords 컬렉션 - pipelines 컬렉션 - users 컬렉션 - applications 컬렉션 - logs 컬렉션 2. Pydantic 모델 및 스키마 작성 - Request/Response 모델 - 유효성 검증 3. 비즈니스 로직 구현 - KeywordService - PipelineService - UserService - ApplicationService - MonitoringService 4. Redis 통합 - 캐싱 레이어 - Pub/Sub for real-time updates ### Phase 2: Frontend 구현 1. React 프로젝트 설정 2. Material-UI 레이아웃 3. 페이지 구현 - Dashboard (통계 요약) - Keywords Management - Pipelines Control - Users Management - Applications Management - System Monitoring ### Phase 3: 배포 1. Dockerfile 작성 2. Kubernetes 매니페스트 3. CI/CD 설정 ## 데이터베이스 설계 (Draft) ### keywords 컬렉션 ```json { "_id": "ObjectId", "keyword": "string", "category": "string", "status": "active|inactive", "created_at": "datetime", "updated_at": "datetime", "created_by": "user_id" } ``` ### pipelines 컬렉션 ```json { "_id": "ObjectId", "name": "string", "type": "rss|translation|image", "status": "running|stopped|error", "config": {}, "stats": { "total_processed": 0, "success_count": 0, "error_count": 0, "last_run": "datetime" } } ``` ### users 컬렉션 ```json { "_id": "ObjectId", "username": "string", "email": "string", "hashed_password": "string", "full_name": "string", "role": "admin|editor|viewer", "disabled": false, "created_at": "datetime" } ``` ## 역할 기반 권한 - **Admin**: 모든 기능 접근 - **Editor**: 키워드/파이프라인 관리, 모니터링 조회 - **Viewer**: 조회만 가능 ## 기여 가이드 1. 기능 구현 전 TODO.md 확인 2. API 엔드포인트 추가 시 문서 업데이트 3. 테스트 코드 작성 4. Commit 메시지 규칙 준수 ## 라이선스 Part of Site11 Platform - Internal Use --- **최종 업데이트**: 2024-01-15 **버전**: 0.1.0 (Alpha) **작성자**: Site11 Development Team