Neolithic Psychedelic Mushrooms
Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

pm2-service-discovery

1.0.1 • Public • Published

pm2-service-discovery

Synchronize services from consul to nodejs app managed by PM2.

How it works

This module propagate services changes using an event bus to services managed by PM2.

The module send config update to application :

  • Pragmatically when
    • PM2 start
    • PM2 launch a new service
    • Consul have a new configuration
  • Manually : pm2 trigger pm2-microservice reload

Sample

When the module is installed... in you code managed by pm2 :

process.on('message', (rs, err) => {
  if(err) return;
  if(rs && rs.topic === 'service:update') {
    const services = rs.data || [];

    console.log(JSON.stringify(services, null, 4));
  }
});

Configuration

key type default Description
service enum(consul) consul
consul object {}
consul.url url http://localhost:8500

Commands

reload : Ask Consul for config update

Keywords

none

install

npm i pm2-service-discovery

Downloadsweekly downloads

1

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability