From 4038ef3bc1bf62e379b920e18a99bcd986f2fbc2 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 20 May 2024 22:19:30 +0200 Subject: [PATCH] [#319] Added `platypush/config/systemd` directory. It contains both `platypush.service` and the `sysusers.d` and `tmpfiles.d` configurations used by the package managers. --- MANIFEST.in | 1 + examples/systemd/platypush.service | 31 +------------------ .../config/systemd/platypush-sysusers.conf | 1 + .../config/systemd/platypush-tmpfile.conf | 2 ++ platypush/config/systemd/platypush.service | 30 ++++++++++++++++++ 5 files changed, 35 insertions(+), 30 deletions(-) mode change 100644 => 120000 examples/systemd/platypush.service create mode 100644 platypush/config/systemd/platypush-sysusers.conf create mode 100644 platypush/config/systemd/platypush-tmpfile.conf create mode 100644 platypush/config/systemd/platypush.service diff --git a/MANIFEST.in b/MANIFEST.in index f09b5138c9..0aac6fef6e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,5 +2,6 @@ recursive-include platypush/backend/http/webapp/dist * recursive-include platypush/install * include platypush/plugins/http/webpage/mercury-parser.js include platypush/config/*.yaml +include platypush/config/systemd/* global-include manifest.json global-include components.json.gz diff --git a/examples/systemd/platypush.service b/examples/systemd/platypush.service deleted file mode 100644 index b3cd1e738b..0000000000 --- a/examples/systemd/platypush.service +++ /dev/null @@ -1,30 +0,0 @@ -# Platypush systemd service file. -# -# It is advised to install Platypush through a supported package manager or a -# Platypush Docker container. -# -# In such case, the service file should be automatically installed and configured, -# and Platypush can be started either via `[sudo] systemctl start platypush` -# (privileged start, usually with a dedicated `platypush` user) or -# `systemctl --user start platypush` if you want to run it through a generic user. -# -# In the first case, the working directory would usually be -# `/var/lib/platypush`, and the configuration will be stored under `/etc/platypush`. -# -# You can however also copy this service configuration either to -# `/etc/systemd/system/platypush.service` or -# `~/.config/systemd/user/platypush.service`. - -[Unit] -Description=Platypush - A general-purpose platform for automation -After=network.target redis.service -# Uncomment this line if you're running the service as a privileged user -# Requires=redis.service - -[Service] -ExecStart=/usr/bin/platypush -Restart=always -RestartSec=10 - -[Install] -WantedBy=multi-user.target diff --git a/examples/systemd/platypush.service b/examples/systemd/platypush.service new file mode 120000 index 0000000000..a846c200bc --- /dev/null +++ b/examples/systemd/platypush.service @@ -0,0 +1 @@ +../../platypush/config/systemd/platypush.service \ No newline at end of file diff --git a/platypush/config/systemd/platypush-sysusers.conf b/platypush/config/systemd/platypush-sysusers.conf new file mode 100644 index 0000000000..e0f32fc2f3 --- /dev/null +++ b/platypush/config/systemd/platypush-sysusers.conf @@ -0,0 +1 @@ +u platypush - "A general-purpose platform for automation-as-code" /var/lib/platypush diff --git a/platypush/config/systemd/platypush-tmpfile.conf b/platypush/config/systemd/platypush-tmpfile.conf new file mode 100644 index 0000000000..ced2d808f5 --- /dev/null +++ b/platypush/config/systemd/platypush-tmpfile.conf @@ -0,0 +1,2 @@ +d /var/lib/platypush 0755 platypush platypush - +d /etc/platypush 2750 platypush platypush - diff --git a/platypush/config/systemd/platypush.service b/platypush/config/systemd/platypush.service new file mode 100644 index 0000000000..b3cd1e738b --- /dev/null +++ b/platypush/config/systemd/platypush.service @@ -0,0 +1,30 @@ +# Platypush systemd service file. +# +# It is advised to install Platypush through a supported package manager or a +# Platypush Docker container. +# +# In such case, the service file should be automatically installed and configured, +# and Platypush can be started either via `[sudo] systemctl start platypush` +# (privileged start, usually with a dedicated `platypush` user) or +# `systemctl --user start platypush` if you want to run it through a generic user. +# +# In the first case, the working directory would usually be +# `/var/lib/platypush`, and the configuration will be stored under `/etc/platypush`. +# +# You can however also copy this service configuration either to +# `/etc/systemd/system/platypush.service` or +# `~/.config/systemd/user/platypush.service`. + +[Unit] +Description=Platypush - A general-purpose platform for automation +After=network.target redis.service +# Uncomment this line if you're running the service as a privileged user +# Requires=redis.service + +[Service] +ExecStart=/usr/bin/platypush +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target