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

Add support for systemd socket activation #47

Open
ogarcia opened this issue Oct 1, 2024 · 0 comments
Open

Add support for systemd socket activation #47

ogarcia opened this issue Oct 1, 2024 · 0 comments
Labels
A-meta Area: Project wide C-enhancement Category: New feature or request

Comments

@ogarcia
Copy link

ogarcia commented Oct 1, 2024

In systemd you can create socket units so that the service is activated the moment it receives a connection. This way it is not necessary for the service to be up all the time.

An example of the unit could be this one:

rustic-server.service

[Unit]
Description=A REST server built in rust to use with rustic and restic
Documentation=https://rustic.cli.rs/ecosystem/rustic-server/
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=rustic-server
Group=rustic-server
EnvironmentFile=/etc/rustic-server/rustic-server.conf
ExecStart=/usr/bin/rustic-server -p $RUSTIC_SERVER_PATH $RUSTIC_SERVER_OPTS
Restart=always

[Install]
WantedBy=multi-user.target

rustic-server.socket

[Unit]
Description=A REST server built in rust to use with rustic and restic

[Socket]
ListenStream=8000

[Install]
WantedBy=sockets.target

The problem is that for this to work rustic-server must support it. As far as I see in rest-server they made a modification for it, I suppose that something similar can be done here.

@github-actions github-actions bot added the S-triage Status: Waiting for a maintainer to triage this issue/PR label Oct 1, 2024
@simonsan simonsan added A-meta Area: Project wide C-enhancement Category: New feature or request and removed S-triage Status: Waiting for a maintainer to triage this issue/PR labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Project wide C-enhancement Category: New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants