feat(gateway): Docker Gateway 봇 + HTTP API 구현 #task-311

- gateway.py: Collector↔Gateway HTTP API (pending, response, chat, register, commands)
- Dockerfile + docker-compose.yml: BOT_MODE=gateway, port 8585
- main.py: gateway 모드 (watcher 비활성, GatewayAPI 시작)
- config.py: gateway 모드 BRAIN_PATH 검증 스킵
- requirements.txt: aiohttp 추가
- docs/usage-guide.md: Docker 배포 섹션 추가
- Extension VSIX v0.3.9 빌드 (auto-approve 포함)
This commit is contained in:
Variet Worker
2026-03-11 19:38:26 +09:00
parent c1303999cf
commit 6dbbb57fa7
10 changed files with 326 additions and 27 deletions

View File

@@ -101,7 +101,8 @@ auto-approve | 1741678...
| 모드 | 설정 | 설명 |
|------|------|------|
| `local` (기본) | `BOT_MODE=local` | 로컬 파일시스템 bridge 사용 |
| `remote` (미래) | `BOT_MODE=remote` | HTTP로 원격 bridge 폴링 (미구현) |
| `remote` (미래) | `BOT_MODE=remote` | HTTP로 원격 bridge 폴링 (Collector 모드) |
| `gateway` | `BOT_MODE=gateway` | 서버에서 Discord 통신 + HTTP API (Docker용) |
---
@@ -118,6 +119,38 @@ DEBOUNCE_SECONDS=2 # 이벤트 디바운스 (초)
---
## Docker 배포 (Gateway)
서버에서 Gateway 봇을 Docker로 실행:
```
[로컬 PC] [서버 Docker]
Extension → bridge/ ← 로컬 Bot ──HTTP──→ Gateway :8585 ←→ Discord
(Collector)
```
### 서버에서 실행
```bash
git clone https://git.variet.net/Variet/gravity_control.git
cd gravity_control
cp .env.example .env # DISCORD_TOKEN, DISCORD_GUILD_ID 입력
docker compose up -d
docker compose logs -f # 로그 확인
```
### Gateway API
| 메서드 | 경로 | 설명 |
|--------|------|------|
| GET | `/health` | 헬스체크 |
| POST | `/api/pending` | Collector → 승인 요청 |
| GET | `/api/response/{rid}` | Collector ← 승인 응답 |
| POST | `/api/chat` | Collector → 채팅 스냅샷 |
| GET | `/api/commands/{project}` | Collector ← 명령 폴링 |
---
## 트러블슈팅
| 증상 | 해결 |