Coder Social home page Coder Social logo

tcoats / consul-utils Goto Github PK

View Code? Open in Web Editor NEW

This project forked from metocean/consul-utils

0.0 0.0 0.0 8.39 MB

Consul integration for RedWire - a dynamic, high performance, load balancing reverse proxy

License: MIT License

Shell 0.72% CoffeeScript 99.28%

consul-utils's Introduction

Consul Utilities

A set of utilities to work with consul from Node.js. Not full featured or architected well enough to call an API but a good start.

BuildStatus NPM version

Install

npm install consul-utils

Consul Utilities has no dependencies.

Example

The service class can be used in Redwire.

var RedWire = require('redwire');
var consul = require('consul-utils');

var redwire = new RedWire({ http: { port: 80 } });
var services = new consul.Service('localhost:8500', 'web', function(added, removed) {
  console.log(added.length + " added");
  console.log(removed.length + " removed");
});

redwire.http('example.com')
  .use(services.distribute())
  .use(redwire.proxy());

This code will monitor the service named 'web' from the consul server localhost:8500 and round-robin load balance to all current services, making sure to stop if they leave the cluster and start as they join.

The optional callback can be used for logging changes to the server pool.

TODO

  • Health Checks
  • Custom page when there are no servers

consul-utils's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.