From 8ce2d193967e23c051a5d87ad26924d828917c6b Mon Sep 17 00:00:00 2001 From: happybell80 Date: Fri, 26 Sep 2025 11:19:45 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20Gateway=20Redis=20=ED=86=B5=ED=95=A9=20?= =?UTF-8?q?=EB=B0=8F=20=EB=AC=B8=EC=84=9C=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 250809_happybell80_robing-gateway구현.md 수정 - UserCache(메모리)와 Redis(rate limiting) 구분 명시 - 250926_happybell80_gateway_redis_integration.md 신규 - Stats API 슬래시 문제 해결 - auth-redis 연결 설정 🤖 Generated with Claude Code Co-Authored-By: Claude --- ...250809_happybell80_robing-gateway구현.md | 10 ++-- ...6_happybell80_gateway_redis_integration.md | 60 +++++++++++++++++++ 2 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 troubleshooting/250926_happybell80_gateway_redis_integration.md diff --git a/troubleshooting/250809_happybell80_robing-gateway구현.md b/troubleshooting/250809_happybell80_robing-gateway구현.md index 72928ca..48a25cc 100644 --- a/troubleshooting/250809_happybell80_robing-gateway구현.md +++ b/troubleshooting/250809_happybell80_robing-gateway구현.md @@ -18,7 +18,8 @@ robeing-gateway/ ├── app/ │ ├── main.py # FastAPI 메인 앱 -│ ├── cache.py # 메모리 캐시 (30분 TTL) +│ ├── cache.py # UserCache 메모리 캐시 (30분 TTL) +│ ├── rate_limiter.py # Redis 기반 rate limiting │ ├── database.py # PostgreSQL 연결 │ └── models.py # SQLAlchemy 모델 ├── scripts/ @@ -31,9 +32,10 @@ robeing-gateway/ **핵심 기능**: 1. 사용자-로빙 매핑 관리 -2. 메모리 캐시로 성능 최적화 -3. 기존 main_db 테이블 활용 (workspaces, workspace_member) -4. 헬스체크 및 모니터링 엔드포인트 +2. UserCache(메모리)로 사용자 매핑 캐싱 +3. Redis(auth-redis)로 rate limiting +4. 기존 main_db 테이블 활용 (workspaces, workspace_member) +5. 헬스체크 및 모니터링 엔드포인트 ### 23서버팀 피드백 diff --git a/troubleshooting/250926_happybell80_gateway_redis_integration.md b/troubleshooting/250926_happybell80_gateway_redis_integration.md new file mode 100644 index 0000000..a27451e --- /dev/null +++ b/troubleshooting/250926_happybell80_gateway_redis_integration.md @@ -0,0 +1,60 @@ +# Gateway Redis 통합 및 Stats API 수정 + +## 날짜: 2025-09-26 +## 작성자: happybell80 +## 관련 서비스: robeing-gateway +## 상태: 해결 완료 + +--- + +## 1. 문제 발생 + +### Stats API URL 이중 슬래시 +- **증상**: Gateway → Monitor 요청 시 `///api/stats//rb8001` +- **원인**: MONITOR_URL과 MONITOR_STATUS_URI 연결 시 슬래시 중복 +- **위치**: `robeing-gateway/app/main.py:290` + +### 헬스체크 실패 +- **증상**: Actions에서 localhost:8100/healthz 연결 거부 +- **원인**: 컨테이너 시작 지연 + +--- + +## 2. 해결 방법 + +### Stats API 수정 +**서버 .env 수정**: +```bash +MONITOR_STATUS_URI=/api/stats # 앞 슬래시만 유지 +``` + +### Redis 연결 설정 +**서버 .env 추가**: +```bash +REDIS_HOST=auth-redis # auth-server의 Redis 컨테이너 공유 +REDIS_PORT=6379 +``` + +--- + +## 3. 아키텍처 + +### 캐시 구조 +- **UserCache**: 사용자-로빙 매핑 (메모리, 30분 TTL) +- **Redis**: Rate limiting (auth-redis 컨테이너) + +### 네트워크 +- 모든 컨테이너가 appnet 네트워크 공유 +- auth-redis:6379로 직접 통신 가능 + +--- + +## 4. 확인 방법 +```bash +docker inspect robeing-gateway auth-redis | grep -A2 "Networks" +``` + +## 5. 결과 +- ✅ Stats API 정상 작동 +- ✅ Redis 연결 성공 (rate limiting) +- ✅ 헬스체크 통과 \ No newline at end of file