# ctd

> deploy tool for nodejs app

Latest version **2.0.3** (published 2021-10-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install ctd
pnpm add ctd
yarn add ctd
bun add ctd
```

Provides the command `ctd`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2021-10-29 |
| First published | 2021-09-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 14.0.0 |
| Dependencies | 9 |
| Unpacked size | 42.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | juju |
| Maintainers | tong3jie |
| Keywords | cluster, cluster-fork, tfork, restart |

## Links

- npm: https://www.npmjs.com/package/ctd
- Repository: https://github.com/tong3jie/tfork
- Issues: https://github.com/tong3jie/tfork/issues
- npm.io page: https://npm.io/package/ctd

## Dependencies (9)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [dayjs](https://npm.io/package/dayjs.md) ^1.10.6
- [execa](https://npm.io/package/execa.md) ^5.1.1
- [tfork](https://npm.io/package/tfork.md) ^2.1.1
- [dotenv](https://npm.io/package/dotenv.md) ^10.0.0
- [winston](https://npm.io/package/winston.md) ^3.3.3
- [fs-extra](https://npm.io/package/fs-extra.md) ^10.0.0
- [inquirer](https://npm.io/package/inquirer.md) ^8.1.2
- [commander](https://npm.io/package/commander.md) ^8.1.0

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 2.0.3 (latest) — 2021-10-29
- 2.0.2 — 2021-10-28
- 2.0.1 — 2021-10-28
- 2.0.0 — 2021-10-28
- 1.0.30 — 2021-10-15
- 1.0.29 — 2021-10-15
- 1.0.28 — 2021-10-14
- 1.0.27 — 2021-10-14
- 1.0.26 — 2021-10-14
- 1.0.25 — 2021-10-12
- 1.0.24 — 2021-10-12
- 1.0.23 — 2021-10-12
- 1.0.22 — 2021-10-12
- 1.0.21 — 2021-10-11
- 1.0.20 — 2021-10-11
- … 23 more at https://npm.io/package/ctd/versions

## README

<!--
 * @author: juju
 * @Date: 2021-08-30 22:39:10
 * @LastEditTime: 2021-09-07 16:48:30
 * @LastEditors: juju
 * @Description: 
 * @FilePath: \deploy\README.md
-->
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

```bash
$ npm install ctd --save
```

## Usage

### Example

```bash
// 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

---
_Source: https://npm.io/package/ctd · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
