diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..0e56578 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,28 @@ +name: deploy-on-main +on: + push: + branches: [ "main" ] + +jobs: + deploy: + runs-on: [ linux_amd64, self-hosted ] + steps: + - uses: actions/checkout@v4 + + - name: Node/PM2/Prisma 확인 + run: | + node -v + npm -v + pm2 -v || true + npx prisma --version || true + + - name: 배포 + env: + APP_DIR: /root/msgapp + run: | + set -e + cd "$APP_DIR" + git pull + npm run dbforce + npm run build + pm2 reload ecosystem.config.js --env production || (pm2 start ecosystem.config.js --env production && pm2 save) diff --git a/.gitignore b/.gitignore index e8930f6..5375e42 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ next-env.d.ts /prisma/prisma/dev.db *.ignore +/logs diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..1ec12a8 --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,18 @@ +module.exports = { + apps: [ + { + name: 'assm', + cwd: '/root/msgapp', + script: 'npm', + args: 'start', + interpreter: 'none', + env: { + NODE_ENV: 'production', + }, + autorestart: true, + watch: false, + }, + ], +}; + + diff --git a/package.json b/package.json index 9257ccc..cb5ca77 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "dev": "next dev --turbopack", "build": "next build --turbopack", - "start": "next start", + "start": "next start --port 3100", "lint": "biome check", "format": "biome format --write", "migrate": "prisma migrate dev",