diff --git a/misc/systemd/README.md b/misc/systemd/README.md new file mode 100644 index 00000000..4779b879 --- /dev/null +++ b/misc/systemd/README.md @@ -0,0 +1,9 @@ +# Libervia systemd units + +Here you'll find [systemd](https://systemd.io/) units to run Libervia: + +- `libervia-backend.service`: to be used when you run a single backend instance for all + components and clients (or for the main instance). +- `libervia@.service`: a template for isolated backend instances. To be used for a + component, a dedicated backend for the web frontend, or any other isolated usage. +- `libervia-web.service`: Libervia Web frontend. diff --git a/misc/systemd/libervia-backend.service b/misc/systemd/libervia-backend.service new file mode 100644 index 00000000..afae867b --- /dev/null +++ b/misc/systemd/libervia-backend.service @@ -0,0 +1,18 @@ +[Unit] +Description=Libervia Backend +Wants=network-online.target +After=network.target network-online.target + +[Service] +Type=exec +User=libervia +Group=libervia +StateDirectory=libervia +RuntimeDirectory=libervia +Environment=XDG_RUNTIME_DIR=/run/libervia +ExecStart=libervia-backend fg +Restart=on-failure +RestartSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/misc/systemd/libervia-web.service b/misc/systemd/libervia-web.service new file mode 100644 index 00000000..bc55e723 --- /dev/null +++ b/misc/systemd/libervia-web.service @@ -0,0 +1,18 @@ +[Unit] +Description=Libervia Web +Wants=network-online.target libervia-backend.service +After=network.target network-online.target libervia-backend.service + +[Service] +Type=exec +User=libervia +Group=libervia +StateDirectory=libervia-web +RuntimeDirectory=libervia-web +Environment=XDG_RUNTIME_DIR=/run/libervia-web +ExecStart=libervia-web fg +Restart=on-failure +RestartSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/misc/systemd/libervia@.service b/misc/systemd/libervia@.service new file mode 100644 index 00000000..df731cdc --- /dev/null +++ b/misc/systemd/libervia@.service @@ -0,0 +1,19 @@ +[Unit] +Description=Libervia %i (isolated) +Wants=network-online.target +After=network.target network-online.target + +[Service] +Type=exec +User=libervia +Group=libervia +StateDirectory=libervia +RuntimeDirectory=libervia-%i +Environment=XDG_RUNTIME_DIR=/run/libervia-%i +Environment=LIBERVIA_ISOLATION=%i +ExecStart=libervia-backend fg +Restart=on-failure +RestartSec=5s + +[Install] +WantedBy=multi-user.target