-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFE: support for FD passing (*inetd/systemd) #778
Comments
I wonder how this would affect Caddy's restarts. It uses fd 3 for other things in that case. |
I will iterate on this after #777, https://github.com/caddyserver/caddyserver.com/pull/41, and https://github.com/caddyserver/buildsrv/pull/22 if no one opposes. |
While implementing support for systemd notify I've been told such a tight integration were not sought at the moment. As the aforementioned feature did not make it in I won't pursue this one. |
@wmark I don't get it: are you saying you don't plan to implement socket activation because there are no plans to support systemd notify? P.S.: I just read #777 (comment), now this makes sense. |
@mholt stumbled over this today, and got confused about the "closed as completed" part. I'd very much like to use caddy in a socket-activated environment. These days, the FDs can also be named, which should make identifying them much easier, as well as letting the init system take care of zero-downtime deployments. If we use FDs passed by the service manager, we can simply spin up a new caddy with a new configuration, and get all new connections routed to the new service. |
This is closed 8 years ago during the era of Caddy v1. The v2 of Caddy is written from scratch. Please file a new issue with an explanation of your needs and the reasoning. |
Will do, thanks! |
I opened #6296, PTAL. |
Request for Enhancement
Support for FD passing (*inetd/systemd)
To solve the problem of having Caddy running as privileged user to be able to bind ports below 1024, a common solution is to simply use a service manager with socket activation support ("legacy style" via *inetd, "modern style" via systemd).
This requires the process which is intended to bind sockets to accept FDs from a privileged parent process (*inetd/systemd) which are then used to bind to.
The implementation is relatively trivial as outlined in this blogpost:
A systemd setup making use of socket activation to run Caddy unprivileged would look like this:
systemd service unit (
/etc/systemd/system/caddy@.service
)systemd socket unit (
/etc/systemd/system/caddy@service-foo.socket
)All that's needed now is:
caddy@service-foo.socket
is started on boot:systemctl enable caddy@service-foo.socket
systemctl start caddy@service-foo.socket
References:
sd_listen_fds()
documentationThe text was updated successfully, but these errors were encountered: