-
Notifications
You must be signed in to change notification settings - Fork 135
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
Support socket activation with launchd and systemd #58
Comments
Hi, sorry for delay. About privileged ports, on Mac OS you can use any free port including the privileged one, just try |
It looks like systemd socket activation supports an inetd-compatible mode, which would avoid requirement to link with anything odd or add systemd-specific code. Would that be more acceptable? I guess it might not work with some advanced HTTP features but presumably they're not particularly important for shell2http anyway... From systemd.socket(5):
|
And according to https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html:
|
This is interesting about inetd-style, where the socket is passed as stdin/stdout. I need to investigate this and try to make an experiment. |
This would allow shell2http to be used with inetd-like scenarios, eg. Systemd Socket activation, or Launchd socket activation.
This is especially useful if you want your application to bind to a privileged port (eg. 80), but don't want the application to run as root, but also don't want to set up a separate proxy process to proxy 80 -> 8080.
So in that case you would have a managing process (like launchd, systemd) open the socket on the privileged port and have it passed to the process instead.
Launchd:
https://en.wikipedia.org/wiki/Launchd#Socket_activation_protocol
https://github.com/sstephenson/launch_socket_server/blob/master/src/launch_socket_server.go
Systemd:
http://0pointer.de/blog/projects/socket-activation.html
https://www.darkcoding.net/software/systemd-socket-activation-in-go/
https://github.com/coreos/go-systemd/tree/master/examples/activation/httpserver
I am open to doing a PR if you would find the idea compatible with shell2http.
The text was updated successfully, but these errors were encountered: