Skip to content

Commit

Permalink
Merge branch 'development' into new-usage-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
wallet77 committed Mar 19, 2018
2 parents 0914e2a + c65595f commit 4ae2769
Show file tree
Hide file tree
Showing 38 changed files with 1,745 additions and 1,769 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ node_js:
- "4"
- "6"
- "8"
- "0.12"
os:
- linux
before_install:
Expand Down
2 changes: 1 addition & 1 deletion ADVANCED_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
- [Without Keymetrics](#without-keymetrics)
- [With Keymetrics](#with-keymetrics)

### Deployment - ecosystem.json
### Deployment - ecosystem.config.js

- [Getting started with deployment](#deployment)
- [Deployment options](#deployment-help)
Expand Down
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<img src="https://badge.fury.io/js/pm2.svg" alt="npm version" height="18">
</a>

<a href="https://www.npmjs.com/package/pm2" title="PM2 on NPM">
<a href="https://npmcharts.com/compare/pm2?minimal=true" title="PM2 on NPM">
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/pm2.svg?style=flat-square"/>
</a>

Expand Down Expand Up @@ -70,6 +70,21 @@ Your app is now daemonized, monitored and kept alive forever.

[More about Process Management](http://pm2.keymetrics.io/docs/usage/process-management/)

### Container Support

With the drop-in replacement command for `node`, called `pm2-runtime`, run your Node.js application in a proper production environment.
We also offer an [officialy supported Docker image](https://hub.docker.com/r/keymetrics/pm2/).

Using it is seamless:

```
FROM keymetrics/pm2:latest-alpine
[...]
CMD [ "pm2-runtime", "npm", "--", "start" ]
```

[Read More about the dedicated integration](http://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/)

### Managing a Process

Once applications are started you can manage them easily:
Expand Down Expand Up @@ -130,21 +145,6 @@ Seamlessly supported by all major Node.js frameworks and any Node.js application

[More informations about how PM2 make clustering easy](https://keymetrics.io/2015/03/26/pm2-clustering-made-easy/)

### Container Support

With the drop-in replacement command for `node`, called `pm2-runtime`, run your Node.js application in a proper production environment.
We also offer an [officialy supported Docker image](https://hub.docker.com/r/keymetrics/pm2/).

Using it is seamless:

```
FROM keymetrics/pm2:latest-alpine
[...]
CMD [ "pm2-runtime", "npm", "--", "start" ]
```

[Read More about the dedicated integration](http://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/)

### Terminal Based Monitoring

![Monit](https://github.com/Unitech/pm2/raw/master/pres/pm2-monit.png)
Expand Down Expand Up @@ -293,7 +293,6 @@ $ pm2 reset [app-name] # Reset all counters
$ pm2 stop all # Stop all apps
$ pm2 stop 0 # Stop process with id 0
$ pm2 restart all # Restart all apps
$ pm2 gracefulReload all # Gracefully reload all apps in cluster mode
$ pm2 delete all # Kill and delete all apps
$ pm2 delete 0 # Delete app with id 0

Expand Down
39 changes: 20 additions & 19 deletions bin/pm2
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function checkCompletion(){
return data.short;
}), data);
// array containing commands after which process name should be listed
var cmdProcess = ['stop', 'restart', 'scale', 'reload', 'gracefulReload', 'delete', 'reset', 'pull', 'forward', 'backward', 'logs', 'describe', 'desc', 'show'];
var cmdProcess = ['stop', 'restart', 'scale', 'reload', 'delete', 'reset', 'pull', 'forward', 'backward', 'logs', 'describe', 'desc', 'show'];

if (cmdProcess.indexOf(data.prev) > -1) {
pm2.list(function(err, list){
Expand Down Expand Up @@ -292,6 +292,9 @@ commander.command('start <name|file|ecosystem|id...>')
else {
// Commander.js patch
cmd = patchCommanderArg(cmd);
if (cmd.length === 0) {
cmd = [cst.APP_CONF_DEFAULT_FILE];
}
async.forEachLimit(cmd, 1, function(script, next) {
pm2.start(script, commander, next);
}, function(err) {
Expand Down Expand Up @@ -402,21 +405,19 @@ commander.command('reload <name|all>')
pm2.reload(pm2_id, commander);
});

//
// Reload process(es)
//
commander.command('gracefulReload <name|all>')
.description('gracefully reload a process. Send a "shutdown" message to close all connections.')
.action(function(pm2_id) {
pm2.gracefulReload(pm2_id, commander);
});

commander.command('id <name>')
.description('get process id by name')
.action(function(name) {
pm2.getProcessIdByName(name);
});

// Inspect a process
commander.command('inspect <name>')
.description('inspect a process')
.action(function(cmd) {
pm2.inspect(cmd, commander);
});

//
// Stop and delete a process by name from database
//
Expand Down Expand Up @@ -624,6 +625,15 @@ commander.command('dump')
pm2.dump();
}));

//
// Delete dump file
//
commander.command('cleardump')
.description('Create empty dump file')
.action(failOnUnknown(function() {
pm2.clearDump();
}));

//
// Save processes to file
//
Expand Down Expand Up @@ -903,15 +913,6 @@ commander.command('backward <name>')
pm2.backward(pm2_name);
});

//
// Force PM2 to trigger garbage collection
//
commander.command('gc')
.description('force PM2 to trigger garbage collection')
.action(function() {
pm2.forceGc();
});

//
// Perform a deep update of PM2
//
Expand Down
2 changes: 1 addition & 1 deletion constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var csts = {

TEMPLATE_FOLDER : p.join(__dirname, 'lib/templates'),

APP_CONF_DEFAULT_FILE : 'ecosystem.json',
APP_CONF_DEFAULT_FILE : 'ecosystem.config.js',
APP_CONF_TPL : 'ecosystem.tpl',
APP_CONF_TPL_SIMPLE : 'ecosystem-simple.tpl',
SAMPLE_CONF_FILE : 'sample-conf.js',
Expand Down
2 changes: 1 addition & 1 deletion examples/misc-examples/graceful-exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* Example of graceful exit
*
* $ pm2 gracefulReload all
* $ pm2 reload all
*/

process.on('message', function(msg) {
Expand Down
27 changes: 0 additions & 27 deletions examples/sourcemap-auto-resolve/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,33 +399,6 @@ API.prototype.update = function(cb) {
return false;
};

/**
* Graceful Reload an application
*
* @param {String} process_name Application Name or All
* @param {Object} opts Options
* @param {Function} cb Callback
*/
API.prototype.gracefulReload = function(process_name, opts, cb) {
var that = this;

if (typeof(opts) == "function") {
cb = opts;
opts = {};
}

//Common.printOut(conf.PREFIX_MSG_WARNING + chalk.bold.yellow('Warning gracefulReload will be soon deprecated'));
//Common.printOut(conf.PREFIX_MSG_WARNING + chalk.bold.yellow('Use http://pm2.keymetrics.io/docs/usage/signals-clean-restart/ instead'));

if (Common.isConfigFile(process_name))
that._startJson(process_name, commander, 'softReloadProcessId');
else {
if (opts && !opts.updateEnv)
Common.printOut(IMMUTABLE_MSG);
that._operate('softReloadProcessId', process_name, opts, cb);
}
};

/**
* Reload an application
*
Expand Down
Loading

0 comments on commit 4ae2769

Please sign in to comment.