Ruby gem implementing etcd-discovery
Default client isn't using SSL and tries http://localhost:4001
EtcdDiscovery.configure do |config|
config.use_ssl = true # Default: false
config.cacert = "/etc/ssl/cacert.pem" # nil
config.ssl_key = "/etc/ssl/service/private.key" # nil
config.ssl_cert = "/etc/ssl/service/public.cert" # nil
config.host = "myhost" # Default: "localhost"
config.port = 4002 # Default: 4001
config.register_ttl = 5 # Default: 10
config.register_renew = 4 # Default: 8
end
hosts = EtcdDiscovery.get("service").all
hosts.each do |h|
puts h.to_uri
end
EtcdDiscovery.get('service').to_uri
EtcdDiscovery.get('service').one.to_uri
This will be run in a secondary thread.
EtcdDiscovery.register "service", {
'name' => "hostname", # Mandatory: The hostname of the service
'ports' => { # Mandatory: The ports opened by the service
'http'=> '80',
'https' => '443'
},
'user' => "testuser", # Optional: If your service use basic auth: the username to access your service
'password' => "secret", # Optional: If your service use basic auth: the password to access your service
'public' => true, # Optional: Is your service accessible via an external network (or via a load balancer). Setting this to true will enable credentials synchronization.
'critical' => true, # Optional: Is your service critical? This is just a tag and have no impact on the registration process
'private_hostname' => 'my-host.internal.com', # Optional: The hostname of the service in the private network
'private_ports' => { # Optional: The ports of the service in the private network
'http' => '8080',
'https' => '80443'
}
}
When a service is public, user and password are synced across all the hosts of the service.
You can fetch the current user and password using the object returned by the register method.
registration = EtcdDiscovery.register service, host
registration.user # The current user (it can change at any time)
registration.password # The current password (it can change at any time)
Bump new version number in:
CHANGELOG.md
README.md
etcd-discovery.gemspec
Commit, tag and create a new release:
version="1.1.1"
git switch --create release/${version}
git add CHANGELOG.md README.md etcd-discovery.gemspec
git commit -m "Bump v${version}"
git push --set-upstream origin release/${version}
gh pr create --reviewer=leo-scalingo --title "$(git log -1 --pretty=%B)"
Once the pull request merged, you can tag the new release.
git tag v${version}
git push origin master v${version}
gh release create v${version}
The title of the release should be the version number and the text of the release is the same as the changelog.