Deploy node application with pm2-deploy
npm install grunt-pm2-deployDeploy node application with pm2-deploy
[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
- 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.
As for this ecosystem.json,
``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:
`shell`
$ grunt pm2deploy:production # deploy using production env
$ grunt pm2deploy:dev # deploy using dev env
`bash`
$ npm install grunt-pm2-deploy --save-dev
command._$3
#### ecosystemFile
Type:
String
Default: 'ecosystem.json' ecosystem file name.
Tests
To run the test suite, first install the dependencies, then run
npm test:`bash
$ npm install
$ npm test
`` MIT
[npm-image]: https://img.shields.io/npm/v/grunt-pm2-deploy.svg
[npm-url]: https://npmjs.org/package/grunt-pm2-deploy
[travis-image]: https://travis-ci.org/gifff/grunt-pm2-deploy.svg?branch=master
[travis-url]: https://travis-ci.org/gifff/grunt-pm2-deploy