Live data from Hacker News

Show HN: Caddy v2.5.0

github.com

51–60 of 115 posts

Re: Show HN: Caddy v2.5.0

#51
post #25

Earlier quoted context omitted.

Possibly; the long-lived connections eventually have to end when reloads (note: restarts and reloads are different) happen, to free up resources -- otherwise they leak. (The grace period is configurable and can even be disabled.)

This bit us in a recent project where we have very long ongoing downloads, where even a very high grace period wouldn't really help. I wonder whether it's technically generally feasible (possibly depends on net/http2's capabilities) to handover the connection from the old to the new server instance, comparable to what systemd does in terms of FD passing for socket-activated services.

The problem is that existing connections are inside of async functions (goroutines) that have references to the old config. AFAIK, there's no way in Go's stdlib to kill those goroutines while keeping the connection and handing it to another fresh goroutine.

To be clear, the new config is running at the same time as the old is still tearing down; all new connections get handled by the new config. Listeners are shared and transferred between servers.

We're all ears, though, if someone with deep knowledge of Go's internals can point us in the right direction.

Re: Show HN: Caddy v2.5.0

#53
post #28
post #18

Caddy is such a delight! I can't reccomend it fast enough when somebody mentions they are on nginx. Small random feedback: I like the idea of JSON configuration but most of the common docs/recipes are documented only with the Caddyfile format. I couldn't figure out the full JSON schema that was expected so I wound up generating a Caddyfile string instead for my programatic control. Maybe there is some translation too…

Thanks for recommending it! I hear ya. The JSON config is definitely not trivial. I wrote our JSON docs and strove to made them easy to follow. You can traverse into the module structure piece-by-piece here: https://caddyserver.com/docs/json/ There is also a Caddy plugin by @abiosoft that can generate a JSON schema for your custom Caddy builds, which can then be used by IDEs to give you autocomplete and validation: h…

Thanks! Somehow you knew that I was struggling with JSON config of a custom Caddy build (for the Cloudflare extension)

caddy-json-schema looks great, I'll try this next time!

not sure if I totally missed `caddy adapt` or if I had troubles with it.

Re: Show HN: Caddy v2.5.0

#54
post #46
post #19

Caddy is absolutely amazing. I'm running it on an RPi that's hosting various home automation and hobby projects, all serving HTTP to the loopback interface only, with Caddy acting as a reverse proxy, and I've never even had to think about HTTPS. Adding a new service is adding a single line to my config file, and the rest happens automatically. Finally, no more "trust this self-signed certificate" even for toy project…

Setting that up with nginx and acme.sh is pretty easy as well. One benefit I found with using nginx is that services are more likely to have nginx proxy example configs, and sometimes these are non-trivial, eg.: https://docs.mattermost.com/install/config-proxy-nginx.html I guess with caddy you're on your own, which doesn't look like fun.

Check out the config adapters:

https://caddyserver.com/docs/config-adapters

Now you can use your nginx config with Caddy!

Re: Show HN: Caddy v2.5.0

#55
post #52

The Dynamic Upstreams feature looks good, but it doesn't seem to be as nicely integrated with Consul as Traefik is.

Could you elaborate on what you mean? For now we only ship with support for SRV and A/AAAA, but anyone can write a Consul implementation if they like.

I'm not sure how that would differ from SRV though, since Consul supports SRV anyways. I'm not a Consul user though.

Re: Show HN: Caddy v2.5.0

#56

Is Caddy scriptable? I don't know much about it. But ever since I discovered nginx-lua-module and OpenResty it's been pretty much a game-changer for me. Curious if other popular webservers have done similar? Not really talking about things like mod_perl/php. Although I guess those are somewhat the same thing.

It's also very easy to write plugins for Caddy: https://caddyserver.com/docs/extending-caddy

Re: Show HN: Caddy v2.5.0

#57
post #37
post #19

Caddy is absolutely amazing. I'm running it on an RPi that's hosting various home automation and hobby projects, all serving HTTP to the loopback interface only, with Caddy acting as a reverse proxy, and I've never even had to think about HTTPS. Adding a new service is adding a single line to my config file, and the rest happens automatically. Finally, no more "trust this self-signed certificate" even for toy project…

Would you mind sharing a (redacted if you like) copy of your config file in a Gist? Purely out of curiosity - your setup sounds really neat.

Sure, here's a redacted example:

https://gist.github.com/lxgr/303b1a3cd87005edb43b91545c5306b...

I unfortunately can't remember if there is some header/footer I'm omitting here – this file is managed by Ansible for my setup, but I believe it should effectively be the full Caddyfile.

Re: Show HN: Caddy v2.5.0

#60
post #38
post #28

Earlier quoted context omitted.

Thanks for recommending it! I hear ya. The JSON config is definitely not trivial. I wrote our JSON docs and strove to made them easy to follow. You can traverse into the module structure piece-by-piece here: https://caddyserver.com/docs/json/ There is also a Caddy plugin by @abiosoft that can generate a JSON schema for your custom Caddy builds, which can then be used by IDEs to give you autocomplete and validation: h…

A few complete, fully working example JSON configuration files for common use cases would be really useful as well.

Agreed. (Although, for now, you can run caddy adapt on your Caddyfile to get the JSON you're looking for.)
Post reply on HN