Introducing Consul Template
hashicorp.com
hashicorp.com
I'm glad to see this idea validated, and I think consul-template looks pretty awesome and well integrated with consul. consul-template takes advantage of consul specific features such as the consul services API and datacenters, which is really great for consul users. These are things I did not want to add and maintain in confd, since I'm supporting consul, etcd, and environment variables as backends I felt those would be one off features, which really belong in a consul focused tool like this.
Some will ask why did Hashicorp not just contribute to confd? Well they did. They added initial support for consul to confd almost a year ago and have been very helpful with my questions around consul ever since. The contributions go both ways too. I've been a contributor to Hashicorp's Packer project -- I added Ansible and GCE support and various bug fixes.
This is just how opensource works. I'm actually pretty happy to see one of my projects get so much attention and now inspire another project. That's the whole point right?
I really like that they are simple Go templates :)
Anyone have a good end to end example of Consul, Docker, Service Discovery? Nginx example is good to get started, but just need some of the basics to point in the right direction.
There are a few floating around. Here's mine: https://github.com/kanzure/docker-basenode
Here's something useful for end-to-end: https://github.com/hashicorp/consul-haproxy
What would be really neat is some way of having consul initiate an event instead of having pyconfd (or confd for that matter) sleep and check every n seconds. This may already be implemented in consul upstream but I haven't been paying very close attention...
Edit: dry run is very neat :-)
We also compile and read the template once to determine only the keys you care about from the template to determine what Consul services/keys to look for, so we're not requesting ANY changes.
confd also has dry run support: https://github.com/kelseyhightower/confd/blob/master/docs/no... It was apart of the initial release of confd.
These distributed K/V stores are designed to offer a minimal feature set, and the watch support is a perfect way to deliver events to clients. While HTTP call backs would be nice, I think you have to draw the line somewhere. Since these types of systems, consul or etcd, sit at a critical point in the infrastructure lets keep them lean and focused. But that's just my opinion.
https://github.com/kelseyhightower/confd/commit/16d6b347c3d3...
What really bugs me about these solutions -- confd, consul templates -- is that managing templated configuration files isn't as quick, but has been trivially possible with normal configuration management tools since their inception. When I think of managing HAProxy configurations, for example, I don't see Chef as a bottleneck. I can parallel SSH and run Chef on those hosts in 20 - 30 seconds. I don't care about the configuration being pristine, either.. because that's what backend health checks are for. That extends to a lot of their examples, but it's one of the ones that stuck out to me.
The things that I think are hard, or harder, are small bits of data, like database credentials, etc.... where people absolutely don't want to be making an HTTP call for every single thing, or don't want to define a template for hundreds of individual files that might be needed. That's a real bottleneck - you need something on top of these solutions to manage that. So for every file you care about being updated fast... you still need to manage a corresponding file.
I don't know necessarily how to solve that -- I treat K/V pairs as file name/contents pairs in my tool and don't think twice -- but it definitely feels a bit wrong.
However, I wonder why this isn't built into consul directly?
* reads config from a json file * GET requests with deep links into the json tree * POST request with template as body and deep links (using the go template engine, too) * long polling (response has to be triggered explicitly by a PUT request)
I also made a simple docker container running HAProxy - configured by goconfd - to orchestrate docker containers.
https://github.com/kelseyhightower/confd/blob/master/docs/te...