{"id":13487425,"url":"https://github.com/eggjs/cluster","last_synced_at":"2025-03-27T21:32:30.224Z","repository":{"id":10024433,"uuid":"61421551","full_name":"eggjs/cluster","owner":"eggjs","description":"cluster manager for egg","archived":false,"fork":false,"pushed_at":"2024-12-19T13:45:16.000Z","size":418,"stargazers_count":221,"open_issues_count":8,"forks_count":57,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-12-19T14:44:52.840Z","etag":null,"topics":["cluster","egg","process-manager"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eggjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-18T07:02:25.000Z","updated_at":"2024-12-19T13:43:52.000Z","dependencies_parsed_at":"2023-01-13T15:41:57.288Z","dependency_job_id":"33001363-6ed9-42b7-ab78-acf5a1a1b5e1","html_url":"https://github.com/eggjs/cluster","commit_stats":{"total_commits":161,"total_committers":25,"mean_commits":6.44,"dds":0.7701863354037267,"last_synced_commit":"d89296015abed1bc7d097bbbb20020fd1a526d8d"},"previous_names":["eggjs/cluster"],"tags_count":65,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fcluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fcluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fcluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fcluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/cluster/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245750649,"owners_count":20666209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cluster","egg","process-manager"],"created_at":"2024-07-31T18:00:59.119Z","updated_at":"2025-03-27T21:32:30.198Z","avatar_url":"https://github.com/eggjs.png","language":"JavaScript","funding_links":[],"categories":["仓库"],"sub_categories":["[内置插件](https://eggjs.org/zh-cn/basics/plugin.html#%E6%8F%92%E4%BB%B6%E5%88%97%E8%A1%A8)"],"readme":"# egg-cluster\n\n[![NPM version][npm-image]][npm-url]\n[![CI](https://github.com/eggjs/cluster/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/cluster/actions/workflows/nodejs.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n[![Node.js Version](https://img.shields.io/node/v/@eggjs/cluster.svg?style=flat)](https://nodejs.org/en/download/)\n\n[npm-image]: https://img.shields.io/npm/v/@eggjs/cluster.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@eggjs/cluster\n[codecov-image]: https://codecov.io/github/eggjs/cluster/coverage.svg?branch=master\n[codecov-url]: https://codecov.io/github/eggjs/cluster?branch=master\n[snyk-image]: https://snyk.io/test/npm/@eggjs/cluster/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/@eggjs/cluster\n[download-image]: https://img.shields.io/npm/dm/@eggjs/cluster.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@eggjs/cluster\n\nCluster Manager for EggJS\n\n## Install\n\n```bash\nnpm i @eggjs/cluster\n```\n\n## Usage\n\nCommonJS\n\n```js\nconst { startCluster } = require('@eggjs/cluster');\n\nstartCluster({\n  baseDir: '/path/to/app',\n  framework: '/path/to/framework',\n});\n```\n\nYou can specify a callback that will be invoked when application has started.\nHowever, master process will exit when catch an error.\n\n```js\nstartCluster(options).then(() =\u003e {\n  console.log('started');\n});\n```\n\nESM and TypeScript\n\n```ts\nimport { startCluster } from '@eggjs/cluster';\n\nstartCluster({\n  baseDir: '/path/to/app',\n  framework: '/path/to/framework',\n});\n```\n\n## Options\n\n| Param        | Type      | Description                              |\n| ------------ | --------- | ---------------------------------------- |\n| baseDir      | `String`  | directory of application                 |\n| framework    | `String`  | specify framework that can be absolute path or npm package |\n| plugins      | `Object`  | plugins for unittest                     |\n| workers      | `Number`  | numbers of app workers                   |\n| sticky       | `Boolean` | sticky mode server                       |\n| port         | `Number`  | port                                     |\n| debugPort    | `Number`  | the debug port only listen on http protocol |\n| https        | `Object`  | start a https server, note: `key` / `cert` / `ca` should be full path to file |\n| require      | `Array\\|String` | will inject into worker/agent process |\n| pidFile      | `String`  | will save master pid to this file |\n| startMode    | `String`  | default is 'process', use 'worker_threads' to start the app \u0026 agent worker by worker_threads |\n| ports        | `Array`   | startup port of each app worker, such as: [7001, 7002, 7003], only effects when the startMode is 'worker_threads' |\n| env        | `String`   | custom env, default is process.env.EGG_SERVER_ENV |\n\n## Env\n\n`EGG_APP_CLOSE_TIMEOUT`: app worker boot timeout value\n\n`EGG_AGENT_CLOSE_TIMEOUT`: agent worker boot timeout value\n\n## License\n\n[MIT](LICENSE)\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=eggjs/cluster)](https://github.com/eggjs/cluster/graphs/contributors)\n\nMade with [contributors-img](https://contrib.rocks).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fcluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fcluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fcluster/lists"}