Skip to content

Commit 9178610

Browse files
authored
Merge pull request #3938 from Unitech/development
Development
2 parents 6d85f4c + dc2c366 commit 9178610

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2453
-1489
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ currentTagChangelog.md
1818
joblog-X
1919
test/fixtures/path-check*.txt
2020
yarn.lock
21+
*.tar.gz

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ os:
1010
- linux
1111
before_install:
1212
- sudo apt-get -qq update
13-
- sudo apt-get install parallel
1413
- sudo apt-get install python3
1514
- sudo apt-get install php5-cli
1615
services:

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
2+
## 3.2.0 (3/10/18)
3+
4+
### Features
5+
6+
- package.json version field retrieval and display in pm2 ls, pm2 show, pm2 monit
7+
- pm2 internal configuration system via `pm2 set pm2:key value`, attached to pm2.user_conf
8+
- add the .user field (CLI + Config) to set the user to start the application with
9+
- add the .time field (CLI + Config) to enable default logs date prefix
10+
- max_memory_restart now triggers a reload
11+
- pm2 env <pm_id> command to display the environment the application is running with
12+
- exponential backoff restart delay via `--exp-backoff-restart-delay <ms>` with reset mechanism
13+
- new timing library on PM2 daemon (increase log througput, reduce CPU usage and memory usage)
14+
- better user management system with username resolution to uid
15+
- websocket default switch for pm2 plus
16+
- new module management system (`pm2 package <folder>`, `pm2 publish <folder>`, `pm2 install <tarball>`)
17+
18+
### Fix
19+
20+
- @pm2/io 2.4 (restart > 10.0)
21+
- restart behavior tested
22+
- fix module version parsing
23+
- module system refactoring (TAR + NPM)
24+
- fix watch_delay in config file
25+
126
## 3.1.3 (20/09/18)
227

328
### Features

bin/pm2

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ commander.version(pkg.version)
4646
.option('-l --log [path]', 'specify log file which gathers both stdout and stderr')
4747
.option('--log-type <type>', 'specify log output style (raw by default, json optional)')
4848
.option('--log-date-format <date format>', 'add custom prefix timestamp to logs')
49+
.option('--time', 'enable time logging')
4950
.option('--disable-logs', 'disable all logs storage')
5051
.option('--env <environment_name>', 'specify which set of environment variables from ecosystem file must be injected')
5152
.option('-a --update-env', 'force an update of the environment with restart/reload (-a <=> apply)')
@@ -57,6 +58,7 @@ commander.version(pkg.version)
5758
.option('--listen-timeout <delay>', 'listen timeout on application reload')
5859
.option('--max-memory-restart <memory>', 'Restart the app if an amount of memory is exceeded (in bytes)')
5960
.option('--restart-delay <delay>', 'specify a delay between restarts (in milliseconds)')
61+
.option('--exp-backoff-restart-delay <delay>', 'specify a delay between restarts (in milliseconds)')
6062
.option('-x --execute-command', 'execute a program using fork system')
6163
.option('--max-restarts [count]', 'only restart the script COUNT times')
6264
.option('-u --user <username>', 'define user when generating startup script')
@@ -482,14 +484,14 @@ commander.command('update')
482484
*/
483485
commander.command('install <module|git:// url>')
484486
.alias('module:install')
487+
.option('--tarball', 'is local tarball')
488+
.option('--http', 'is remote tarball')
489+
.option('--docker', 'is docker container')
485490
.option('--v1', 'install module in v1 manner (do not use it)')
486491
.option('--safe [time]', 'keep module backup, if new module fail = restore with previous')
487492
.description('install or update a module and run it forever')
488493
.action(function(plugin_name, opts) {
489-
if (opts.v1)
490-
commander.v1 = true;
491-
if (opts.safe)
492-
commander.safe = opts.safe;
494+
require('util')._extend(commander, opts)
493495
pm2.install(plugin_name, commander);
494496
});
495497

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

518+
commander.command('package [target]')
519+
.description('Check & Package TAR type module')
520+
.action(function(target) {
521+
pm2.package(target);
522+
});
516523

517-
commander.command('publish')
524+
commander.command('publish [folder]')
525+
.option('--npm', 'publish on npm')
518526
.alias('module:publish')
519527
.description('Publish the module you are currently on')
520-
.action(function() {
521-
pm2.publish();
528+
.action(function(folder, opts) {
529+
pm2.publish(folder, opts);
522530
});
523531

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

799+
commander.command('env <id>')
800+
.description('(alias) describe all parameters of a process id')
801+
.action(function(proc_id) {
802+
pm2.env(proc_id);
803+
});
804+
791805
commander.command('show <id>')
792806
.description('(alias) describe all parameters of a process id')
793807
.action(function(proc_id) {

constants.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ var csts = {
4848
ONLINE_STATUS : 'online',
4949
STOPPED_STATUS : 'stopped',
5050
STOPPING_STATUS : 'stopping',
51+
WAITING_RESTART : 'waiting restart',
5152
LAUNCHING_STATUS : 'launching',
5253
ERRORED_STATUS : 'errored',
5354
ONE_LAUNCH_STATUS : 'one-launch-status',
@@ -67,6 +68,11 @@ var csts = {
6768
PM2_UPDATE : '../lib/API/pm2-plus/pres/motd.update',
6869
DEFAULT_MODULE_JSON : 'package.json',
6970

71+
MODULE_BASEFOLDER: 'module',
72+
MODULE_CONF_PREFIX: 'module-db-v2',
73+
MODULE_CONF_PREFIX_TAR: 'tar-modules',
74+
75+
EXP_BACKOFF_RESET_TIMER : parseInt(process.env.EXP_BACKOFF_RESET_TIMER) || 30000,
7076
REMOTE_PORT_TCP : isNaN(parseInt(process.env.KEYMETRICS_PUSH_PORT)) ? 80 : parseInt(process.env.KEYMETRICS_PUSH_PORT),
7177
REMOTE_PORT : 41624,
7278
REMOTE_HOST : 's1.keymetrics.io',
@@ -95,7 +101,7 @@ var csts = {
95101
WORKER_INTERVAL : process.env.PM2_WORKER_INTERVAL || 30000,
96102
KILL_TIMEOUT : process.env.PM2_KILL_TIMEOUT || 1600,
97103
PM2_PROGRAMMATIC : typeof(process.env.pm_id) !== 'undefined' || process.env.PM2_PROGRAMMATIC,
98-
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]'
104+
PM2_LOG_DATE_FORMAT : process.env.PM2_LOG_DATE_FORMAT !== undefined ? process.env.PM2_LOG_DATE_FORMAT : 'YYYY-MM-DDTHH:mm:ss'
99105

100106
};
101107

File renamed without changes.

examples/echo/stdout.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
setInterval(function() {
3+
process.stdout.write('ooo')
4+
}, 100)

examples/run-php-python-ruby-bash/echo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33

44
while 1:
55
print("Start : %s" % time.ctime())
6+
print("second line")
67
time.sleep(1)

0 commit comments

Comments
 (0)