feat: PM2 설정 파일 추가

- ecosystem.config.js: PM2 프로세스 매니저 설정
- 자동 재시작, 로그 관리, 메모리 제한 설정
- logs/ 폴더 생성
This commit is contained in:
thug0bin 2026-02-27 14:56:08 +09:00
parent c4ab865c93
commit 625012f5ee

45
ecosystem.config.js Normal file
View File

@ -0,0 +1,45 @@
// PM2 설정 파일
// 사용법:
// npm install -g pm2
// pm2 start ecosystem.config.js
// pm2 restart pharmacy
// pm2 stop pharmacy
// pm2 logs pharmacy
module.exports = {
apps: [
{
name: 'pharmacy',
script: 'backend/app.py',
interpreter: 'python',
cwd: __dirname,
// 환경 설정
env: {
FLASK_ENV: 'development',
PYTHONIOENCODING: 'utf-8'
},
env_production: {
FLASK_ENV: 'production'
},
// 재시작 설정
watch: false, // 파일 변경 감지 (개발 시 true)
max_restarts: 10, // 최대 재시작 횟수
restart_delay: 3000, // 재시작 딜레이 (3초)
// 로그 설정
log_date_format: 'YYYY-MM-DD HH:mm:ss',
error_file: 'logs/pm2-error.log',
out_file: 'logs/pm2-out.log',
merge_logs: true,
// 인스턴스 설정
instances: 1, // 단일 인스턴스
exec_mode: 'fork',
// 메모리 제한
max_memory_restart: '500M'
}
]
};