Git Product home page Git Product logo

ruby-nos's Introduction

#RubyNos alt tag Build Status Code Climate Test Coverage

A gem to provide microservices autodiscovery to Ruby microservices. This gem allows a microservice to publish its existence on a cloud, store other microservices information and public its API.

#Installation

Gem is available in RubyGems so you can install it using:

  gem install ruby_nos

#Configuration

You can configure the following characteristics of the gem:

###Agent characteristics

Every microservice will have an Agent object that will be the responsible of sending the messages to the cloud. You can configure these characteristics:

  • Cloud_uuid: The identifier of the cloud where all the microservices will be exchanging messages.
  • Port: UDP port where the Agent will be listening to other microservices messages.
  • Group_address: The IP group where all the microservices will be listening to the messages.
  • Time_between_messages: Allows to specify how much time will pass between the keep alive messages.
  • Hops: Number of hops for the messages.

An example of configuration would be:

  config = load_file('ruby_nos')
  RubyNos.configure do |c|
    c.cloud_uuid = config['cloud']
    c.port = config['port']
    c.group_address = config['group_address']
    c.time_between_messages = config['time_between_messages']
  end

To make the agent start sending and listening to messages you will have to add the following line to your code:

    RubyNos::Agent.new.start!

###Publish an API

To publish the API of a microservice you will have to create a RestAPI agent and associate it to the Agent.

    ruby_nos_api = RubyNos::RestApi.new
    ruby_nos_agent.rest_api = ruby_nos_api

To publish an endpoint you have to add to the rest_api object.

    ruby_nos_api.add_endpoint(path: <endpoint path> , type: <"PUB", "HCK", "INT">, port: <application port>)

You will have to specify the type of the endpoint, there are three types supported right now:

  • PUBLIC(PUB): If the endpoint belongs to a public API.
  • INTERNAL(INT): If the endpoint belongs to an internal API.
  • HEALTHCHECK(HCK): For a healthcheck endpoint.

License

Released under the MIT License. See the LICENSE file for further details.

This project has been powered and developed by Workshare ltd.

ruby-nos's People

Contributors

mariaclrd avatar manuelmorales avatar

Watchers

Albino Tonnina avatar James Cloos avatar  avatar

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.