{"action":"created","issue":{"url":"https://api.github.com/repos/eBay/fabio/issues/46","repository_url":"https://api.github.com/repos/eBay/fabio","labels_url":"https://api.github.com/repos/eBay/fabio/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/eBay/fabio/issues/46/comments","events_url":"https://api.github.com/repos/eBay/fabio/issues/46/events","html_url":"https://github.com/eBay/fabio/issues/46","id":131692131,"number":46,"title":"Externalize registry backends","user":{"login":"composer22","id":624112,"avatar_url":"https://avatars.githubusercontent.com/u/624112?v=3","gravatar_id":"","url":"https://api.github.com/users/composer22","html_url":"https://github.com/composer22","followers_url":"https://api.github.com/users/composer22/followers","following_url":"https://api.github.com/users/composer22/following{/other_user}","gists_url":"https://api.github.com/users/composer22/gists{/gist_id}","starred_url":"https://api.github.com/users/composer22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/composer22/subscriptions","organizations_url":"https://api.github.com/users/composer22/orgs","repos_url":"https://api.github.com/users/composer22/repos","events_url":"https://api.github.com/users/composer22/events{/privacy}","received_events_url":"https://api.github.com/users/composer22/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eBay/fabio/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/eBay/fabio/labels/thinking","name":"thinking","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":26,"created_at":"2016-02-05T16:48:22Z","updated_at":"2016-03-16T00:38:11Z","closed_at":null,"body":"Fabio is heavily reliant on Consul for service registration, discovery and heartbeat checking. This is a PULL situation. It would be nice if Fabio could complete it's RESTful API as a generic registry interface that could provide a PUSH function and remove any internal dependencies. \r\nThis is outside of API request in the Issues list of Fabio.\r\n\r\nHow would this work?\r\n\r\nLet's go to the PowerPoint:\r\n\r\n1) An external registry (whatever it might be) would call the fabio api and register a service. The request would contain all the useful information for the \"Add route for service svc from src to dst and assign tags\" command but in json format. Included in the json request would be an additional callback attribute string to either a URL or WS. For example:\r\n\"serviceCheck\":\"http://192.168.2.7:80/is_service_up/19382493\"\r\nor\r\n\"serviceCheck\":\"ws://192.168.2.7:1234/19382493\"\r\nor generically\r\n\"serviceCheck\":\"http://192.168.2.7:80/health\"\r\n\r\nFabio doesn't care too much about the value.\r\n\r\n2) Fabio would register this request in it's table.\r\n3) Fabio would ws attach or use the serviceCheck URL to periodically see if the registry or service is still alive. (in case the registry itself went down or the registry failed in it's attempt to issue an unregister call to Fabio)\r\n4) An external registry would call fabio occasionally to deregister a service that was no longer available.  The request would contain all the useful information for the route del <svc> <src> <dst> command.\r\n5) Fabio would deregister this service from the Table.\r\n\r\n\"route weight\" could also be provided as apart of the API.\r\n\r\nThis would provide a means for **any** external registry to utilize Fabio instead of having a dependency on only Consul or having to compile in another pkg with the type Backend interface to support an interface. Services themselves might even be able to register to Fabio directly without middleware as long as they met the API requirement."},"comment":{"url":"https://api.github.com/repos/eBay/fabio/issues/comments/197086273","html_url":"https://github.com/eBay/fabio/issues/46#issuecomment-197086273","issue_url":"https://api.github.com/repos/eBay/fabio/issues/46","id":197086273,"user":{"login":"composer22","id":624112,"avatar_url":"https://avatars.githubusercontent.com/u/624112?v=3","gravatar_id":"","url":"https://api.github.com/users/composer22","html_url":"https://github.com/composer22","followers_url":"https://api.github.com/users/composer22/followers","following_url":"https://api.github.com/users/composer22/following{/other_user}","gists_url":"https://api.github.com/users/composer22/gists{/gist_id}","starred_url":"https://api.github.com/users/composer22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/composer22/subscriptions","organizations_url":"https://api.github.com/users/composer22/orgs","repos_url":"https://api.github.com/users/composer22/repos","events_url":"https://api.github.com/users/composer22/events{/privacy}","received_events_url":"https://api.github.com/users/composer22/received_events","type":"User","site_admin":false},"created_at":"2016-03-16T00:38:10Z","updated_at":"2016-03-16T00:38:10Z","body":"You don't have to provide any plugin except one for Consul. We, out here, can do the rest as we need them. Just create an plugin protocol for us to follow.\r\n\r\nAlso you don't have to deal with two -- one of kv and one for services.  Assume the plugin, whatever we develop will handle both requests. ONE plugin for both.\r\n\r\nJust to show you that it's possible, we could do this now without your coding anything. All we have to do is create a MOCK of Consul...make a server that looks like Consul to Fabio but really its just a hash of structures for the KV and using Docker API. Fabio would never know. It would just make Consul calls to a IP/Port/ Consuls API become the standard we implement. It would SPOOF Fabio by making it think it was a Consul instance.\r\n\r\nBut is this a solution? I don't think so. Removing your internal consul libraries and building a RPC/plugin would be the more mature way, using the Consul commands you are using as a standard to call other things.\r\n\r\nI still don't believe you grasp this elegence yet."}}