pm2ship

1.0.2 • Public • Published

create a startup.coffee file

pm2Ship = require './lib/pm2/pm2Ship'
argv = require('yargs').argv;
config = require 'config'

apps = config.get 'pm2Ship.apps'

pm2Ship.app apps
.then (startedApps) ->
  for startedApp in startedApps
    console.log 'started:',startedApp
.catch (err) ->
  console.log 'err',err

process.on 'errException', (exception) ->
  console.log 'exception:', exception

sample config:

pm2Ship:
  apps:
#    Backend can not cluster by PM2 we use Nginx -> so duplicate by config
    -
      script: 'backend.coffee'
      nodename: pusher
      instances: 1
      max_memory_restart : '100M'
      exec_mode : 'cluster'
      env:
        PORT: 13000
    -
      script: 'backend.coffee'
      nodename: pusher
      instances: 1
      max_memory_restart : '100M'
      exec_mode : 'cluster'
      env:
        PORT: 13001

    -
      script: 'heartbeats.coffee'
      nodename: pusher
      instances: 1
      max_memory_restart : 100M
      exec_mode : cluster
      env:
        PORT: 0

coffee config

module.exports =
  pm2Start:
    apps: [
      {
      'script': 'myapp.coffee'
      'nodename': 'myHackingApp'
      'max_memory_restart': '100M'
      'instances': 1
      'exec_mode': 'cluster'
      }
    ]
      

Readme

Keywords

Package Sidebar

Install

npm i pm2ship

Weekly Downloads

2

Version

1.0.2

License

ISC

Last publish

Collaborators

  • duminhtam