MightyMoud / sidekick

Bare metal to production ready in mins; your own fly server on your VPS.
https://www.sidekickdeploy.com
GNU General Public License v3.0
3.18k stars 55 forks source link

caddy proxy for docker #40

Open gedw99 opened 2 weeks ago

gedw99 commented 2 weeks ago

if we can do this with caddy then bonus.

caddy has a lot of extra things that trawl does not via its plugins that give it super powers ..

https://github.com/lucaslorentz/caddy-docker-proxy

I know we have Traefik, but I have used this one before.

I think there are better examples out there too

MightyMoud commented 2 weeks ago

What kind of plugins that Caddy has that Traefik doesn't? I didn't spend much time on it but I did see Traefik has lots of plugins already

gedw99 commented 2 weeks ago

https://caddyserver.com/docs/modules/

Lots

gedw99 commented 1 week ago

@MightyMoud

https://github.com/lucaslorentz/caddy-docker-proxy

Per the description in the github repo it references, how it works is it scans Docker metadata looking for labels indicating that the service or container should be exposed on caddy.

Then it generates an in memory Caddyfile with website entries and proxy directives pointing to each Docker service DNS name or container IP.

Every time a docker object changes, it updates the Caddyfile and triggers a caddy zero-downtime reload.

—-

Holding requests until an upstream is available is also something Caddy does well, just configure the reverse_proxy with try_duration and try_interval, it will keep trying to choose a healthy upstream (determined via active health checks done in a separate goroutine) for that request until it times out.

—-

caddy can store the let’s encrypt produced certificate on S3 so if you have many instances of a server they all use the same certificate stored . This solves a problem that neither kamal or side kick handle.

nickchomey commented 1 week ago

Even though i hope to use sidekick with cloudflare tunnels rather than traefik or caddy, I just want to say that caddy is generally viewed to be CONSIDERABLY easier to use than traefik. I've had nothing but headaches with figuring out traefik, and many others evidently feel the same (lots of articles about that around the net).

hlongvu commented 1 week ago

+1 for caddy or let it be an option to choose between caddy and traefik

MightyMoud commented 1 week ago

Having a choice will mean I would have to introduce much more complexity to other commands so that's no good.

I'm happy to move Sidekick to Caddy if it's better. Can someone just articulate why Caddy is better than Traefik in details? maybe share a link to some discussion or something? Or has any of you used Traefik to its full potential before and decided to switch to Caddy?

gedw99 commented 1 week ago

yeah it’s trick to support both .

I switched years ago . Was a very obvious think to do .

caddy has just much more features and a very strong community .

Caddy handles certificates for you and can scale them globally . So you can run many servers for the same domain and reuse the issues cert

it’s also got a great cli to modify the config and can reload without restarting or loosing any connections.

it’s too much to go into deeper details .

you should have a play yourself and decide for yourself .

MightyMoud commented 1 day ago

just for your info, I'm looking into this. I think Sidekick is stable enough now to attend to those things.

will keep this open for now

gedw99 commented 1 day ago

Just adding this to the caddy system ideas …

https://github.com/sablierapp/sablier provides a system where unused

it works by doing heath checks on each app inside each docker z, and shuts them down .

when a request later happens it auto starts the app behind the proxy and then lets the request through .