2ac0e9a0bf
问题: - PM2启动时报错:JWT_SECRET environment variable is not set - 所有客户端实例(梅州、云浮、揭阳、潮州、省局)都缺少JWT_SECRET配置 - 导致服务无法正常启动 修复: 为每个客户端实例添加独立的JWT_SECRET环境变量: - 梅州(51703): docreview-jwt-secret-key-production-meizhou-2024 - 云浮(51704): docreview-jwt-secret-key-production-yunfu-2024 - 揭阳(51705): docreview-jwt-secret-key-production-jieyang-2024 - 潮州(51706): docreview-jwt-secret-key-production-chaozhou-2024 - 省局(51707): docreview-jwt-secret-key-production-province-2024 注意: - 每个客户端使用不同的JWT_SECRET增强安全性 - JWT_SECRET用于生成和验证前端JWT token - 必需配置,否则服务无法启动 现在PM2可以正常启动所有客户端实例 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
211 lines
8.2 KiB
JavaScript
211 lines
8.2 KiB
JavaScript
// ecosystem.config.cjs - CommonJS 版本
|
|
// 多客户端部署配置:支持3个不同地区客户端通过不同端口访问
|
|
|
|
module.exports = {
|
|
apps: [
|
|
// 主服务 - 生产环境 (端口: 51703)
|
|
// 梅州
|
|
{
|
|
name: 'docreview-main-meizhou',
|
|
script: 'node',
|
|
args: [
|
|
'-r', 'dotenv/config',
|
|
// './node_modules/.bin/remix-serve',
|
|
'./node_modules/@remix-run/serve/dist/cli.js',
|
|
'./build/server/index.js',
|
|
'--port', '51703'
|
|
],
|
|
instances: 1,
|
|
autorestart: true,
|
|
watch: false,
|
|
max_memory_restart: '1G',
|
|
env: {
|
|
NODE_ENV: 'production',
|
|
PORT: 51703,
|
|
CLIENT_ID: 'meizhou',
|
|
API_PORT_CONFIG: '51703',
|
|
// 添加这些环境变量确保客户端能获取到
|
|
NEXT_PUBLIC_NODE_ENV: 'production',
|
|
NEXT_PUBLIC_PORT: '51703',
|
|
NEXT_PUBLIC_CLIENT_ID: 'meizhou',
|
|
NEXT_PUBLIC_API_PORT_CONFIG: '51703',
|
|
// JWT认证配置
|
|
JWT_SECRET: 'docreview-jwt-secret-key-production-meizhou-2024',
|
|
OAUTH_CLIENT_SECRET: 'VYk1AC5XIJEfnEXwyq0u9JEY3fi3byCfSD58zANGeb'
|
|
},
|
|
error_file: './logs/meizhou-err.log',
|
|
out_file: './logs/meizhou-out.log',
|
|
log_file: './logs/meizhou-combined.log',
|
|
time: true
|
|
},
|
|
|
|
// 客户端云浮 - 反向代理服务 (端口: 51704)
|
|
{
|
|
name: 'docreview-client-yunfu',
|
|
script: 'node',
|
|
args: [
|
|
'-r', 'dotenv/config',
|
|
// './node_modules/.bin/remix-serve',
|
|
'./node_modules/@remix-run/serve/dist/cli.js',
|
|
'./build/server/index.js',
|
|
'--port', '51704'
|
|
],
|
|
instances: 1,
|
|
autorestart: true,
|
|
watch: false,
|
|
max_memory_restart: '1G',
|
|
env: {
|
|
NODE_ENV: 'production',
|
|
PORT: 51704,
|
|
CLIENT_ID: 'yunfu',
|
|
API_PORT_CONFIG: '51704',
|
|
// 添加这些环境变量确保客户端能获取到
|
|
NEXT_PUBLIC_NODE_ENV: 'production',
|
|
NEXT_PUBLIC_PORT: '51704',
|
|
NEXT_PUBLIC_CLIENT_ID: 'yunfu',
|
|
NEXT_PUBLIC_API_PORT_CONFIG: '51704',
|
|
// JWT认证配置
|
|
JWT_SECRET: 'docreview-jwt-secret-key-production-yunfu-2024',
|
|
OAUTH_CLIENT_SECRET: 'VYk1AC5XIJEfnEXwyq0u9JEY3fi3byCfSD58zANGeb'
|
|
},
|
|
error_file: './logs/yunfu-err.log',
|
|
out_file: './logs/yunfu-out.log',
|
|
log_file: './logs/yunfu-combined.log',
|
|
time: true
|
|
},
|
|
// 客户端揭阳 - 独立服务 (端口: 51705)
|
|
{
|
|
name: 'docreview-client-jieyang',
|
|
script: 'node',
|
|
args: [
|
|
'-r', 'dotenv/config',
|
|
// './node_modules/.bin/remix-serve',
|
|
'./node_modules/@remix-run/serve/dist/cli.js',
|
|
'./build/server/index.js',
|
|
'--port', '51705'
|
|
],
|
|
instances: 1,
|
|
autorestart: true,
|
|
watch: false,
|
|
max_memory_restart: '1G',
|
|
env: {
|
|
NODE_ENV: 'production',
|
|
PORT: 51705,
|
|
CLIENT_ID: 'jieyang',
|
|
API_PORT_CONFIG: '51705',
|
|
// 添加这些环境变量确保客户端能获取到
|
|
NEXT_PUBLIC_NODE_ENV: 'production',
|
|
NEXT_PUBLIC_PORT: '51705',
|
|
NEXT_PUBLIC_CLIENT_ID: 'jieyang',
|
|
NEXT_PUBLIC_API_PORT_CONFIG: '51705',
|
|
// JWT认证配置
|
|
JWT_SECRET: 'docreview-jwt-secret-key-production-jieyang-2024',
|
|
OAUTH_CLIENT_SECRET: 'VYk1AC5XIJEfnEXwyq0u9JEY3fi3byCfSD58zANGeb'
|
|
},
|
|
error_file: './logs/jieyang-err.log',
|
|
out_file: './logs/jieyang-out.log',
|
|
log_file: './logs/jieyang-combined.log',
|
|
time: true
|
|
},
|
|
// 客户端潮州 - 独立服务 (端口: 51706)
|
|
{
|
|
name: 'docreview-client-chaozhou',
|
|
script: 'node',
|
|
args: [
|
|
'-r', 'dotenv/config',
|
|
// './node_modules/.bin/remix-serve',
|
|
'./node_modules/@remix-run/serve/dist/cli.js',
|
|
'./build/server/index.js',
|
|
'--port', '51706'
|
|
],
|
|
instances: 1,
|
|
autorestart: true,
|
|
watch: false,
|
|
max_memory_restart: '1G',
|
|
env: {
|
|
NODE_ENV: 'production',
|
|
PORT: 51706,
|
|
CLIENT_ID: 'chaozhou',
|
|
API_PORT_CONFIG: '51706',
|
|
// 添加这些环境变量确保客户端能获取到
|
|
NEXT_PUBLIC_NODE_ENV: 'production',
|
|
NEXT_PUBLIC_PORT: '51706',
|
|
NEXT_PUBLIC_CLIENT_ID: 'chaozhou',
|
|
NEXT_PUBLIC_API_PORT_CONFIG: '51706',
|
|
// JWT认证配置
|
|
JWT_SECRET: 'docreview-jwt-secret-key-production-chaozhou-2024',
|
|
OAUTH_CLIENT_SECRET: 'VYk1AC5XIJEfnEXwyq0u9JEY3fi3byCfSD58zANGeb'
|
|
},
|
|
error_file: './logs/chaozhou-err.log',
|
|
out_file: './logs/chaozhou-out.log',
|
|
log_file: './logs/chaozhou-combined.log',
|
|
time: true
|
|
},
|
|
// 客户端省局 - 独立服务 (端口: 51707)
|
|
{
|
|
name: 'docreview-client-province',
|
|
script: 'node',
|
|
args: [
|
|
'-r', 'dotenv/config',
|
|
//'./node_modules/.bin/remix-serve',
|
|
'./node_modules/@remix-run/serve/dist/cli.js',
|
|
'./build/server/index.js',
|
|
'--port', '51707'
|
|
],
|
|
instances: 1,
|
|
autorestart: true,
|
|
watch: false,
|
|
max_memory_restart: '1G',
|
|
env: {
|
|
NODE_ENV: 'production',
|
|
PORT: 51707,
|
|
CLIENT_ID: 'province',
|
|
API_PORT_CONFIG: '51707',
|
|
// 添加这些环境变量确保客户端能获取到
|
|
NEXT_PUBLIC_NODE_ENV: 'production',
|
|
NEXT_PUBLIC_PORT: '51707',
|
|
NEXT_PUBLIC_CLIENT_ID: 'province',
|
|
NEXT_PUBLIC_API_PORT_CONFIG: '51707',
|
|
// JWT认证配置
|
|
JWT_SECRET: 'docreview-jwt-secret-key-production-province-2024',
|
|
OAUTH_CLIENT_SECRET: 'VYk1AC5XIJEfnEXwyq0u9JEY3fi3byCfSD58zANGeb'
|
|
},
|
|
error_file: './logs/province-err.log',
|
|
out_file: './logs/province-out.log',
|
|
log_file: './logs/province-combined.log',
|
|
time: true
|
|
},
|
|
// 客户端省局 - 独立服务 (端口: 51708)
|
|
// {
|
|
// name: 'docreview-client-province',
|
|
// script: 'node',
|
|
// args: [
|
|
// '-r', 'dotenv/config',
|
|
// //'./node_modules/.bin/remix-serve',
|
|
// './node_modules/@remix-run/serve/dist/cli.js',
|
|
// './build/server/index.js',
|
|
// '--port', '51708'
|
|
// ],
|
|
// instances: 1,
|
|
// autorestart: true,
|
|
// watch: false,
|
|
// max_memory_restart: '1G',
|
|
// env: {
|
|
// NODE_ENV: 'production',
|
|
// PORT: 51708,
|
|
// CLIENT_ID: 'province',
|
|
// API_PORT_CONFIG: '51708',
|
|
// // 添加这些环境变量确保客户端能获取到
|
|
// NEXT_PUBLIC_NODE_ENV: 'production',
|
|
// NEXT_PUBLIC_PORT: '51708',
|
|
// NEXT_PUBLIC_CLIENT_ID: 'province',
|
|
// NEXT_PUBLIC_API_PORT_CONFIG: '51708',
|
|
// OAUTH_CLIENT_SECRET: 'VYk1AC5XIJEfnEXwyq0u9JEY3fi3byCfSD58zANGeb'
|
|
// },
|
|
// error_file: './logs/province-err.log',
|
|
// out_file: './logs/province-out.log',
|
|
// log_file: './logs/province-combined.log',
|
|
// time: true
|
|
// }
|
|
],
|
|
}; |