Add PM2 ecosystem config for server deployment
Runs `next start` under PM2 (fork mode, autorestart, 1G memory cap). Config is .cjs because the package is ESM. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
e1bd3c7949
commit
d9d156d0a8
|
|
@ -46,6 +46,9 @@ next-env.d.ts
|
|||
/media
|
||||
/pastor-letters
|
||||
|
||||
# PM2 logs
|
||||
/logs
|
||||
|
||||
# SQLite database files
|
||||
*.db
|
||||
*.db-shm
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
// PM2 process definition for db-ministerial (Next.js + Payload CMS).
|
||||
//
|
||||
// The package is ESM ("type": "module"), so this config MUST be .cjs.
|
||||
//
|
||||
// Deploy flow on the server:
|
||||
// pnpm install --frozen-lockfile
|
||||
// cp .env.example .env # then set a real PAYLOAD_SECRET
|
||||
// pnpm build # production build (.next/)
|
||||
// pnpm import:pastors # one-time: load pastors from the CSV
|
||||
// pm2 start ecosystem.config.cjs
|
||||
// pm2 save # persist across reboots (see `pm2 startup`)
|
||||
//
|
||||
// Env vars (DATABASE_URI, PAYLOAD_SECRET, …) are read from the project's .env
|
||||
// by Next.js automatically. Anything set in `env` below overrides that.
|
||||
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: 'db-ministerial',
|
||||
// Run the Next.js binary directly so PM2 doesn't depend on pnpm being
|
||||
// on its PATH. Equivalent to `next start`.
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
args: 'start',
|
||||
cwd: __dirname,
|
||||
|
||||
instances: 1,
|
||||
exec_mode: 'fork',
|
||||
autorestart: true,
|
||||
watch: false,
|
||||
max_memory_restart: '1G',
|
||||
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
NODE_OPTIONS: '--no-deprecation',
|
||||
PORT: 3000,
|
||||
},
|
||||
|
||||
// Logs (relative to cwd). Create ./logs or change these paths.
|
||||
error_file: './logs/db-ministerial-error.log',
|
||||
out_file: './logs/db-ministerial-out.log',
|
||||
merge_logs: true,
|
||||
time: true,
|
||||
},
|
||||
],
|
||||
}
|
||||
Loading…
Reference in New Issue