grunt-pm2-deploy
Deploy node application with pm2-deploy
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. require
-able files (*.js, *.json) can be used.
Tests
To run the test suite, first install the dependencies, then run npm test
:
$ npm install
$ npm test
License
MIT