Open jasonmp85 opened 8 years ago
Interesting idea. I'm not that familiar with docker cloud so would need to look at it more. The fields available in a template are primarily defined here: https://github.com/jwilder/docker-gen/blob/master/context.go My main concern would be if there was not a good overlap or mapping between the local docker container struct and the cloud ones.
Description
The mapping between local Docker events and those in Docker Cloud isn't 100%, but the objects are pretty similar. Because of this, it would be great to be able to deploy
docker-gen
in a Docker Cloud stack and just flip a switch to have it generate templates based on Docker Cloud events rather than the local daemon ones.Motivation
I've been working to provide Citus Docker resources, and found
docker-gen
incredibly easy to use with our product. In particular, I wanted to provide adocker-compose
configuration that would listen to Docker events, regenerate a list of "worker nodes" (based on a label), and send aSIGHUP
to a specific container. It works great.Of course, my next thought was "hey, I can make this
docker-compose.yml
file work in Docker Cloud!". I hoped that there was some propagation of cloud events to the local Docker daemons, but no dice. As a short-term solution, I hacked updockercloud-haproxy
to generate my worker list file. It's not production ready yet, but it works.However, this solution was one of convenience; if I knew Go better, I'd have added the
go-dockercloud
client todocker-gen
, wrapped all client logic behind an interface, and added a switch to let users choose between normal Docker events or those emitted by Docker Cloud.Proposal
Ideally, the same template language (or perhaps one resilient to missing fields) could be used whether using local events or cloud ones. The changes needed would look like:
--cloud
flag to options accepted bydocker-gen
fsouza/go-dockerclient
in an interface that abstracts away differences between the local/cloud APIsdocker/go-dockercloud
, transforming its return values into those already expected by the rest of thedocker-gen
codebase--cloud
flagI may have some time to look into this in the coming months (I'd have to catch up on Go), but I wanted to open the feature request in case it hadn't occurred to you how empowering this could be for instantly enabling Docker Compose stacks to run on Docker Cloud using the same templates they already use with
docker-gen
.Thanks for the great project!