배포 가이드
서버 구성
| 서버 |
호스트 |
역할 |
포트 |
| rocky-211 |
211.208.115.83 (ssh rocky-211) |
프론트엔드 + 백엔드 + nginx |
443(nginx), 18080(backend) |
| redis-211 |
192.168.1.18 (ssh redis-211) |
prediction 분석 + Redis + Ollama |
18092(prediction), 8001(기존), 6379(redis) |
서비스 목록
rocky-211
| 서비스 |
systemd |
포트 |
로그 |
| 백엔드 (Spring Boot) |
kcg-ai-backend.service |
18080 |
journalctl -u kcg-ai-backend -f |
| nginx |
nginx.service |
80/443 |
/var/log/nginx/ |
redis-211
| 서비스 |
systemd |
포트 |
로그 |
| kcg-ai-prediction |
kcg-ai-prediction.service |
18092 |
journalctl -u kcg-ai-prediction -f |
| kcg-prediction (기존 iran) |
kcg-prediction.service |
8001 |
journalctl -u kcg-prediction -f |
| kcg-prediction-lab |
kcg-prediction-lab.service |
18091 |
journalctl -u kcg-prediction-lab -f |
디렉토리 구조
rocky-211
/devdata/services/kcg-ai-monitoring/
├── dist/ # 프론트엔드 빌드 산출물
│ ├── index.html
│ └── assets/
├── backend/
│ ├── kcg-ai-backend.jar # Spring Boot 실행 JAR
│ └── application-prod.yml # 운영 설정
redis-211
/home/apps/kcg-ai-prediction/ # 신규 (kcgaidb 연결)
├── .env # 환경변수
├── venv/ # Python 가상환경
├── main.py # FastAPI 진입점
├── algorithms/ # 14개 분석 알고리즘
├── pipeline/ # 7단계 분류 파이프라인
├── output/ # 이벤트/통계/KPI 출력 모듈
├── cache/ # vessel_store
├── db/ # DB 어댑터
└── ...
nginx 프록시 설정
파일: /etc/nginx/conf.d/kcg-ai-monitoring.conf (rocky-211)
kcg-ai-monitoring.gc-si.dev (443)
├── / → /devdata/services/kcg-ai-monitoring/dist/ (SPA)
├── /api/ → http://127.0.0.1:18080 (Spring Boot)
├── /api/prediction/ → http://192.168.1.18:18092 (prediction)
└── /api/prediction-chat → http://192.168.1.18:18092 (SSE)
배포 방법
프론트엔드 배포
# 로컬에서 빌드
cd frontend && npx vite build
# 서버에 전송
rsync -avz dist/ rocky-211:/devdata/services/kcg-ai-monitoring/dist/
백엔드 배포
# 로컬에서 JAR 빌드
cd backend && ./mvnw clean package -DskipTests
# 서버에 전송
scp target/kcg-ai-backend-0.0.1-SNAPSHOT.jar rocky-211:/devdata/services/kcg-ai-monitoring/backend/kcg-ai-backend.jar
# 서버에서 재시작
ssh rocky-211 "systemctl restart kcg-ai-backend"
# 로그 확인
ssh rocky-211 "journalctl -u kcg-ai-backend -f"
prediction 배포
# 파일 동기화 (venv 제외)
rsync -avz --exclude='.venv' --exclude='__pycache__' --exclude='.env' --exclude='*.pyc' \
prediction/ redis-211:/home/apps/kcg-ai-prediction/
# 서버에서 재시작
ssh redis-211 "systemctl restart kcg-ai-prediction"
# 로그 확인
ssh redis-211 "journalctl -u kcg-ai-prediction -f"
의존성 변경 시 (prediction)
ssh redis-211 "cd /home/apps/kcg-ai-prediction && source venv/bin/activate && pip install -r requirements.txt"
ssh redis-211 "systemctl restart kcg-ai-prediction"
로컬 개발 설정
기본 (서버 프록시)
cd frontend && npm run dev
# → /api 요청이 https://kcg-ai-monitoring.gc-si.dev로 프록시됨
로컬 백엔드 사용 시
VITE_API_PROXY=http://localhost:8080 npm run dev
# 또는 backend와 함께:
make dev # frontend + backend 동시 실행
서비스 관리
# 상태 확인
ssh rocky-211 "systemctl status kcg-ai-backend"
ssh redis-211 "systemctl status kcg-ai-prediction"
# 재시작
ssh rocky-211 "systemctl restart kcg-ai-backend"
ssh redis-211 "systemctl restart kcg-ai-prediction"
# 로그 (실시간)
ssh rocky-211 "journalctl -u kcg-ai-backend -f"
ssh redis-211 "journalctl -u kcg-ai-prediction -f"
# health check
curl -s https://kcg-ai-monitoring.gc-si.dev/actuator/health
curl -s http://192.168.1.18:18092/health # redis-211 내부
DB 접속
PGPASSWORD='Kcg2026ai' psql -h 211.208.115.83 -U kcg-app -d kcgaidb
# 스키마: kcg, 테이블 37개
포트 정리
| 포트 |
서비스 |
서버 |
| 443 |
nginx (HTTPS) |
rocky-211 |
| 18080 |
kcg-ai-backend (Spring Boot) |
rocky-211 |
| 18092 |
kcg-ai-prediction (FastAPI) |
redis-211 |
| 8001 |
kcg-prediction (기존 iran) |
redis-211 |
| 18091 |
kcg-prediction-lab |
redis-211 |
| 5432 |
PostgreSQL (kcgaidb, snpdb) |
211.208.115.83 |
| 6379 |
Redis |
redis-211 |
| 11434 |
Ollama |
redis-211 |