Comparing version 0.8.1 to 0.8.2
# 0.8.2 | ||
- Adds option to switch to a different user/group before starting a managed process #329 | ||
- watch doesnt watch node_module folder | ||
- default log files and pid files location can be overidded by PM2_LOG_DIR / PM2_PID_DIR | ||
# 0.8.1 | ||
@@ -3,0 +10,0 @@ |
@@ -16,4 +16,4 @@ // | ||
DEFAULT_FILE_PATH : DEFAULT_FILE_PATH, | ||
PM2_LOG_FILE_PATH : p.join(p.resolve(process.env.HOME, '.pm2'), 'pm2.log'), | ||
PM2_PID_FILE_PATH : p.join(p.resolve(process.env.HOME, '.pm2'), 'pm2.pid'), | ||
PM2_LOG_FILE_PATH : p.join(process.env.PM2_LOG_DIR || p.resolve(process.env.HOME, '.pm2'), 'pm2.log'), | ||
PM2_PID_FILE_PATH : p.join(process.env.PM2_PID_DIR || p.resolve(process.env.HOME, '.pm2'), 'pm2.pid'), | ||
DEFAULT_PID_PATH : p.join(DEFAULT_FILE_PATH, 'pids'), | ||
@@ -20,0 +20,0 @@ DEFAULT_LOG_PATH : p.join(DEFAULT_FILE_PATH, 'logs'), |
@@ -1,2 +0,1 @@ | ||
var commander = require('commander'); | ||
@@ -50,2 +49,6 @@ var fs = require('fs'); | ||
appConf['watch'] = true; | ||
if (commander.runAsUser) | ||
appConf['run_as_user'] = commander.runAsUser; | ||
if (commander.runAsGroup) | ||
appConf['run_as_group'] = commander.runAsGroup; | ||
@@ -821,3 +824,3 @@ if (commander.executeCommand) | ||
UX.dispAsTable(list); | ||
printOut(' Use `pm2 describe <id>` to get more details'); | ||
printOut(' Use `pm2 desc[ribe] <id>` to get more details'); | ||
} | ||
@@ -824,0 +827,0 @@ |
@@ -64,3 +64,3 @@ var Table = require('cli-table'); | ||
var table = new Table({ | ||
head: ['App Name', 'id', 'mode', 'PID', 'status', 'port', 'Restarted', 'Uptime', 'memory', 'watching'], | ||
head: ['App name', 'id', 'mode', 'PID', 'status', 'port', 'restarted', 'uptime', 'memory', 'watching'], | ||
colAligns : ['left', 'left', 'left', 'left', 'left', 'left', 'right', 'left', 'right', 'right'], | ||
@@ -67,0 +67,0 @@ style : {'padding-left' : 1, head : ['cyan', 'bold'], border : ['white'], compact : true} |
@@ -110,2 +110,3 @@ // ProcessContainer.js | ||
startLogging(function () { | ||
process.on('uncaughtException', function uncaughtListener(err) { | ||
@@ -137,4 +138,15 @@ try { | ||
} | ||
}); | ||
// if we've been told to run as a different user or group (e.g. because they have fewer | ||
// privileges), switch to that user before importing any third party application code. | ||
if (process.env.run_as_group) { | ||
process.setgid(process.env.run_as_group); | ||
} | ||
if (process.env.run_as_user) { | ||
process.setuid(process.env.run_as_user); | ||
} | ||
// Get the script & exec | ||
@@ -141,0 +153,0 @@ require(script); |
@@ -22,3 +22,3 @@ var chokidar = require('chokidar') | ||
{ | ||
ignored: /[\/\\]\./, | ||
ignored: /[\/\\]\.|node_modules/, | ||
persistent: false, | ||
@@ -25,0 +25,0 @@ ignoreInitial: true, |
{ | ||
"name": "pm2", | ||
"preferGlobal": "true", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"os" : [ "!win32" ], | ||
@@ -6,0 +6,0 @@ "man" : "./man/pm2.1", |
@@ -199,2 +199,6 @@ # ![PM2](https://github.com/unitech/pm2/raw/master/pres/top-logo-wo.png) | ||
$ pm2 start app.js -i max -e err.log -o out.log # Will start and generate a configuration file | ||
$ pm2 --run-as-user foo start app.js # Start app.js as user foo instead of root (pm2 must be running as root) | ||
$ pm2 --run-as-user foo --run-as-group bar start app.js # Start app.js as foo:bar instead of root:root (pm2 must be running as root) | ||
``` | ||
@@ -239,2 +243,4 @@ | ||
--node-args <node_args> space-delimited arguments to pass to node in cluster mode - e.g. --node-args="--debug=7001 --trace-deprecation" | ||
--run-as-user <run_as_user> The user or uid to run a managed process as | ||
--run-as-group <run_as_group> The group or gid to run a managed process as | ||
``` | ||
@@ -356,7 +362,7 @@ | ||
This special feature has been added to PM2 a while ago. | ||
As opposed to `restart`, which kills and restarts the process, `reload` achieves a 0-second-downtime reload. | ||
**Warning** It only works for apps in *cluster mode* (the default mode), that uses HTTP/HTTPS/Socket connections. | ||
**Warning** This feature only works for apps in *cluster mode* (the default mode), that uses HTTP/HTTPS/Socket connections. | ||
Reloading an app: | ||
To reload an app: | ||
@@ -377,2 +383,3 @@ ```bash | ||
Graceful reload is a mechanism that will send a *shutdown* message to your process before reloading it. | ||
You can control the time that the app has to shutdown via the `PM2_GRACEFUL_TIMEOUT` environment variable. | ||
@@ -490,3 +497,3 @@ Example: | ||
"name" : "auto-kill", | ||
"script" : "./examples/killfast.js" | ||
"script" : "./examples/killfast.js", | ||
"min_uptime" : "100", | ||
@@ -493,0 +500,0 @@ "exec_mode" : "fork_mode", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
713486
128
4177
817
59