"refactor(backend): 移除未使用的redis、socket.io和sqlite3依赖"包括:
- `backend/.env.production`:生产环境变量配置 - `backend/ecosystem.config.js`:PM2生态系统配置文件 - `scripts/nginx-aijianhua.conf`:Nginx配置文件 - `scripts/server-deploy.sh`:服务器部署脚本 - `scripts/sync-to-server.sh`:代码同步脚本 - `docs/生产环境部署指南.md`:生产环境部署指南文档 同时移除了`package.json`中不再使用的依赖项:- `redis`- `socket.io` - `sqlite3`这些更改将有助于简化生产环境的部署流程,并确保服务能够稳定运行。```
This commit is contained in:
35
backend/ecosystem.config.js
Normal file
35
backend/ecosystem.config.js
Normal file
@@ -0,0 +1,35 @@
|
||||
// PM2生态系统配置文件
|
||||
// 用于生产环境部署
|
||||
|
||||
module.exports = {
|
||||
apps: [{
|
||||
name: 'aijianhua-backend',
|
||||
script: './app.js',
|
||||
instances: 'max',
|
||||
exec_mode: 'cluster',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
PORT: 3330,
|
||||
NODE_OPTIONS: '--max-old-space-size=4096'
|
||||
},
|
||||
env_production: {
|
||||
NODE_ENV: 'production',
|
||||
PORT: 3330
|
||||
},
|
||||
// 日志配置
|
||||
log_file: '/data/nodejs/aijianhua/logs/combined.log',
|
||||
out_file: '/data/nodejs/aijianhua/logs/out.log',
|
||||
error_file: '/data/nodejs/aijianhua/logs/error.log',
|
||||
// 进程管理
|
||||
max_memory_restart: '1G',
|
||||
watch: false,
|
||||
ignore_watch: ['node_modules', 'logs', 'uploads'],
|
||||
// 重启策略
|
||||
autorestart: true,
|
||||
restart_delay: 3000,
|
||||
// 高级配置
|
||||
node_args: '--harmony',
|
||||
merge_logs: true,
|
||||
time: true
|
||||
}]
|
||||
};
|
||||
Reference in New Issue
Block a user