2.0.3 • Published 3 years ago

ctd v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

ctd

this project was fork the package of cfork, and rewrite by ts.

we found cfork can not fork different worker by env

cluster fork and restart easy way.

  • Easy fork with worker file path
  • Handle worker restart, even it was exit unexpected.
  • Auto error log process uncaughtException event
  • set envs, worker count is length of envs ,and every worker's env different. if worker was exit because of configFile, will not refork.

Install

$ npm install ctd --save

Usage

Example

// start your nodejs app
ctd start app.js

// stop your nodejs app
ctd stop

Options

options can be an object or a file(config path), you can edit content of your config file and it will work 1 minute later

the file name is .config.json at your app baseDir

  • name: your app name,default your package.json name
  • exec : exec file path
  • args : exec arguments
  • count : fork worker nums, default is os.cpus().length
  • duration: default is 60000, one minute (so, the refork times < limit / duration)
  • env: attach some environment variable key-value pairs to the worker / slave process, default to an empty object.
  • model: default cluster,you can set fork
  • evns: if you want every worker has different env config ,you can set this field, default is [].example, envs:{name:1},{name:2}
  • clusterModel:
    • 'both':every worker has same evn config
    • 'each':every worker has different evn config
  • callback: when the worker was exit ,callback will be wake up

Change log

  • 2021.9.7
    • update readme file
    • update error of config env types
2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.26

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.30

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.16

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.15

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago