feat: 24/7 무중단 운영을 위한 launchd 서비스 구축

- macOS의 launchd를 이용하여 AI 서버를 시스템 서비스로 등록
- 시스템 재부팅 시 서버 자동 시작 기능 구현
- 예기치 않은 오류 발생 시 서버 자동 재시작 기능 추가
- 서비스 로그를 logs/ 디렉토리에 자동으로 기록하도록 설정
- CODING_CONVENTIONS.md에 서버 운영 및 배포 가이드 상세히 문서화
This commit is contained in:
hyungi
2025-07-25 07:00:50 +09:00
parent 13159b482d
commit 867c7f4bca
4 changed files with 91 additions and 1 deletions

View File

@@ -65,4 +65,24 @@
- **DS1525+ NAS IP**: `192.168.1.227` (문서 저장소)
- **NAS 마운트 포인트**: `/Volumes/DS1525+`
- **서버 포트**: `8080` (FastAPI 웹 서비스)
- **대시보드 접속**: `http://192.168.1.122:8080/dashboard`
- **대시보드 접속**: `http://192.168.1.122:8080/dashboard`
## 7. 서버 운영 및 배포 (macOS)
이 서버는 24/7 무중단 운영을 위해 macOS의 `launchd` 서비스를 통해 관리됩니다. 이를 통해 시스템 재부팅 시 자동 시작 및 예기치 않은 종료 시 자동 재시작이 보장됩니다.
- **서비스 설정 파일**: `~/Library/LaunchAgents/com.nllb-translation-system.app.plist`
- 이 파일은 서비스의 실행 방법, 로그 경로, 자동 재시작 여부 등을 정의합니다.
- **서비스 제어 명령어**:
- **시작**: `launchctl start com.nllb-translation-system.app`
- **중지**: `launchctl stop com.nllb-translation-system.app`
- **재시작 (설정 파일 수정 후)**:
1. `launchctl unload ~/Library/LaunchAgents/com.nllb-translation-system.app.plist`
2. `launchctl load ~/Library/LaunchAgents/com.nllb-translation-system.app.plist`
- **로그 확인**:
- **일반 로그**: `tail -f logs/service.log`
- **에러 로그**: `tail -f logs/service_error.log`
- **주의**: 개발 및 디버깅 시에는 `launchd` 서비스를 중지(`launchctl stop ...`)한 후, 터미널에서 직접 `python src/fastapi_with_dashboard.py`를 실행해야 포트 충돌이 발생하지 않습니다.