0.0.2 • Published 1 year ago

bun-cluster-reload v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

bun-cluster-reload

pm2-like cluster with reload for bun

Installation

bun add bun-cluster-reload

Features

Example

import { ClusterRunner } from 'bun-cluster-reload';

const clusterRunner = new ClusterRunner({
  numCPUs: 2,
  logger: console,
  autorestart: true,
  waitReady: true,
});

await clusterRunner.start({
  command: ['bun', 'src/index.ts'],
  reloadSignal: 'SIGHUP',
  updateEnv: false,
});

Using with PM2

  • Set bun as pm2 interpreter as in official Bun guide
  • The target script should be the ClusterRunner file
    • Note that the clustering happens in bun not pm2. So you'll see a single process in pm2 monitoring
  • To reload, send predefined signal to process using pm2 send signal. For example:
    pm2 sendSignal SIGHUP app
0.0.2

1 year ago

0.0.1

1 year ago

0.0.1-beta.1

1 year ago