Skip to content

Add support for systemd socket activation #47

@ogarcia

Description

@ogarcia

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-metaArea: Project wideC-enhancementCategory: New feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions