Public | Automated Build

Last pushed: 9 months ago
Short Description
NGN Bridge.
Full Description

NGN Bridge

This image contains Alpine Linux, Node.js, NGN, and 0MQ.

The NGN Bridge acts as the glue between NGN microservices. It can be thought of
as an industrial-grade private message bus.

The Bridge is available as a Docker image.

Features

  1. Pub/Sub & Message Queue: The NGN Bridge provides a pub/sub event bus based
    on ZeroMQ. The message queue capabilities of 0MQ are included too.

  2. RPC API: NGN masks the complexity of TCP message handling by provisioning a
    remote procedure call "API". This provides "remote" functions for Node.js, allowing
    applications to seamlessly interact with the Bridge.

  3. Server-Sent Events: It is possible to connect to the bridge through a read-only
    web interface, using SSE. Details available in the Basic Startup section.

Usage

The NGN Bridge can be run on one or more servers, and bridges can be connected to
each other to create a network.

Basic Startup

docker run -d --name ngn-bridge -p 5555:5555 -p 443:443 ngnjs/bridge

This command will run the bridge as a daemon (-d), named ngn-bridge, available on
port 5555 (-p 5555:5555). It also makes a read-only web server available at https://myserver.com (-p 443:443) by mapping public port 443 to the private 443 container port. Web pages can use the browser's native EventSource to listen to the Bridge. This is also how the NGN.BUS "hears" events
from the server by default.

To use this in an application, use the NGN SDK. Let's say this server's domain name is myserver.com.

require('ngn')

NGN.BUS.connect('myserver.com') // Port 5555 is used by default. Use myserver.com:port to customize.

NGN.BUS.on('connected', function () {
  console.log('Now listening to the enterprise service bus.')
})

Keep in mind that port 5555 must be open on your firewall for this to work (see security section for additional options).

Security

The ports used by bridge are typically not open by default using most firewalls.
If you prefer to keep it this way, the NGN.BUS is capable of
using SSH tunnels to establish connections to these ports. SSH tunnels can be established
using a standard Linux account (username/password) or RSA keys (id_rsa).

This is a feature of the NGN SDK, which contains full details. The short version:

NGN.BUS.connect('myserver.com', // or myserver.com:custom_port
  {
    ssh: {
      port: 22,
      username: 'username',
      password: 'password'
    }
  }
)

// ----- OR -----
NGN.BUS.connect('myserver.com', // or myserver.com:custom_port
  {
    ssh: {
      port: 22,
      key: require('fs').readFileSync('/path/to/id_rsa')
    }
  }
)
Docker Pull Command
Owner
ngnjs
Source Repository

Comments (0)