Skip to content

Commit

Permalink
chore: pm2 설치
Browse files Browse the repository at this point in the history
  • Loading branch information
gyeongza committed May 26, 2024
1 parent 06a9a98 commit ac544a6
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
echo "ZIP_FILENAME=$ZIP_FILENAME" >> $GITHUB_ENV
- name: zip create
run: zip -qq -r --symlinks ./${{ env.ZIP_FILENAME }} .next appspec.yml deploy.sh
run: zip -qq -r --symlinks ./${{ env.ZIP_FILENAME }}
shell: bash

- name: Configure AWS credentials
Expand Down
2 changes: 1 addition & 1 deletion appspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ permissions:
hooks:
ApplicationStart:
- location: deploy.sh
timeout: 500
timeout: 60
runas: ubuntu
3 changes: 1 addition & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ cd /home/ubuntu/frontend

# Start the application
# Adjust the command below to suit your application's start process
yarn install
yarn dev
yarn deploy
17 changes: 17 additions & 0 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
apps: [
{
name: 'i-tracker', // 앱의 이름
script: './node_modules/next/dist/bin/next', // Next.js 스크립트 경로
args: 'start', // Next.js 앱을 시작할 때 사용할 인수
exec_mode: 'cluster', // 실행 모드: cluster 또는 fork 중 선택
instances: '2', // 클러스터 모드에서 실행할 인스턴스 수 (CPU 코어 수만큼)
autorestart: true, // 프로세스 자동 재시작 활성화
watch: true, // 파일 변경 감지 활성화 (개발 중에만 활용)
max_memory_restart: '1G', // 1GB 이상 메모리 사용 시 재시작
env: {
NODE_ENV: 'production', // Node.js 환경 설정
},
},
],
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint:fix": "next lint --fix"
"lint:fix": "next lint --fix",
"deploy": "pm2 start ecosystem.config.js --env production"
},
"dependencies": {
"@radix-ui/react-slot": "^1.0.2",
Expand Down

0 comments on commit ac544a6

Please sign in to comment.