배포: .9 GPU 호스트용 compose(docker-compose.ai.yml), 문서 06 §12.1·11 §8·마피아 §13

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-11 03:38:05 +09:00
parent 13974181e7
commit c7dab689ca
4 changed files with 41 additions and 0 deletions

View File

@@ -73,3 +73,20 @@ deploy/
- 업데이트: `git pull && docker compose -f docker-compose.proxy.yml up -d --build`
- 확인: `curl http://192.168.10.5:2970/healthz`, `curl -I https://game.tkrmagid.kr/`
## 8. .9 GPU 호스트로 이전 + 로컬 AI 모델 (2026-10-11)
사이트를 .9(192.168.10.9, RTX 5050 8GB가 붙은 VM)의 도커로 옮겼다. 컴퓨터 플레이어가 GPU의 로컬 언어 모델로 말하고 사람처럼 움직인다(06 §12.1).
```
인터넷 → game.tkrmagid.kr → NPMplus 192.168.10.3:443 → 192.168.10.9:2970 → app:3000 ─→ Ollama(.9 호스트, GPU) :11434
```
- 코드: `/home/claude/projects/joke-app` (Gitea clone, `main`). 설정 `deploy/.env`(권한 600, .5에서 옮김). 데이터는 도커 볼륨 `joke-app_app-data`(.5의 DB를 멈춘 상태에서 그대로 복사).
- 실행(.9는 기본 도커 컨텍스트가 `docker5`라 꼭 `--context default`):
`cd /home/claude/projects/joke-app/deploy && docker --context default compose -f docker-compose.proxy.yml -f docker-compose.ai.yml up -d --build`
- `docker-compose.ai.yml`: `AI_URL=http://host.docker.internal:11434`, `AI_MODEL=gemma3:4b`, `host-gateway`, 메모리 1GB·CPU 2개 제한(.9에는 채팅 봇·데스크톱 서비스가 같이 돈다).
- 모델: 호스트의 시스템 서비스 `ollama`(이미 GPU 사용, `OLLAMA_HOST=0.0.0.0:11434`)에 `gemma3:4b`(3.3GB, Q4) — 후보 비교: exaone3.5:2.4b(0.25초, 말이 길고 영어 섞임), qwen2.5:7b(1.0초, 중국어 섞임), gemma3:4b(0.6초, 한국어가 가장 자연스러움). GPU 메모리: 음성 봇(whisper·melo) 약 3GB + gemma3 약 3.5GB.
- 모델이 꺼지거나 바쁘면(동시 2개, 대기 6개, 6초 제한, 3번 연속 실패 시 30초~5분 쉼) 컴퓨터는 예전처럼 조용히 두고 마피아는 정해 둔 대사를 쓴다. 게임이 모델을 기다리지 않는다.
- 확인: `curl http://192.168.10.9:2970/healthz` → `ai: { model, available, ok, failed, avgMs }`.
- NPMplus 프록시 호스트 id 10의 대상이 `192.168.10.9:2970`. 되돌리기: .5의 `joke-app-app-1`은 멈춰만 두었다(`docker compose -f docker-compose.proxy.yml start` 후 NPMplus 대상을 .5로).
- 업데이트: `git pull` 후 위 실행 명령. 이전 이미지를 `boardgame-site:rollback-<sha>`로 태그해 둔다.