pm2-deploy (1.0.2)
Published 2026-02-24 14:02:43 +00:00 by atheaadmin
Installation
registry=npm install pm2-deploy@1.0.2"pm2-deploy": "1.0.2"About this package
Deploy system for PM2
This is the module that allows to do pm2 deploy.
Documentation: http://pm2.keymetrics.io/docs/usage/deployment/
Instalation
$ npm install pm2-deploy
Programmatic Usage
var deployForEnv = require('pm2-deploy').deployForEnv;
// Define deploy configuration with target environments
var deployConfig = {
prod: {
user: 'node',
host: '212.83.163.168',
ref: 'origin/master',
repo: 'git@github.com:Unitech/eip-vitrine.git',
path: '/var/www/test-deploy'
},
dev: {
user: 'node',
host: '212.83.163.168',
ref: 'origin/master',
repo: 'git@github.com:Unitech/eip-vitrine.git',
path: '/var/www/test-dev'
}
};
// Invoke deployment for `dev` environment
deployForEnv(deployConfig, 'dev', [], function (err, args) {
if (err) {
console.error('Deploy failed:', err.message);
return console.error(err.stack);
}
console.log('Success!');
});
// Rollback `prod` environment
deployForEnv(deployConfig, 'prod', ['revert', 1], function (err, args) {
if (err) {
console.error('Rollback failed:', err.message);
return console.error(err.stack);
}
console.log('Success!');
});
API
Table of Contents
deployForEnv
Deploy to a single environment
Parameters
deployConfigobject object containing deploy configs for all environmentsenvstring the name of the environment to deploy toargsarray custom deploy command-line argumentscbDeployCallback done callback
Returns boolean return value is always false
DeployCallback
Type: Function
Parameters
Dependencies
Dependencies
| ID | Version |
|---|---|
| run-series | ^1.1.8 |
| tv4 | ^1.3.0 |
Development Dependencies
| ID | Version |
|---|---|
| better-assert | ^1.0.2 |
| documentation | ^11.0.0 |
| eslint | ^5.16.0 |
| eslint-config-semistandard | ^13.0.0 |
| eslint-config-standard | ^12.0.0 |
| eslint-plugin-import | ^2.14.0 |
| eslint-plugin-node | ^8.0.1 |
| eslint-plugin-promise | ^4.0.1 |
| eslint-plugin-standard | ^4.0.0 |
| mocha | ^5.2.0 |
| should | ^13.2.3 |