-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathecosystem.config.cjs
More file actions
50 lines (43 loc) · 1.35 KB
/
Copy pathecosystem.config.cjs
File metadata and controls
50 lines (43 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* PM2 Ecosystem Configuration for ScallopBot
*
* Usage:
* pm2 start ecosystem.config.cjs
* pm2 start ecosystem.config.cjs --env production
*
* IMPORTANT: Start with 'dist/cli.js start', NOT 'dist/index.js'
* The index.js is just exports, cli.js is the actual entry point.
*/
module.exports = {
apps: [
{
name: 'scallopbot',
script: 'dist/cli.js',
args: 'start',
cwd: '/opt/scallopbot',
// Restart behavior
restart_delay: 5000, // Wait 5s between restarts (prevents Telegram conflicts)
max_restarts: 10, // Max restarts before stopping
min_uptime: 10000, // Consider started after 10s uptime
// Resource limits (suitable for 4GB RAM servers)
max_memory_restart: '500M', // Restart if memory exceeds 500MB
// Logging
error_file: '/var/log/scallopbot/error.log',
out_file: '/var/log/scallopbot/out.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
merge_logs: true,
// Environment
env: {
NODE_ENV: 'development',
},
env_production: {
NODE_ENV: 'production',
},
// Graceful shutdown
kill_timeout: 5000, // Wait 5s for graceful shutdown
listen_timeout: 10000, // Wait 10s for app to be ready
// Don't watch in production
watch: false,
},
],
};