-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Systemd socket activation support #5035
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
Comments
I would also love this. |
I would also be interested by the feature, but I think the patch would have more attention if it was a PR and not a url to go on a ebuild. From a quick look, I do not see anything problematic. |
This is already supported and has been since gitea 1.11. #7274 et al. |
Could someone instruct on how to properly set up socket activation? When I created It would be nice to see a more detailed description in the documentation. |
@andreymal please refrain from commenting on closed issues as comments will get lost on closed issues. If you have a support request please post on our forum https://discourse.gitea.io/ |
Description
I have a little home webserver with an ARM64 Raspberry PI 3B with Gentoo Linux where I run services like Nextcloud, Gitea, DjangoCMS, Prosody IM. The webserver nginx handles the HTTP (port 80) and HTTPS (port 443) connections using Let's encrypt certificates. I prefer filesystem sockets to let nginx communicate with other web applications like Gitea. But systemd socket activation works also with network sockets.
Systemd has a nice feature to start these web applications only when they are needed. To be able to use that feature, socket activation support is needed in the web application. DjangoCMS, for example, will shut down after 10 minutes without interaction to save resources. When a new connection arrives in nginx, DjangoCMS service will be started again. It would be nice to use that feature with Gitea, too.
My gitea.service file looks similar to the contrib version. I created a gitea.socket file which defines an unix filesystem socket, thus [server] PROTOCOL and HTTP_ADDR is not needed in settings.
Solution (Patch)
I patched the 1.5.1 version to integrate the systemd socket activation support. But I think, it needs some discussion before bringing it upstream. I have taken the www-apps/gitea 1.4.3 ebuild from the gentoo repository, which is used by the Gentoo portage package manager, and have modified it to fetch version 1.5.1 and integrate the patch. I pushed all changes to my portage overlay repository for gitea.
There you can find the patch here: Before doing the switch, the systemd socket activation is asked for listeners
activation.Listeners()
. If it does not return an error, at least one listener is defined and socket activation is used. If it returns an error code, do the normal switch statement as before.The systemd socket activation needs the vendor code for
github.com/coreos/go-systemd/activation
. No further dependencies are needed, as I noticed. In my gentoo ebuild, I pull the go-systemd version 17 (lastest version) and moved the content to foldervendor/github.com/coreos/go-sytemd
.After discussion (and first review of patch), I can prepare the commit for socket activation and a pull request.
The text was updated successfully, but these errors were encountered: