-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathecosystem.config.js
More file actions
executable file
·81 lines (80 loc) · 2.76 KB
/
Copy pathecosystem.config.js
File metadata and controls
executable file
·81 lines (80 loc) · 2.76 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// PM2 Ecosystem Configuration for AxonML
// https://pm2.keymetrics.io/docs/usage/application-declaration/
//
// Usage:
// pm2 start ecosystem.config.js # Start all services
// pm2 start ecosystem.config.js --only axonml-server # Server only
// pm2 start ecosystem.config.js --only axonml-dashboard # Dashboard dev server only
// pm2 stop axonml-server # Stop server
// pm2 restart axonml-server # Restart server
// pm2 logs axonml-server # View logs
// pm2 save # Save current process list
// pm2 startup # Generate startup script (persist on reboot)
//
// First-time setup:
// 1. Build the release binary: cargo build --release -p axonml-server
// 2. Build dashboard: cd crates/axonml-dashboard && trunk build --release
// 3. Initialize database: ./AxonML_DB_Init.sh --with-user
// 4. Start with PM2: pm2 start ecosystem.config.js
// 5. Save process list: pm2 save
// 6. Enable startup: pm2 startup (follow instructions)
//
// Ports:
// - axonml-server: 3021 (API backend)
// - axonml-dashboard: 8082 (nginx serves static WASM, proxies API)
// - trunk serve: 8081 (dev mode with hot reload)
module.exports = {
apps: [
{
name: 'axonml-server',
script: './target/release/axonml-server',
args: '--port 3021',
cwd: '/opt/AxonML',
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: '2G',
env: {
RUST_LOG: 'info',
RUST_BACKTRACE: '1',
AXONML_DEVOPS_PASSWORD: process.env.AXONML_DEVOPS_PASSWORD || '',
},
env_production: {
RUST_LOG: 'warn',
RUST_BACKTRACE: '0',
AXONML_DEVOPS_PASSWORD: process.env.AXONML_DEVOPS_PASSWORD || '',
},
// Graceful shutdown
kill_timeout: 5000,
wait_ready: true,
listen_timeout: 10000,
// Logging
error_file: '/var/log/axonml/server-error.log',
out_file: '/var/log/axonml/server-out.log',
log_file: '/var/log/axonml/server-combined.log',
time: true,
// Restart policy
exp_backoff_restart_delay: 100,
max_restarts: 10,
restart_delay: 1000,
},
{
// Dashboard with trunk serve (static files + API proxy)
name: 'axonml-dashboard',
script: 'trunk',
args: 'serve --port 8083',
cwd: '/opt/AxonML/crates/axonml-dashboard',
interpreter: 'none',
autorestart: true,
watch: false,
// Logging
error_file: '/var/log/axonml/dashboard-error.log',
out_file: '/var/log/axonml/dashboard-out.log',
log_file: '/var/log/axonml/dashboard-combined.log',
time: true,
// Restart policy
max_restarts: 5,
restart_delay: 3000,
},
],
};