feat: add PM2 configuration and deployment setup for remote server

- Add Makefile with convenient PM2 commands for development and production
- Add ecosystem.config.js with production/staging/dev environment configurations
- Add comprehensive PM2-GUIDE.md documentation for deployment
- Update package.json with PM2-specific npm scripts
- Fix Chrome extension URL handling to omit standard ports (443/80)
- Hide embedding model and semantic engine sections in popup UI
This commit is contained in:
nasir@endelospay.com
2025-08-22 00:21:10 +05:00
parent a6b98176a4
commit f4ca680532
6 changed files with 466 additions and 5 deletions

View File

@@ -0,0 +1,95 @@
module.exports = {
apps: [
{
name: 'mcp-remote-server',
script: 'dist/index.js',
cwd: __dirname,
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: '1G',
env: {
NODE_ENV: 'production',
PORT: 3040,
HOST: '0.0.0.0',
DOMAIN: 'https://mcp-browser.qubecare.ai',
},
env_development: {
NODE_ENV: 'development',
PORT: 3040,
HOST: '0.0.0.0',
DOMAIN: 'http://localhost:3040',
},
env_staging: {
NODE_ENV: 'staging',
PORT: 3040,
HOST: '0.0.0.0',
DOMAIN: 'https://staging-mcp-browser.qubecare.ai',
},
// Logging configuration
log_file: './logs/combined.log',
out_file: './logs/out.log',
error_file: './logs/error.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
// Process management
min_uptime: '10s',
max_restarts: 10,
restart_delay: 4000,
// Advanced PM2 features
exec_mode: 'fork',
kill_timeout: 5000,
listen_timeout: 3000,
// Health monitoring
health_check_grace_period: 3000,
// Environment-specific overrides
merge_logs: true,
// Custom startup script (optional)
pre_start: 'npm run build',
// Post-deployment hooks (optional)
post_start: 'echo "MCP Remote Server started successfully"',
// Graceful shutdown
shutdown_with_message: true,
// Source map support for better error traces
source_map_support: true,
// Node.js specific options
node_args: '--max-old-space-size=1024',
// Custom environment variables from .env file
env_file: '.env',
},
],
// Deployment configuration (optional)
deploy: {
production: {
user: 'deploy',
host: 'your-server.com',
ref: 'origin/main',
repo: 'git@github.com:your-username/your-repo.git',
path: '/var/www/mcp-remote-server',
'pre-deploy-local': '',
'post-deploy':
'npm install && npm run build && pm2 reload ecosystem.config.js --env production',
'pre-setup': '',
},
staging: {
user: 'deploy',
host: 'staging-server.com',
ref: 'origin/develop',
repo: 'git@github.com:your-username/your-repo.git',
path: '/var/www/mcp-remote-server-staging',
'pre-deploy-local': '',
'post-deploy': 'npm install && npm run build && pm2 reload ecosystem.config.js --env staging',
'pre-setup': '',
},
},
};