Nothing has been indexed for 2.1.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  hound-dog:
    github: place-labs/hound-dog
    version: ~> 2.1.1

Then run:

shards install

shard.yml

No shard.yml has been indexed for 2.1.1. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

hound-dog

Build Status

Library for self-registration and service discovery that utilises Etcd for distributed key-value storage. Wraps service data in etcd within a rendezvous hash

Usage

require "hound-dog"

HoundDog.configure do |settings|
  settings.service_namespace = "service"  # namespace for services
  settings.etcd_host = "127.0.0.1"        # etcd connection config
  settings.etcd_port = 2379
  settings.etcd_ttl  = 30                 # TTL for leases
end

# Create a new Discovery instance
discovery = HoundDog::Discovery.new(
  service: "api",
  uri: "https://api1:3000",
)

# There are already some nodes in etcd
discovery.nodes          #=> [{name: "ulid1", uri: #<URI:0xdeadbeef @fragment=nil, @host="api0", @password=nil, @path="", @port=3000, @query=nil, @scheme="https", @user=nil>}]
discovery.find("sauce")  #=> {name: "ulid1", uri: #<URI:0xdeadbeef @fragment=nil, @host="api0", @password=nil, @path="", @port=3000, @query=nil, @scheme="https", @user=nil>}

# Register self to etcd
spawn(same_thread: true) { discovery.register }

# Rendezvous hash transparently updated
discovery.nodes  # [{name: "ulid1", uri: #<URI:0xdeadbeef @fragment=nil, @host="api0", @password=nil, @path="", @port=3000, @query=nil, @scheme="https", @user=nil>}, {name: "ulid2", uri: #<URI:0xbeefcafe @fragment=nil, @host="api0", @password=nil, @path="", @port=3000, @query=nil, @scheme="https", @user=nil>}]

etcd

Namespacing

All services are registered beneath configured service namespace, i.e. a node under namespace service will be keyed as service/#{service_name}/#{name}. Values are base64 encoded strings in the form uri.

Version

Developed against ETCD_API=3 and etcd-server v3.3.13, using etcd's JSON-gRPC API gateway.

Testing

$ crystal spec

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors