grunt-pm2-deploy

0.2.0 • Public • Published

grunt-pm2-deploy

Deploy node application with pm2-deploy

NPM Version Build Status

What this is

  • A simple grunt task for pm2 deployment system
  • This task executes pm2 deploy command. Task target will be used as the environment.
  • If remote server has to be setup, this task does it.

Usage

As for this ecosystem.json,

{
  "apps" : [{
    "name"      : "API",
    "script"    : "app.js",
    "env": {
      "COMMON_VARIABLE": "true"
    },
    "env_production" : {
      "NODE_ENV": "production"
    }
  },{
    "name"      : "WEB",
    "script"    : "web.js"
  }],
  "deploy" : {
    "production" : {
      "user" : "node",
      "host" : "212.83.163.1",
      "ref"  : "origin/master",
      "repo" : "git@github.com:repo.git",
      "path" : "/var/www/production",
      "post-deploy" : "pm2 startOrRestart ecosystem.json --env production"
    },
    "dev" : {
      "user" : "node",
      "host" : "212.83.163.1",
      "ref"  : "origin/master",
      "repo" : "git@github.com:repo.git",
      "path" : "/var/www/development",
      "post-deploy" : "pm2 startOrRestart ecosystem.json --env dev",
      "env"  : {
        "NODE_ENV": "dev"
      }
    }
  }
}

these commands are available:

$ grunt pm2deploy:production # deploy using production env 
$ grunt pm2deploy:dev # deploy using dev env 

Installation

$ npm install grunt-pm2-deploy --save-dev

pm2deploy task

Run this task with the grunt pm2deploy command.

Options

ecosystemFile

Type: String
Default: 'ecosystem.json'

ecosystem file name.

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

License

MIT

Package Sidebar

Install

npm i grunt-pm2-deploy

Weekly Downloads

3

Version

0.2.0

License

MIT

Last publish

Collaborators

  • giff