40 lines
1.0 KiB
JavaScript
40 lines
1.0 KiB
JavaScript
/**
|
|
* 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
|
|
}
|
|
]
|
|
};
|