docs: auth_db를 main_db로 일괄 변경

- 모든 문서에서 auth_db 참조를 main_db로 업데이트
- 데이터베이스 이름 변경 반영
- 트러블슈팅 및 아키텍처 문서 수정

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
happybell80 2025-08-20 23:21:20 +09:00
parent 2c8e99fbda
commit bb8900300a
19 changed files with 37 additions and 37 deletions

View File

@ -195,7 +195,7 @@ sshpass -p "19800508" ssh -o StrictHostKeyChecking=no -f -N \
**최종 설정**:
```bash
# .env
DATABASE_URL=postgresql://robeings:robeings@localhost:5433/auth_db
DATABASE_URL=postgresql://robeings:robeings@localhost:5433/main_db
PORT=8507
```
@ -310,7 +310,7 @@ curl http://localhost:8507/health
ps aux | grep "5433:localhost:5432"
# PostgreSQL 접속 테스트
PGPASSWORD=19800508 psql -h localhost -p 5433 -U admin -d auth_db
PGPASSWORD=19800508 psql -h localhost -p 5433 -U admin -d main_db
```
---

View File

@ -212,7 +212,7 @@ async def compose_email(request):
Host: 124.55.18.179
Port: 51123
User: heejae
Database: auth_db
Database: main_db
PostgreSQL User: robeings/robeings
```

View File

@ -11,7 +11,7 @@
```bash
Host: localhost
Port: 5432
Database: auth_db
Database: main_db
User: robeings
Password: robeings
```
@ -194,7 +194,7 @@ from psycopg2.extras import RealDictCursor
# 연결
conn = psycopg2.connect(
host="localhost",
database="auth_db",
database="main_db",
user="robeings",
password="robeings"
)

View File

@ -22,7 +22,7 @@
## 데이터베이스 정보
- **Host**: 192.168.219.45 (51123 서버)
- **Port**: 5432
- **Database**: auth_db
- **Database**: main_db
- **User**: robeings
- **Password**: robeings

View File

@ -1,7 +1,7 @@
# PostgreSQL 테이블 구조
## 작성일: 2025-08-20
## 데이터베이스: auth_db
## 데이터베이스: main_db
---

View File

@ -1,7 +1,7 @@
# auth-server 데이터베이스 스키마
**날짜**: 2025-07-29
**데이터베이스**: auth_db (PostgreSQL)
**데이터베이스**: main_db (PostgreSQL)
**목적**: 멀티테넌트 B2B Slack 봇 인증 관리 시스템
## 개요

View File

@ -87,7 +87,7 @@
```sql
-- PostgreSQL@51123:5432
├── auth_db (기존)
├── main_db (기존)
│ ├── companies
│ └── slack_workspaces
@ -117,7 +117,7 @@ WS /ws/robbing/realtime # 실시간 상태 업데이트
**위치**: auth-server 내장 또는 별도 React 앱
**데이터 저장**:
- 회사 정보: PostgreSQL `auth_db.companies`
- 회사 정보: PostgreSQL `main_db.companies`
- 세션 관리: JWT 토큰
- OAuth 토큰: 파일시스템 `/tokens/`

View File

@ -8,7 +8,7 @@
### 1.1 미사용 테이블 현황
```sql
-- auth_db에 존재하지만 전혀 사용되지 않는 테이블들
-- main_db에 존재하지만 전혀 사용되지 않는 테이블들
conversation_logs: 0 records (0 KB)
robing_stats: 0 records (0 KB)
robing_settings: 0 records (0 KB)

View File

@ -178,7 +178,7 @@ CREATE TABLE user_identity_mapping (
### slack_user_mapping 테이블 검증 완료
#### 데이터베이스 상태
- **테이블 존재**: ✅ auth_db.slack_user_mapping
- **테이블 존재**: ✅ main_db.slack_user_mapping
- **정확한 매핑 데이터**:
```
U0925SXQFDK → aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa → 김종태

View File

@ -2,7 +2,7 @@
## 현재 구조 분석
### 1. 데이터베이스 (PostgreSQL - auth_db)
### 1. 데이터베이스 (PostgreSQL - main_db)
#### Users 테이블 구조
```sql
@ -294,7 +294,7 @@ email ↔ slack_id ↔ username
- 결과: 동일 username으로 통합 메모리
```
**관련 문서**: [Auth DB 테이블 구조 단순화 방안](/plans/250812_auth_db_테이블_단순화_방안.md)
**관련 문서**: [Auth DB 테이블 구조 단순화 방안](/plans/250812_main_db_테이블_단순화_방안.md)
##### 현재 테이블 구조 (5개)
- **users**: 사용자 기본 정보 (email, username)

View File

@ -334,7 +334,7 @@ POSTGRES_HOST=192.168.219.45
POSTGRES_PORT=5432
# 공통
POSTGRES_DB=auth_db
POSTGRES_DB=main_db
POSTGRES_USER=robeings
POSTGRES_PASSWORD=robeings
```
@ -344,16 +344,16 @@ POSTGRES_PASSWORD=robeings
# rb8001 (51124 서버)
SKILL_EMAIL_URL=http://localhost:8501 # host 모드이므로 localhost
STATE_SERVICE_URL=http://localhost:9024
DATABASE_URL=postgresql://robeings:robeings@192.168.219.45:5432/auth_db
DATABASE_URL=postgresql://robeings:robeings@192.168.219.45:5432/main_db
# skill-email (51124 서버)
TOKEN_PROVIDER=database # file → database
POSTGRES_CONNECTION_STRING=postgresql://robeings:robeings@192.168.219.45:5432/auth_db
POSTGRES_CONNECTION_STRING=postgresql://robeings:robeings@192.168.219.45:5432/main_db
# robeing-monitor (51124 서버)
PORT=9024
SERVICE_NAME=robeing-monitor
DATABASE_URL=postgresql://robeings:robeings@192.168.219.45:5432/auth_db
DATABASE_URL=postgresql://robeings:robeings@192.168.219.45:5432/main_db
```
---

View File

@ -10,7 +10,7 @@
## 현재 진행 중인 계획들
### 1. Slack 통합 개선
- `250812_auth_db_테이블_단순화_방안.md` - DB 구조 개선 계획
- `250812_main_db_테이블_단순화_방안.md` - DB 구조 개선 계획
- `250812_로컬개발자_Slack사용자매핑_구현계획.md` - Slack 사용자 매핑 구현
### 2. 서비스 구조화

View File

@ -28,7 +28,7 @@ SKILL_EMAIL_URL=http://localhost:8501
MONITOR_SERVICE_URL=http://localhost:9024
# PostgreSQL for Gmail tokens (SSH tunnel)
POSTGRES_CONNECTION_STRING=postgresql://robeings:robeings@localhost:5433/auth_db
POSTGRES_CONNECTION_STRING=postgresql://robeings:robeings@localhost:5433/main_db
```
### 2.2 Gmail 통합 모듈 구현
@ -370,7 +370,7 @@ curl -X POST http://localhost:8501/process \
# PostgreSQL 장착 상태 확인
python3 -c "
import psycopg2
conn = psycopg2.connect('postgresql://robeings:robeings@localhost:5433/auth_db')
conn = psycopg2.connect('postgresql://robeings:robeings@localhost:5433/main_db')
cur = conn.cursor()
cur.execute('SELECT user_id, is_equipped FROM gmail_tokens')
for row in cur.fetchall():

View File

@ -36,7 +36,7 @@ PORT=8501
TOKEN_PROVIDER=database
# PostgreSQL Connection (SSH tunnel)
POSTGRES_CONNECTION_STRING=postgresql://robeings:robeings@localhost:5433/auth_db
POSTGRES_CONNECTION_STRING=postgresql://robeings:robeings@localhost:5433/main_db
# Service Name
SERVICE_NAME=skill-email
@ -195,7 +195,7 @@ sshpass -p "19800508" ssh -f -N -L 5433:localhost:5432 admin@124.55.18.179 -p 51
- 로컬 포트 5433 → 원격 PostgreSQL 5432
- 51123 서버 (124.55.18.179)의 PostgreSQL 접근
- auth_db 데이터베이스 사용
- main_db 데이터베이스 사용
---
@ -326,7 +326,7 @@ sshpass -p "19800508" ssh -f -N -L 5433:localhost:5432 admin@124.55.18.179 -p 51
# 토큰 상태 확인
python3 -c "
import psycopg2
conn = psycopg2.connect('postgresql://robeings:robeings@localhost:5433/auth_db')
conn = psycopg2.connect('postgresql://robeings:robeings@localhost:5433/main_db')
cur = conn.cursor()
cur.execute('SELECT user_id, is_equipped FROM gmail_tokens')
for row in cur.fetchall():

View File

@ -189,7 +189,7 @@ Claude가 세션 시작 시 규칙을 제대로 따르지 않음. CLAUDE.md 재
- nginx를 통한 https://auth.ro-being.com 프록시 설정 확인
- JWT/OAuth 키 관리 상태 점검
2. **PostgreSQL auth_db 스키마 분석**:
2. **PostgreSQL main_db 스키마 분석**:
- `companies` 테이블: 회사별 서브도메인 관리 (2개 회사 등록)
- `slack_workspaces` 테이블: Slack 봇 토큰 관리 (2개 워크스페이스 활성)
- 멀티테넌트 B2B SaaS 구조 확인

View File

@ -14,7 +14,7 @@ sshpass -p '19800508' ssh -N -L 5433:localhost:5432 admin@124.55.18.179 -p 51123
### 2. .env 파일 설정
```bash
# /home/heejae/robing-state-service/.env
DATABASE_URL=postgresql://robeings:robeings@localhost:5433/auth_db
DATABASE_URL=postgresql://robeings:robeings@localhost:5433/main_db
SERVICE_NAME=state
PORT=8002
LOG_LEVEL=INFO
@ -23,7 +23,7 @@ LOG_LEVEL=INFO
### 3. 연결 확인
```bash
# psql로 테스트
psql postgresql://robeings:robeings@localhost:5433/auth_db -c "SELECT 1"
psql postgresql://robeings:robeings@localhost:5433/main_db -c "SELECT 1"
```
## 연결 정보
@ -33,7 +33,7 @@ psql postgresql://robeings:robeings@localhost:5433/auth_db -c "SELECT 1"
- **SSH 비밀번호**: 19800508
- **PostgreSQL 사용자**: robeings
- **PostgreSQL 비밀번호**: robeings
- **데이터베이스**: auth_db
- **데이터베이스**: main_db
## 주의사항
1. SSH 터널은 백그라운드에서 실행되므로 시스템 재시작 시 다시 생성 필요

View File

@ -32,13 +32,13 @@ robing-gateway/
**핵심 기능**:
1. 사용자-로빙 매핑 관리
2. 메모리 캐시로 성능 최적화
3. 기존 auth_db 테이블 활용 (workspaces, workspace_members)
3. 기존 main_db 테이블 활용 (workspaces, workspace_members)
4. 헬스체크 및 모니터링 엔드포인트
### 23서버팀 피드백
**중요 변경사항 - 새 테이블 불필요**:
- 기존 auth_db의 workspaces, workspace_members 테이블 활용
- 기존 main_db의 workspaces, workspace_members 테이블 활용
- workspace_members에서 user_id로 robing 정보 조회
- JOIN 쿼리로 사용자 → 워크스페이스 → 로빙 매핑
@ -81,7 +81,7 @@ body = {
**해결**:
```yaml
# .env.example 수정
DATABASE_URL=postgresql+asyncpg://robeings:패스워드@host.docker.internal:5432/auth_db
DATABASE_URL=postgresql+asyncpg://robeings:패스워드@host.docker.internal:5432/main_db
```
### 문제 4: Gitea Actions 환경변수
@ -108,7 +108,7 @@ SELECT COUNT(*) FROM workspaces; # 2 (테스트 데이터)
**현재 상태**:
- robing-gateway 포트 8100에서 정상 실행
- PostgreSQL auth_db 연결 성공
- PostgreSQL main_db 연결 성공
- DEFAULT_ROBING_ID: rb10508_micro 설정
- 메모리 캐시 활성화 (30분 TTL)

View File

@ -304,17 +304,17 @@ const response = await fetch(`${ROBING_API_URL}/api/history?${params}`)
### 원인 분석
```yaml
# docker-compose.yml 기본값 (틀림)
DATABASE_URL=postgresql+asyncpg://postgres:postgres@host.docker.internal:5432/auth_db
DATABASE_URL=postgresql+asyncpg://postgres:postgres@host.docker.internal:5432/main_db
# 실제 필요한 값
DATABASE_URL=postgresql+asyncpg://robeings:robeings@host.docker.internal:5432/auth_db
DATABASE_URL=postgresql+asyncpg://robeings:robeings@host.docker.internal:5432/main_db
```
### 해결 과정 (51123 서버)
1. **환경변수 수정**
```bash
cd /home/admin/ivada_project/robeing-gateway
echo 'DATABASE_URL=postgresql+asyncpg://robeings:robeings@host.docker.internal:5432/auth_db' > .env
echo 'DATABASE_URL=postgresql+asyncpg://robeings:robeings@host.docker.internal:5432/main_db' > .env
```
2. **컨테이너 재시작**
@ -327,7 +327,7 @@ docker-compose up -d
```bash
docker logs robing-gateway --tail 50
# "Database connection established successfully" 확인
# "All required tables found in auth_db" 확인
# "All required tables found in main_db" 확인
```
### 해결 결과

View File

@ -118,7 +118,7 @@ async def get_stats(robing_id: str):
port=5432,
user='robeings',
password='robeings',
database='auth_db'
database='main_db'
)
# robing_stats 테이블 조회