add pm2 config
This commit is contained in:
parent
7ffedfbaf0
commit
ce4476fd4a
39
pm2.config.cjs
Normal file
39
pm2.config.cjs
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* PM2 ecosystem configuration for the consumable temp request API.
|
||||
*
|
||||
* This configuration assumes the project runs with Bun so that TypeScript files can be executed directly.
|
||||
* Adjust the `interpreter` field if you prefer a different runtime (e.g. `node` with `tsx`).
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
const instances = Number.parseInt(process.env.WEB_CONCURRENCY ?? '1', 10) || 1;
|
||||
const { parsed: envFromFile = {} } = dotenv.config({ path: path.join(__dirname, '.env') });
|
||||
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: 'sm-server',
|
||||
script: 'index.ts',
|
||||
cwd: __dirname,
|
||||
interpreter: process.env.PM2_INTERPRETER ?? 'bun',
|
||||
autorestart: true,
|
||||
restart_delay: 4000,
|
||||
kill_timeout: 5000,
|
||||
instances,
|
||||
exec_mode: instances > 1 ? 'cluster' : 'fork',
|
||||
watch: process.env.NODE_ENV !== 'production',
|
||||
ignore_watch: ['generated', 'node_modules', '.git'],
|
||||
env: {
|
||||
...envFromFile,
|
||||
NODE_ENV: 'development'
|
||||
},
|
||||
env_production: {
|
||||
...envFromFile,
|
||||
NODE_ENV: 'production'
|
||||
},
|
||||
time: true
|
||||
}
|
||||
]
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user