security: NAS 마운트 검증 + AI 서비스 포트 제한 + deploy 문서 갱신
- NAS fail-fast: 시작 시 /documents/PKM 존재 확인, NFS 미마운트 방지 - ollama/ai-gateway 포트를 127.0.0.1로 제한 (외부 무인증 접근 차단) - deploy.md: Caddy HTTPS 자동발급 → 앞단 프록시 HTTPS 종료 구조 반영 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,15 @@ async def lifespan(app: FastAPI):
|
||||
# 시작: DB 연결 확인
|
||||
await init_db()
|
||||
|
||||
# NAS 마운트 확인 (NFS 미마운트 시 로컬 빈 디렉토리에 쓰는 것 방지)
|
||||
from pathlib import Path
|
||||
nas_check = Path(settings.nas_mount_path) / "PKM"
|
||||
if not nas_check.is_dir():
|
||||
raise RuntimeError(
|
||||
f"NAS 마운트 확인 실패: {nas_check} 디렉토리 없음. "
|
||||
f"NFS 마운트 상태를 확인하세요."
|
||||
)
|
||||
|
||||
# APScheduler: 백그라운드 작업
|
||||
scheduler = AsyncIOScheduler(timezone="Asia/Seoul")
|
||||
# 상시 실행
|
||||
|
||||
@@ -42,13 +42,13 @@ services:
|
||||
count: 1
|
||||
capabilities: [gpu]
|
||||
ports:
|
||||
- "11434:11434"
|
||||
- "127.0.0.1:11434:11434"
|
||||
restart: unless-stopped
|
||||
|
||||
ai-gateway:
|
||||
build: ./gpu-server/services/ai-gateway
|
||||
ports:
|
||||
- "8081:8080"
|
||||
- "127.0.0.1:8081:8080"
|
||||
environment:
|
||||
- PRIMARY_ENDPOINT=http://100.76.254.116:8800/v1/chat/completions
|
||||
- FALLBACK_ENDPOINT=http://ollama:11434/v1/chat/completions
|
||||
|
||||
@@ -64,11 +64,11 @@ curl http://localhost:3100/health
|
||||
|
||||
### 2-6. 외부 접근 (Caddy)
|
||||
|
||||
Caddy가 자동으로 HTTPS 인증서를 발급한다.
|
||||
- `document.hyungi.net` → FastAPI (:8000)
|
||||
HTTPS는 앞단 프록시(Mac mini nginx)에서 처리하고, Caddy는 HTTP only로 동작한다.
|
||||
- `document.hyungi.net` → Mac mini nginx (HTTPS 종료) → GPU 서버 Caddy (:8080) → FastAPI/Frontend
|
||||
- `office.hyungi.net` → Synology Office (NAS 프록시)
|
||||
|
||||
DNS 레코드가 Mac mini의 공인 IP를 가리켜야 한다.
|
||||
DNS 레코드가 Mac mini의 공인 IP를 가리켜야 한다. Caddy는 `auto_https off` 설정.
|
||||
|
||||
## 3. GPU 서버 배포
|
||||
|
||||
|
||||
Reference in New Issue
Block a user