source: Klonkt/ecosystem.config.cjs@ 9465a0d

main
Last change on this file since 9465a0d was 9465a0d, checked in by roboburr <roboburr@…>, 3 months ago

Rename pm2 process prutcms -> klonkt (drop legacy name)

ecosystem.config.cjs name + DEPLOY.md. The post-receive hook + the running
pm2 process are handled separately server-side.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@…>

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 * PM2 ecosystem config — production process manager.
3 *
4 * Single fork (NOT cluster mode) because:
5 * - SqliteSessionStore is in-process: cluster workers wouldn't share sessions.
6 * - PrutterService.wsConnections is in-process: WS broadcast wouldn't reach
7 * sockets attached to other workers.
8 * - better-sqlite3 is synchronous and not designed for multi-process writes.
9 * If you ever need horizontal scaling, swap the session/Prutter stores for a
10 * shared backend (Redis) first, then enable cluster mode.
11 *
12 * Usage:
13 * pm2 start ecosystem.config.cjs --env production
14 * pm2 save && pm2 startup # auto-start on boot
15 * pm2 logs klonkt
16 */
17
18module.exports = {
19 apps: [
20 {
21 name: 'klonkt',
22 script: 'src/server.js',
23 cwd: __dirname,
24 exec_mode: 'fork',
25 instances: 1,
26 autorestart: true,
27 watch: false, // never watch in prod
28 max_memory_restart: '512M', // restart if RSS exceeds this
29 kill_timeout: 5000, // give in-flight requests time to finish
30
31 // Logs go to ~/.pm2/logs/klonkt-out.log and -error.log by default.
32 // Override here if you want them in the project dir:
33 // out_file: './logs/out.log',
34 // error_file: './logs/error.log',
35 merge_logs: true,
36 time: true, // prefix log lines with timestamps
37
38 env: {
39 NODE_ENV: 'development',
40 PORT: 3000,
41 },
42 env_production: {
43 NODE_ENV: 'production',
44 PORT: 3000,
45 // SESSION_SECRET, AUDIO_SECRET etc. should come from .env on the server,
46 // dotenv loads them automatically. Don't bake them into this file.
47 },
48 },
49 ],
50};
Note: See TracBrowser for help on using the repository browser.