fix: rename pm2 worker and invoke tsx directly instead of npm
pm2 fork mode require()s the resolved script rather than spawning a shell, and on o2switch `npm` resolves to CloudLinux's bash npm_wrapper, so pm2 crashed instantly (SyntaxError) and restart-looped forever. Point pm2 at tsx's real ESM entry (node_modules/tsx/dist/cli.mjs) instead. Also renames the pm2 process to video-downloader-worker. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -80,7 +80,7 @@ L'interface est accessible sur [http://localhost:3000](http://localhost:3000).
|
|||||||
| `npm run worker:pm2:start` | Démarre le worker sous pm2 (`ecosystem.config.cjs`), avec auto-restart |
|
| `npm run worker:pm2:start` | Démarre le worker sous pm2 (`ecosystem.config.cjs`), avec auto-restart |
|
||||||
| `npm run worker:pm2:stop` | Arrête le worker géré par pm2 |
|
| `npm run worker:pm2:stop` | Arrête le worker géré par pm2 |
|
||||||
| `npm run worker:pm2:restart` | Redémarre le worker géré par pm2 |
|
| `npm run worker:pm2:restart` | Redémarre le worker géré par pm2 |
|
||||||
| `npm run worker:pm2:status` | Affiche l'état du process `ombrora-worker` |
|
| `npm run worker:pm2:status` | Affiche l'état du process `video-downloader-worker` |
|
||||||
| `npm run worker:pm2:logs` | Affiche les logs du worker géré par pm2 |
|
| `npm run worker:pm2:logs` | Affiche les logs du worker géré par pm2 |
|
||||||
| `npm run worker:cleanup` | Expire et supprime les fichiers anciens (usage cron) |
|
| `npm run worker:cleanup` | Expire et supprime les fichiers anciens (usage cron) |
|
||||||
| `npm run db:migrate` | Crée et applique les migrations Prisma (dev, interactif) |
|
| `npm run db:migrate` | Crée et applique les migrations Prisma (dev, interactif) |
|
||||||
@@ -157,7 +157,7 @@ worker/
|
|||||||
messages/ # Traductions (en.json, fr.json, es.json, it.json)
|
messages/ # Traductions (en.json, fr.json, es.json, it.json)
|
||||||
|
|
||||||
server.js # Serveur HTTP custom (fichier de démarrage Passenger sur o2switch)
|
server.js # Serveur HTTP custom (fichier de démarrage Passenger sur o2switch)
|
||||||
ecosystem.config.cjs # Config pm2 du process "ombrora-worker"
|
ecosystem.config.cjs # Config pm2 du process "video-downloader-worker"
|
||||||
|
|
||||||
prisma/
|
prisma/
|
||||||
└── schema.prisma # Modèles : Download, DownloadToken
|
└── schema.prisma # Modèles : Download, DownloadToken
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
apps: [
|
apps: [
|
||||||
{
|
{
|
||||||
name: 'ombrora-worker',
|
name: 'video-downloader-worker',
|
||||||
script: 'npm',
|
script: 'node_modules/tsx/dist/cli.mjs',
|
||||||
args: 'run worker',
|
args: 'worker/index.ts',
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
autorestart: true,
|
autorestart: true,
|
||||||
max_restarts: 10,
|
max_restarts: 10,
|
||||||
|
|||||||
+2
-2
@@ -16,8 +16,8 @@
|
|||||||
"worker:pm2:start": "pm2 start ecosystem.config.cjs",
|
"worker:pm2:start": "pm2 start ecosystem.config.cjs",
|
||||||
"worker:pm2:stop": "pm2 stop ecosystem.config.cjs",
|
"worker:pm2:stop": "pm2 stop ecosystem.config.cjs",
|
||||||
"worker:pm2:restart": "pm2 restart ecosystem.config.cjs",
|
"worker:pm2:restart": "pm2 restart ecosystem.config.cjs",
|
||||||
"worker:pm2:status": "pm2 status ombrora-worker",
|
"worker:pm2:status": "pm2 status video-downloader-worker",
|
||||||
"worker:pm2:logs": "pm2 logs ombrora-worker",
|
"worker:pm2:logs": "pm2 logs video-downloader-worker",
|
||||||
"db:migrate": "prisma migrate dev",
|
"db:migrate": "prisma migrate dev",
|
||||||
"db:migrate:deploy": "prisma migrate deploy",
|
"db:migrate:deploy": "prisma migrate deploy",
|
||||||
"db:generate": "prisma generate",
|
"db:generate": "prisma generate",
|
||||||
|
|||||||
Reference in New Issue
Block a user