Skip to content

Commit 26073f2

Browse files
committed
Add pm2
1 parent 166a93a commit 26073f2

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

ecosystem.config.cjs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Archivo de configuración de PM2 para ejecutar el bot y API en background.
3+
* Usa CommonJS (.cjs) para evitar conflictos con "type: module" del proyecto.
4+
*
5+
* Ajusta valores de env_* según tu despliegue.
6+
*/
7+
8+
module.exports = {
9+
apps: [
10+
{
11+
name: 'steamid-guid-bot',
12+
script: './index.js',
13+
cwd: './',
14+
instances: 1,
15+
exec_mode: 'fork',
16+
watch: false,
17+
autorestart: true,
18+
max_memory_restart: '300M',
19+
time: true,
20+
merge_logs: true,
21+
log_date_format: 'YYYY-MM-DD HH:mm:ss',
22+
env: {
23+
NODE_ENV: 'development',
24+
API_ACTIVE: 'true',
25+
API_PORT: '8000'
26+
},
27+
env_production: {
28+
NODE_ENV: 'production',
29+
API_ACTIVE: 'true',
30+
API_PORT: '8000'
31+
}
32+
}
33+
]
34+
};

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
"start:local": "STEAMID_ENV=local nodemon index.js",
1313
"db:migrate": "node ./src/Database/Migrate.js",
1414
"db:seed:games": "node ./src/Database/SeedGames.js",
15-
"db:setup": "npm run db:migrate && npm run db:seed:games"
15+
"db:setup": "npm run db:migrate && npm run db:seed:games",
16+
"pm2:start": "pm2 start ecosystem.config.cjs --env production",
17+
"pm2:restart": "pm2 restart steamid-guid-bot",
18+
"pm2:stop": "pm2 stop steamid-guid-bot && pm2 delete steamid-guid-bot",
19+
"pm2:logs": "pm2 logs steamid-guid-bot --lines 100",
20+
"pm2:list": "pm2 ls",
21+
"pm2:save": "pm2 save"
1622
},
1723
"keywords": [
1824
"-"

0 commit comments

Comments
 (0)