Skip to content

Commit

Permalink
Merge pull request #3938 from Unitech/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Unitech committed Oct 3, 2018
2 parents 6d85f4c + dc2c366 commit 9178610
Show file tree
Hide file tree
Showing 84 changed files with 2,453 additions and 1,489 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ currentTagChangelog.md
joblog-X
test/fixtures/path-check*.txt
yarn.lock
*.tar.gz
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ os:
- linux
before_install:
- sudo apt-get -qq update
- sudo apt-get install parallel
- sudo apt-get install python3
- sudo apt-get install php5-cli
services:
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@

## 3.2.0 (3/10/18)

### Features

- package.json version field retrieval and display in pm2 ls, pm2 show, pm2 monit
- pm2 internal configuration system via `pm2 set pm2:key value`, attached to pm2.user_conf
- add the .user field (CLI + Config) to set the user to start the application with
- add the .time field (CLI + Config) to enable default logs date prefix
- max_memory_restart now triggers a reload
- pm2 env <pm_id> command to display the environment the application is running with
- exponential backoff restart delay via `--exp-backoff-restart-delay <ms>` with reset mechanism
- new timing library on PM2 daemon (increase log througput, reduce CPU usage and memory usage)
- better user management system with username resolution to uid
- websocket default switch for pm2 plus
- new module management system (`pm2 package <folder>`, `pm2 publish <folder>`, `pm2 install <tarball>`)

### Fix

- @pm2/io 2.4 (restart > 10.0)
- restart behavior tested
- fix module version parsing
- module system refactoring (TAR + NPM)
- fix watch_delay in config file

## 3.1.3 (20/09/18)

### Features
Expand Down
28 changes: 21 additions & 7 deletions bin/pm2
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ commander.version(pkg.version)
.option('-l --log [path]', 'specify log file which gathers both stdout and stderr')
.option('--log-type <type>', 'specify log output style (raw by default, json optional)')
.option('--log-date-format <date format>', 'add custom prefix timestamp to logs')
.option('--time', 'enable time logging')
.option('--disable-logs', 'disable all logs storage')
.option('--env <environment_name>', 'specify which set of environment variables from ecosystem file must be injected')
.option('-a --update-env', 'force an update of the environment with restart/reload (-a <=> apply)')
Expand All @@ -57,6 +58,7 @@ commander.version(pkg.version)
.option('--listen-timeout <delay>', 'listen timeout on application reload')
.option('--max-memory-restart <memory>', 'Restart the app if an amount of memory is exceeded (in bytes)')
.option('--restart-delay <delay>', 'specify a delay between restarts (in milliseconds)')
.option('--exp-backoff-restart-delay <delay>', 'specify a delay between restarts (in milliseconds)')
.option('-x --execute-command', 'execute a program using fork system')
.option('--max-restarts [count]', 'only restart the script COUNT times')
.option('-u --user <username>', 'define user when generating startup script')
Expand Down Expand Up @@ -482,14 +484,14 @@ commander.command('update')
*/
commander.command('install <module|git:// url>')
.alias('module:install')
.option('--tarball', 'is local tarball')
.option('--http', 'is remote tarball')
.option('--docker', 'is docker container')
.option('--v1', 'install module in v1 manner (do not use it)')
.option('--safe [time]', 'keep module backup, if new module fail = restore with previous')
.description('install or update a module and run it forever')
.action(function(plugin_name, opts) {
if (opts.v1)
commander.v1 = true;
if (opts.safe)
commander.safe = opts.safe;
require('util')._extend(commander, opts)
pm2.install(plugin_name, commander);
});

Expand All @@ -513,12 +515,18 @@ commander.command('uninstall <module>')
pm2.uninstall(plugin_name);
});

commander.command('package [target]')
.description('Check & Package TAR type module')
.action(function(target) {
pm2.package(target);
});

commander.command('publish')
commander.command('publish [folder]')
.option('--npm', 'publish on npm')
.alias('module:publish')
.description('Publish the module you are currently on')
.action(function() {
pm2.publish();
.action(function(folder, opts) {
pm2.publish(folder, opts);
});

commander.command('set [key] [value]')
Expand Down Expand Up @@ -788,6 +796,12 @@ commander.command('info <id>')
pm2.describe(proc_id);
});

commander.command('env <id>')
.description('(alias) describe all parameters of a process id')
.action(function(proc_id) {
pm2.env(proc_id);
});

commander.command('show <id>')
.description('(alias) describe all parameters of a process id')
.action(function(proc_id) {
Expand Down
8 changes: 7 additions & 1 deletion constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var csts = {
ONLINE_STATUS : 'online',
STOPPED_STATUS : 'stopped',
STOPPING_STATUS : 'stopping',
WAITING_RESTART : 'waiting restart',
LAUNCHING_STATUS : 'launching',
ERRORED_STATUS : 'errored',
ONE_LAUNCH_STATUS : 'one-launch-status',
Expand All @@ -67,6 +68,11 @@ var csts = {
PM2_UPDATE : '../lib/API/pm2-plus/pres/motd.update',
DEFAULT_MODULE_JSON : 'package.json',

MODULE_BASEFOLDER: 'module',
MODULE_CONF_PREFIX: 'module-db-v2',
MODULE_CONF_PREFIX_TAR: 'tar-modules',

EXP_BACKOFF_RESET_TIMER : parseInt(process.env.EXP_BACKOFF_RESET_TIMER) || 30000,
REMOTE_PORT_TCP : isNaN(parseInt(process.env.KEYMETRICS_PUSH_PORT)) ? 80 : parseInt(process.env.KEYMETRICS_PUSH_PORT),
REMOTE_PORT : 41624,
REMOTE_HOST : 's1.keymetrics.io',
Expand Down Expand Up @@ -95,7 +101,7 @@ var csts = {
WORKER_INTERVAL : process.env.PM2_WORKER_INTERVAL || 30000,
KILL_TIMEOUT : process.env.PM2_KILL_TIMEOUT || 1600,
PM2_PROGRAMMATIC : typeof(process.env.pm_id) !== 'undefined' || process.env.PM2_PROGRAMMATIC,
PM2_LOG_DATE_FORMAT : process.env.PM2_LOG_DATE_FORMAT !== undefined ? process.env.PM2_LOG_DATE_FORMAT : 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
PM2_LOG_DATE_FORMAT : process.env.PM2_LOG_DATE_FORMAT !== undefined ? process.env.PM2_LOG_DATE_FORMAT : 'YYYY-MM-DDTHH:mm:ss'

};

Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions examples/echo/stdout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

setInterval(function() {
process.stdout.write('ooo')
}, 100)
1 change: 1 addition & 0 deletions examples/run-php-python-ruby-bash/echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@

while 1:
print("Start : %s" % time.ctime())
print("second line")
time.sleep(1)
Loading

0 comments on commit 9178610

Please sign in to comment.