Files
larablog/ecosystem.config.cjs
gouki 3cec4c5e18
CI / PHPUnit (PHP 8.3) (push) Failing after 4s
CI / PHPUnit (PHP 8.2) (push) Failing after 1m9s
CI / Deploy (manual gate) (push) Skipped
wip: article AI polish, category SEO fields, cover generator, membership plan seeder
2026-09-07 18:48:37 +00:00

80 lines
2.0 KiB
JavaScript

/**
* PM2 process file for LaraBlog long-running workers.
*
* Usage (from project root):
* pm2 start ecosystem.config.cjs
* pm2 save
* pm2 startup
*
* Notes:
* - Web HTTP is served by nginx/php-fpm (or Herd), NOT pm2.
* - Adjust cwd if deploying outside this path.
*/
const path = require('path');
const root = __dirname;
const php = process.env.PHP_BINARY || 'php';
module.exports = {
apps: [
{
name: 'larablog-queue',
cwd: root,
script: php,
// Keep AI queues off this worker when larablog-ai-workerman is running,
// otherwise both processes race-consume the same jobs.
args: 'artisan queue:work redis --queue=default --sleep=3 --tries=3 --max-time=3600',
interpreter: 'none',
instances: 1,
autorestart: true,
max_restarts: 20,
min_uptime: '10s',
kill_timeout: 10000,
out_file: path.join(root, 'storage/logs/pm2-queue.out.log'),
error_file: path.join(root, 'storage/logs/pm2-queue.err.log'),
merge_logs: true,
time: true,
env: {
APP_ENV: 'production',
},
},
{
name: 'larablog-schedule',
cwd: root,
script: php,
args: 'artisan schedule:work',
interpreter: 'none',
instances: 1,
autorestart: true,
max_restarts: 20,
min_uptime: '10s',
out_file: path.join(root, 'storage/logs/pm2-schedule.out.log'),
error_file: path.join(root, 'storage/logs/pm2-schedule.err.log'),
merge_logs: true,
time: true,
env: {
APP_ENV: 'production',
},
},
{
name: 'larablog-ai-workerman',
cwd: root,
script: php,
args: 'artisan workerman:ai start',
interpreter: 'none',
instances: 1,
autorestart: true,
max_restarts: 30,
min_uptime: '5s',
kill_timeout: 15000,
out_file: path.join(root, 'storage/logs/pm2-ai.out.log'),
error_file: path.join(root, 'storage/logs/pm2-ai.err.log'),
merge_logs: true,
time: true,
env: {
APP_ENV: 'production',
},
},
],
};