-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 for on-demand starting #3382
Comments
Is there anything needed to be done in Puma to support this? |
I wouldn't see how to start Puma/rack in its current state. If it is possible, there should be something in the docs explaining it. |
You start Puma by running Have you seen https://github.com/puma/puma/blob/master/docs/systemd.md? |
No, didn't see this. I recently spent some time trying to find a solution for rack applications with different servers such as puma, but for whatever reason, I did not find this, not a single hint that puma is capable of running from systemd with socket activation. But it seems to solve my problem only partly. If you need to pass the TLS key file with a -b option like will this still work with socket activation? The Examples seem to intermix a permanent start as a regular service with a socket activation. |
I'm not using systemd myself so I'm not sure. Maybe you can test it and report back. Maybe you can even improve the docs if there's need for that. This is open source after all :-) |
Problem: Quite often a web/api/rest server is only need sometimes to run, and usually on small and older machines not packed with heaps of RAM it is reasonable to run only those processes that are actually needed, i.e. start them on demand only.
There is currently two common and well established methods to run servers on demand:
The old fashioned way to start them with inetd / xinetd, which open a socket, wait for connections, and once a client connect, spawn a process to handle all incoming requests, and once the process terminates itself (e.g. due to timeout), again, wait and spawn if needed.
The newer systemd, which virtually does the same, but supports two different methods of passing the socket to the server application, which is a) the traditional inetd method and b) the newer way sd_listen_fds(3), see man systemd.socket and man 3 sd_listen_fds
Would be great if it was possible to have small web servers or REST APIs, that are needed occasionally only, be able to be started on demand through systemd.
Describe alternatives you've considered
Start the server through systemd permanently (as a system task) or once the user is logged in (as a user unit). Means the server is running always, even if not needed.
The text was updated successfully, but these errors were encountered: