Skip to content

Commit 2864785

Browse files
committed
fix: use fork mode and skip pnpm deps check in PM2 ecosystem
- exec_mode: cluster requires a Node.js file and breaks when PM2 script is a package manager binary — switched to fork mode - pnpm runs a pre-script deps check (runDepsStatusCheck) before every script which was failing at PM2 startup; use pnpm run --no-run-check start to skip it
1 parent 10ed2f4 commit 2864785

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/domain/deploy/backend-strategy.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,16 @@ export class BackendStrategy implements DeploymentStrategy {
101101
const instances = this.config.pm2.instances ?? 1;
102102
const maxMemory = this.config.pm2.maxMemory ?? '512M';
103103

104+
// cluster mode requires a Node.js file; use fork for pkg manager scripts
105+
const args = pkgManager === 'pnpm' ? 'run --no-run-check start' : 'start';
106+
104107
return `module.exports = {
105108
apps: [{
106109
name: '${name}',
107110
script: '${pkgManager}',
108-
args: 'start',
111+
args: '${args}',
109112
instances: ${instances},
110-
exec_mode: 'cluster',
113+
exec_mode: 'fork',
111114
max_memory_restart: '${maxMemory}',
112115
env: {
113116
NODE_ENV: 'production',

0 commit comments

Comments
 (0)