Dynamic proxy status

I saw a long time ago work by @abiosoft to make proxy support pluggable dynamic backends, like etcd, docker and things.

Did that go away? I find myself wanting to proxy into a set of docker containers.

I have made and run this before. It dynamically generates a caddyfile frim all running docker containers on a host with given ENV vars.

I want something a little simpler though. Something like a hand generated caddyfile with:

mydomain.tld {
   proxy {
      docker_container otherService_* 
   }
}

or something like that. It would use the docker api to find matching containers, discover the magic IP addresses and ports, and configure proxy to those.

I felt like that was in a PR for a long time, but couldn’t find anything on it.

I could make a new plugin, but it kinda requires interop with proxy in odd ways to avoid duplication.

Recently I stumbled upon https://traefik.io/, which seems to have nailed the whole dynamic configuration part down quite nicely. I’m not sure if it meets your needs and by no means is it a full replacement for Caddy, but it might be worth a look.

1 Like

Yeah, I suppose that could work. I’m kinda invested in caddy though. Would like to help make a solution that works if possible.

It looks like there is a dynamic-proxy branch that is quite stale at this point. Mostly looking for the history there and maybe talk about how to update it.

Ultimately, on top of or in conjunction with Abiola’s work, I think we need to rewrite and expand the proxy middleware to support dynamic backends; right now, Caddy proxies with a type called staticUpstream but having dynamic upstreams or different kind of upstreams would be immensely useful. Some refactoring would be required.

Yeah, was thinking it would be nice to have “plugins” to the proxy plugin itself. Implement an interface with something like WatchUpstreams(ch chan<- []string) or similar and can hook in new providers as additional plugins to the plugin.

Proxy code is scary to me though. Lots to go wrong.

Although for now I am just managing all services on a box with docker-compose and linking containers to caddy and using proxy / http://servicename:8666. Works pretty well.

It’s safe to say it is abandoned. It was an experiment and I never really had the time to make it into something.

I got couple of people reach out to build on it but haven’t heard anyone get back with their progress.

I also think this is the way to go.

Haha, yes.

(One of my big projects this summer might be to rewrite proxy. I’ll need some help though to make sure it integrates well with fancy dynamic backends.)

@captncraig I’m going to be investigating using consul-template soon; I’ll let you know how that works out for me.