// 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: 3111, }, // 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, }, ], }