From 37e6f47bf7962b67569b11197413575a67d0a339 Mon Sep 17 00:00:00 2001
From: j1nx
Date: Wed, 30 Aug 2023 11:50:40 +0000
Subject: [PATCH] [ALL] Implement podman quadlet system for rootless systemd
integration (untested)
Place these file like here within;
/etc/containers/systemd/users/
for them to be available for all system users or place them within;
/etc/containers/systemd/users/
~/.config/containers/systemd/
for them to be available for that specific user.
The systemd service files can then be automagically be created by the command;
$ systemctl --user daemon-reload
After which they can be started/enabled normally with;
$ systemctl --user start ovos_messagebus
$ systemctl --user start ovos_phal
etc.
---
.../systemd/users/ovos_audio.container | 32 ++++++++++++++++++
.../systemd/users/ovos_cli.container | 21 ++++++++++++
.../systemd/users/ovos_core.container | 32 ++++++++++++++++++
.../systemd/users/ovos_listener.container | 33 +++++++++++++++++++
.../users/ovos_listener_records.volume | 4 +++
.../systemd/users/ovos_messagebus.container | 21 ++++++++++++
.../systemd/users/ovos_models.volume | 4 +++
.../containers/systemd/users/ovos_nltk.volume | 4 +++
.../systemd/users/ovos_phal.container | 28 ++++++++++++++++
.../systemd/users/ovos_phal_admin.container | 25 ++++++++++++++
.../containers/systemd/users/ovos_vosk.volume | 4 +++
11 files changed, 208 insertions(+)
create mode 100644 buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_audio.container
create mode 100644 buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_cli.container
create mode 100644 buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_core.container
create mode 100644 buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_listener.container
create mode 100644 buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_listener_records.volume
create mode 100644 buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_messagebus.container
create mode 100644 buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_models.volume
create mode 100644 buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_nltk.volume
create mode 100644 buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_phal.container
create mode 100644 buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_phal_admin.container
create mode 100644 buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_vosk.volume
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_audio.container b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_audio.container
new file mode 100644
index 00000000..b20346f7
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_audio.container
@@ -0,0 +1,32 @@
+[Unit]
+Description=OpenVoiceOS Audio Service
+After=local-fs.target
+Wants=ovos_messagebus.service
+After=ovos_messagebus.service
+Wants=ovos_phal.service
+After=ovos_phal.service
+
+[Container]
+ContainerName=ovos_audio
+Image=docker.io/smartgic/ovos-audio:alpha
+AutoUpdate=registry
+LogDriver=journald
+HostName=ovos_audio
+Network=host
+Timezone=local
+Environment=PULSE_SERVER=unix:/run/user/1000/pulse/native
+Environment=PULSE_COOKIE=/home/ovos/.config/pulse/cookie
+Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
+AddDevice=/dev/snd
+Volume=%h/ovos/config:/home/ovos/.config/mycroft
+Volume=%h/ovos/tmp:/tmp/mycroft
+Volume=%h/.config/pulse/cookie:/home/ovos/.config/pulse/cookie:ro
+Volume=%t/pulse:/run/user/1000/pulse:ro
+Volume=%/bus:/run/user/1000/bus:ro
+
+[Service]
+TimeoutStartSec=900
+Restart=always
+
+[Install]
+WantedBy=multi-user.target default.target
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_cli.container b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_cli.container
new file mode 100644
index 00000000..4a491eaf
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_cli.container
@@ -0,0 +1,21 @@
+[Unit]
+Description=OpenVoiceOS CLI
+After=local-fs.target
+
+[Container]
+ContainerName=ovos_cli
+Image=docker.io/smartgic/ovos-cli:alpha
+AutoUpdate=registry
+LogDriver=journald
+HostName=ovos_cli
+Network=host
+Timezone=local
+Volume=%h/ovos/config:/home/ovos/.config/mycroft
+Volume=%h/ovos/tmp:/tmp/mycroft
+
+[Service]
+TimeoutStartSec=900
+Restart=unless-stopped
+
+[Install]
+WantedBy=multi-user.target default.target
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_core.container b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_core.container
new file mode 100644
index 00000000..bba5de50
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_core.container
@@ -0,0 +1,32 @@
+[Unit]
+Description=OpenVoiceOS Core Service
+After=local-fs.target
+Wants=ovos_messagebus.service
+After=ovos_messagebus.service
+Wants=ovos_phal.service
+After=ovos_phal.service
+
+[Container]
+ContainerName=ovos_core
+Image=docker.io/smartgic/ovos-core:alpha
+AutoUpdate=registry
+LogDriver=journald
+HostName=ovos_core
+Network=host
+Timezone=local
+Environment=PULSE_SERVER=unix:/run/user/1000/pulse/native
+Environment=PULSE_COOKIE=/home/ovos/.config/pulse/cookie
+AddDevice=/dev/snd
+Volume=%h/ovos/config:/home/ovos/.config/mycroft
+Volume=%h/ovos/tmp:/tmp/mycroft
+Volume=%h/.config/pulse/cookie:/home/ovos/.config/pulse/cookie:ro
+Volume=%t/pulse:/run/user/1000/pulse:ro
+Volume=ovos_nltk:/home/ovos/nltk_data
+Volume=%h/ovos/share:/home/ovos/.local/share/mycroft
+
+[Service]
+TimeoutStartSec=900
+Restart=always
+
+[Install]
+WantedBy=multi-user.target default.target
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_listener.container b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_listener.container
new file mode 100644
index 00000000..06ebfb22
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_listener.container
@@ -0,0 +1,33 @@
+[Unit]
+Description=OpenVoiceOS Dinkum Listener Service
+After=local-fs.target
+Wants=ovos_messagebus.service
+After=ovos_messagebus.service
+Wants=ovos_phal.service
+After=ovos_phal.service
+
+[Container]
+ContainerName=ovos_listener
+Image=docker.io/smartgic/ovos-listener-dinkum:alpha
+AutoUpdate=registry
+LogDriver=journald
+HostName=ovos_listener
+Network=host
+Timezone=local
+Environment=PULSE_SERVER=unix:/run/user/1000/pulse/native
+Environment=PULSE_COOKIE=/home/ovos/.config/pulse/cookie
+AddDevice=/dev/snd
+Volume=%h/ovos/config:/home/ovos/.config/mycroft:ro
+Volume=%h/ovos/tmp:/tmp/mycroft
+Volume=%h/.config/pulse/cookie:/home/ovos/.config/pulse/cookie:ro
+Volume=%t/pulse:/run/user/1000/pulse:ro
+Volume=ovos_listener_records:/home/ovos/.local/share/mycroft/listener
+Volume=ovos_models:/home/ovos/.local/share/precise-lite
+Volume=ovos_vosk:/home/ovos/.local/share/vosk
+
+[Service]
+TimeoutStartSec=900
+Restart=always
+
+[Install]
+WantedBy=multi-user.target default.target
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_listener_records.volume b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_listener_records.volume
new file mode 100644
index 00000000..a7c0dabb
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_listener_records.volume
@@ -0,0 +1,4 @@
+[Volume]
+User=mycroft
+Group=mycroft
+Label=name=ovos_listener_records
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_messagebus.container b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_messagebus.container
new file mode 100644
index 00000000..3e0f77cb
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_messagebus.container
@@ -0,0 +1,21 @@
+[Unit]
+Description=OpenVoiceOS Messagebus Service
+After=local-fs.target
+
+[Container]
+ContainerName=ovos_messagebus
+Image=docker.io/smartgic/ovos-messagebus:alpha
+AutoUpdate=registry
+LogDriver=journald
+HostName=ovos_messagebus
+Network=host
+Timezone=local
+Volume=%h/ovos/config:/home/ovos/.config/mycroft:ro
+Volume=%h/ovos/tmp:/tmp/mycroft
+
+[Service]
+TimeoutStartSec=900
+Restart=unless-stopped
+
+[Install]
+WantedBy=multi-user.target default.target
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_models.volume b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_models.volume
new file mode 100644
index 00000000..209716ce
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_models.volume
@@ -0,0 +1,4 @@
+[Volume]
+User=mycroft
+Group=mycroft
+Label=name=ovos_models
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_nltk.volume b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_nltk.volume
new file mode 100644
index 00000000..243178de
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_nltk.volume
@@ -0,0 +1,4 @@
+[Volume]
+User=mycroft
+Group=mycroft
+Label=name=ovos_nltk
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_phal.container b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_phal.container
new file mode 100644
index 00000000..08838ab6
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_phal.container
@@ -0,0 +1,28 @@
+[Unit]
+Description=OpenVoiceOS PHAL Service
+After=local-fs.target
+Wants=ovos_messagebus.service
+After=ovos_messagebus.service
+
+[Container]
+ContainerName=ovos_phal
+Image=docker.io/smartgic/ovos-phal:alpha
+AutoUpdate=registry
+LogDriver=journald
+HostName=ovos_phal
+Network=host
+Timezone=local
+Environment=PULSE_SERVER=unix:/run/user/1000/pulse/native
+Environment=PULSE_COOKIE=/home/ovos/.config/pulse/cookie
+AddDevice=/dev/snd
+Volume=%h/ovos/config:/home/ovos/.config/mycroft
+Volume=%h/ovos/tmp:/tmp/mycroft
+Volume=%h/.config/pulse/cookie:/home/ovos/.config/pulse/cookie:ro
+Volume=%t/pulse:/run/user/1000/pulse:ro
+
+[Service]
+TimeoutStartSec=900
+Restart=always
+
+[Install]
+WantedBy=multi-user.target default.target
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_phal_admin.container b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_phal_admin.container
new file mode 100644
index 00000000..6edb2972
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_phal_admin.container
@@ -0,0 +1,25 @@
+[Unit]
+Description=OpenVoiceOS PHAL Admin Service
+After=local-fs.target
+Wants=ovos_messagebus.service
+After=ovos_messagebus.service
+
+[Container]
+ContainerName=ovos_phal_admin
+Image=docker.io/smartgic/ovos-phal-admin:alpha
+AutoUpdate=registry
+LogDriver=journald
+HostName=ovos_phal_admin
+Network=host
+Timezone=local
+Volume=%h/ovos/config:/home/ovos/.config/mycroft
+Volume=%h/ovos/tmp:/tmp/mycroft
+Volume=/sys:/sys:ro
+Volume=/dev:/dev:ro
+
+[Service]
+TimeoutStartSec=900
+Restart=always
+
+[Install]
+WantedBy=multi-user.target default.target
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_vosk.volume b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_vosk.volume
new file mode 100644
index 00000000..ac20a914
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_vosk.volume
@@ -0,0 +1,4 @@
+[Volume]
+User=mycroft
+Group=mycroft
+Label=name=ovos_vosk