66 lines
2.4 KiB
JavaScript
66 lines
2.4 KiB
JavaScript
// ecosystem.config.cjs
|
|
// This file is the standard way to configure applications for PM2.
|
|
// It allows us to define all the settings for our application in one place.
|
|
// The .cjs extension is required because the project's package.json has "type": "module".
|
|
|
|
module.exports = {
|
|
apps: [
|
|
{
|
|
// --- API Server ---
|
|
// The name is now dynamically set based on the environment.
|
|
// This is a common pattern but requires you to call pm2 with the correct name.
|
|
// The deploy script handles this by using 'flyer-crawler-api' for prod and 'flyer-crawler-api-test' for test.
|
|
name: 'flyer-crawler-api',
|
|
script: './node_modules/.bin/tsx',
|
|
args: 'server.ts', // tsx will execute this file
|
|
// Production Environment Settings
|
|
env_production: {
|
|
NODE_ENV: 'production', // Set the Node.js environment to production
|
|
name: 'flyer-crawler-api',
|
|
cwd: '/var/www/flyer-crawler.projectium.com',
|
|
},
|
|
// Test Environment Settings
|
|
env_test: {
|
|
NODE_ENV: 'development', // Use 'development' for test to enable more verbose logging if needed
|
|
name: 'flyer-crawler-api-test',
|
|
cwd: '/var/www/flyer-crawler-test.projectium.com',
|
|
},
|
|
},
|
|
{
|
|
// --- General Worker ---
|
|
name: 'flyer-crawler-worker',
|
|
script: './node_modules/.bin/tsx',
|
|
args: 'src/services/queueService.server.ts', // tsx will execute this file
|
|
// Production Environment Settings
|
|
env_production: {
|
|
NODE_ENV: 'production',
|
|
name: 'flyer-crawler-worker',
|
|
cwd: '/var/www/flyer-crawler.projectium.com',
|
|
},
|
|
// Test Environment Settings
|
|
env_test: {
|
|
NODE_ENV: 'development',
|
|
name: 'flyer-crawler-worker-test',
|
|
cwd: '/var/www/flyer-crawler-test.projectium.com',
|
|
},
|
|
},
|
|
{
|
|
// --- Analytics Worker ---
|
|
name: 'flyer-crawler-analytics-worker',
|
|
script: './node_modules/.bin/tsx',
|
|
args: 'src/services/queueService.server.ts', // tsx will execute this file
|
|
// Production Environment Settings
|
|
env_production: {
|
|
NODE_ENV: 'production',
|
|
name: 'flyer-crawler-analytics-worker',
|
|
cwd: '/var/www/flyer-crawler.projectium.com',
|
|
},
|
|
// Test Environment Settings
|
|
env_test: {
|
|
NODE_ENV: 'development',
|
|
name: 'flyer-crawler-analytics-worker-test',
|
|
cwd: '/var/www/flyer-crawler-test.projectium.com',
|
|
},
|
|
},
|
|
],
|
|
}; |