Add support for "sd_listen_fds" socket activation socket support for gRPC and HTTP listeners#589
Open
networkException wants to merge 1 commit intografana:mainfrom
Open
Conversation
a8486aa to
e379e75
Compare
3a887b3 to
7a0b45a
Compare
This patch adds support for server to be used with systemd's socket activation by expecting an open file descriptor to be announced using environment variables. To make use of this set either HTTPListenNetwork or GRPCListenNetwork to "sd_listen_fd" and HTTPListenAddress or GRPCListenAddress either to an ASCII string passed as the "FileDescriptorName" from a systemd.socket unit or "LISTEN_FD_$n", where $n is the file descriptor number. By default, when using "sd_listen_fd", the address will be "LISTEN_FD_3". This patch makes use of the coreos/go-systemd/v22/activation library (which was already included as an indirect dependency). Unfortunately their implementation doesn't allow call sites to get a view of the listeners both by file descriptor number and file descriptor name, as the highlevel helpers cannot be used. See https://www.freedesktop.org/software/systemd/man/latest/systemd.socket.html#FileDescriptorName=
7a0b45a to
5207101
Compare
Contributor
|
Hi! 👋 We recently merged #947 which changed the CI configuration for unit tests. To get CI passing on this PR, please rebase on the latest Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
This pull request adds support for server to be used with systemd's socket activation by expecting an open file descriptor to be announced using environment variables.
To make use of this set either
HTTPListenNetworkorGRPCListenNetworkto"sd_listen_fd"andHTTPListenAddressorGRPCListenAddresseither to an ASCII string passed as theFileDescriptorName=from a systemd.socket unit or"LISTEN_FD_$n", where$nis the file descriptor number, starting with 3 (SD_LISTEN_FDS_START).By default, when using
"sd_listen_fd", the address will be"LISTEN_FD_3".This patch makes use of the coreos/go-systemd/v22/activation library (which was already included as an indirect dependency). Unfortunately their implementation doesn't allow call sites to get a view of the listeners both by file descriptor number and file descriptor name, as the highlevel helpers cannot be used.
This is similar in spirit to #511, I'll happily include unix socket support in the
listenhelper this change introduces as part of the rebase.Which issue(s) this PR fixes:
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]