Skip to content

常用应用配置

Node 应用

module.exports = {
  apps: [
    {
      name: 'xxx',
      script: 'app.js',
      // 机器mem为 20g  11c
      node_args: '--max_old_space_size=2048',
      instances: 'max',
      autorestart: true,
      watch: false,
      // max_memory_restart: '600M',
      env: {
        NODE_ENV: 'development',
      },
      env_production: {
        NODE_ENV: 'production',
      },
    },
  ],
}

非Node应用

django 举例, 创建文件 ecosystem.config.js

module.exports = {
  apps: [
    {
      name: 'django',
      cwd: '/Users/goze/python/ac',
      args: 'runserver 0.0.0.0:8989',
      script: 'manage.py',
      exec_mode: 'fork',
      exec_interpreter: '/Users/goze/python/ac/env/bin/python',
    },
  ],
}