I’ve been diving into golang recently, partly by accident, given that we decided to use an open source docker service registration bridge called Registrator. Registrator fills in a niche with docker Containers – how to get them into an existing service registry such as (the excellent) consul.
We plan to use this to keep our existing netflix Eureka service registry updated with new container based services as they are brought online, and allow us to integrate containers into our existing VM based microservices environment.
There was a great PR to provide eureka support to registrator which someone had already submitted. However, we had additional requirements too:
- Add the AWS metadata about the host the container is running on
- A way to register metadata that they are actually containers, and our own stuff like routes for the service.
- Support for registering ELBv2 (application load balancer) endpoints in eureka automatically. We plan to use these in most cases rather than directing traffic straight to containers from nginx.
Given that the original eureka PR hadn’t been accepted yet to gliderlabs/registrator, we forked the project, and will carry on making changes as necessary. You can have a look here at the first PR for the main changes. Hopefully gliderlabs will be interested in some of our additions to be merged back in the future.
Next, I started trying to write some golang unit tests – but that’s stuff for another post.