chore: add deployment configuration for PM2 and production environment

- Add deploy.sh script for automated deployment via rsync
- Add ecosystem.config.js for PM2 process management (2 instances)
- Add .env.production.example as production env template
- Update config.module.ts to support .env.production file
- Add 'pnpm run deploy' script to package.json
This commit is contained in:
richarjiang
2026-03-15 14:27:48 +08:00
parent 6413d4f34c
commit ed1b5455a2
5 changed files with 136 additions and 2 deletions

27
ecosystem.config.js Normal file
View File

@@ -0,0 +1,27 @@
module.exports = {
apps: [
{
name: 'mememind-server',
script: 'dist/main.js',
instances: 2,
exec_mode: 'cluster',
autorestart: true,
watch: false,
max_memory_restart: '1G',
env: {
NODE_ENV: 'production',
PORT: 3000,
},
env_production: {
NODE_ENV: 'production',
PORT: 3000,
},
error_file: './logs/error.log',
out_file: './logs/out.log',
log_file: './logs/combined.log',
time: true,
merge_logs: true,
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
},
],
};