Enable systemd socket activation for Grafito.#26
Merged
Conversation
Systemd socket activation allows the systemd daemon to control the server socket for a service, starting up the service upon receiving a connection on that socket. The socket is passed to the service, which accepts the new connection and any others that might arrive later. This has multiple benefits, as described in the blog post here: https://0pointer.de/blog/projects/socket-activation.html Relevant to Grafito are: * the ability to shut down the service to update it without losing any requests * the ability to tightly sandbox the service so that it is unable to make any network requests without losing its core ability to receive and respond to requests made of it * the ability to conserve resources by only starting the service when it is needed Grafito only really needs to be running when you want to look at your logs. And socket activation is half of that puzzle - it starts up Grafito when you want to use it. The other half is shutting Grafito down when it is no longer being used. This change adds a new flag, --idle-timeout-sec, which causes Grafito to shut down after it has spent the prescribed time without receiving any new requests. When socket activation is used, Grafito does not shut down the socket when it shuts down, so any new requests which come in will be received by systemd, which will start it right back up again.
Owner
|
Thanks for the PR, this is nice! |
Owner
|
I will do a release over the weekend |
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.
Systemd socket activation allows the systemd daemon to control the server socket for a service, starting up the service upon receiving a connection on that socket. The socket is passed to the service, which accepts the new connection and any others that might arrive later.
This has multiple benefits, as described in the blog post here: https://0pointer.de/blog/projects/socket-activation.html Relevant to Grafito are:
Grafito only really needs to be running when you want to look at your logs. And socket activation is half of that puzzle - it starts up Grafito when you want to use it. The other half is shutting Grafito down when it is no longer being used.
This change adds a new flag, --idle-timeout-sec, which causes Grafito to shut down after it has spent the prescribed time without receiving any new requests. When socket activation is used, Grafito does not shut down the socket when it shuts down, so any new requests which come in will be received by systemd, which will start it right back up again.