From 625012f5ee38de4fe29f9a8db7a87a156cea1fbb Mon Sep 17 00:00:00 2001 From: thug0bin Date: Fri, 27 Feb 2026 14:56:08 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20PM2=20=EC=84=A4=EC=A0=95=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ecosystem.config.js: PM2 프로세스 매니저 설정 - 자동 재시작, 로그 관리, 메모리 제한 설정 - logs/ 폴더 생성 --- ecosystem.config.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 ecosystem.config.js diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..cf851ff --- /dev/null +++ b/ecosystem.config.js @@ -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' + } + ] +};