Mini service discovery in Ruby
I recently extracted MiniDisc from a personal project I've been working on. It offers a single line interface for common patterns in service discovery that I'd been redundantly implementing.
Under the hood it wraps the DNSSD gem and is cross compatible with services using that. It adds helpers for common tasks like matching services by name, dynamically overriding discovery, error handling, logging
- dns-sd
- avahi 0.6.25+ (plus libavahi-compat-libdnssd-dev on Debian)
To broadcast a service use something like:
require "minidisc"
MiniDisc::Network.add(:http, 8080, id: "my-service-instance1")
To discover other services use
MiniDisc::Network.find_all(:http, id: /^my-service/) do |services|
...
end
gem install minidisc
or when Bundler, add this to your Gemfile
gem "minidisc"
Apache 2.0, See LICENSE file
Copyright (c) 2017-2019 Ari Russo