Skip to content
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

compatibility with systemd .socket unit #14

Open
hadmut opened this issue Dec 24, 2023 · 1 comment
Open

compatibility with systemd .socket unit #14

hadmut opened this issue Dec 24, 2023 · 1 comment

Comments

@hadmut
Copy link

hadmut commented Dec 24, 2023

Hi,

this is a feature request.

I need to start ruby REST API-Servers (sinatra) from systemd. This is in general not a problem, when defining it as a .service unit, running permanently, but keeps the daemons permanently running, even if seldomly used.

systemd therefore offers the .socket units (see man systemd.socket), where systemd acts like the good old inetd (for which the same problem exists), i.e. it can open an inet tcp (or in case of systemd, even a unix domain) socket, and once connected, launches the daemon, passing the socket either on stdin/stdout or via the sd_listen_fds(3), which is a pretty good way to have TCP oder unix domain services run on demand.

But I haven't seen options or documentation for rackup to run under systemd with a socket unit. One can pass a unix domain path name to rackup, but not to run under stdin/stdout or sd_listen_fds.

A first thought was to just run

rackup -o /dev/stdin

but this results in
`unlink': Permission denied @ apply2files - /dev/stdin (Errno::EACCES)
Connection refused - connect(2) for /dev/stdin (Errno::ECONNREFUSED)

Since systemd is a widely accepted service control system, there should be some integration of rackup into systemd with .socket units, and not just .service units having it continously run.

regards

@leahneukirchen
Copy link
Member

You can use a Rack server that supports socket activation natively, e.g. unicorn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants