동작하는 최소 코드 수준의 v2 스캐폴딩: - docker-compose.yml: postgres, fastapi, kordoc, frontend, caddy - app/: FastAPI 백엔드 (main, core, models, ai, prompts) - services/kordoc/: Node.js 문서 파싱 마이크로서비스 - gpu-server/: AI Gateway + GPU docker-compose - frontend/: SvelteKit 기본 구조 - migrations/: PostgreSQL 초기 스키마 (documents, tasks, processing_queue) - tests/: pytest conftest 기본 설정 - config.yaml, Caddyfile, credentials.env.example 갱신 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""hyungi_Document_Server — FastAPI 엔트리포인트"""
|
|
|
|
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import FastAPI
|
|
|
|
from core.config import settings
|
|
from core.database import init_db
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
"""앱 시작/종료 시 실행되는 lifespan 핸들러"""
|
|
# 시작: DB 연결, 스케줄러 등록
|
|
await init_db()
|
|
# TODO: APScheduler 시작 (Phase 3)
|
|
yield
|
|
# 종료: 리소스 정리
|
|
# TODO: 스케줄러 종료, DB 연결 해제
|
|
|
|
|
|
app = FastAPI(
|
|
title="hyungi_Document_Server",
|
|
description="Self-hosted PKM 웹 애플리케이션 API",
|
|
version="2.0.0",
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
|
|
@app.get("/health")
|
|
async def health_check():
|
|
return {"status": "ok", "version": "2.0.0"}
|
|
|
|
|
|
# TODO: 라우터 등록 (Phase 0~2)
|
|
# from api import documents, search, tasks, dashboard, export
|
|
# app.include_router(documents.router, prefix="/api/documents", tags=["documents"])
|
|
# app.include_router(search.router, prefix="/api/search", tags=["search"])
|
|
# app.include_router(tasks.router, prefix="/api/tasks", tags=["tasks"])
|
|
# app.include_router(dashboard.router, prefix="/api/dashboard", tags=["dashboard"])
|
|
# app.include_router(export.router, prefix="/api/export", tags=["export"])
|