From 46029d533c9fbef34aab6c895b90a9296bd14706 Mon Sep 17 00:00:00 2001 From: Your Name <56784875+ckbaker10@users.noreply.github.com> Date: Tue, 28 May 2024 11:22:20 +0200 Subject: [PATCH] Ubuntu Service files --- conf/systemd/README.md | 15 +++++++++++++++ conf/systemd/install.sh | 7 +++++++ conf/systemd/webvirt | 2 ++ conf/systemd/webvirt-cloud.service | 23 +++++++++++++++++++++++ conf/systemd/webvirt-gstfsd.service | 19 +++++++++++++++++++ conf/systemd/webvirt-novncd.service | 23 +++++++++++++++++++++++ conf/systemd/webvirt-socketiod.service | 23 +++++++++++++++++++++++ 7 files changed, 112 insertions(+) create mode 100644 conf/systemd/README.md create mode 100755 conf/systemd/install.sh create mode 100644 conf/systemd/webvirt create mode 100644 conf/systemd/webvirt-cloud.service create mode 100644 conf/systemd/webvirt-gstfsd.service create mode 100644 conf/systemd/webvirt-novncd.service create mode 100644 conf/systemd/webvirt-socketiod.service diff --git a/conf/systemd/README.md b/conf/systemd/README.md new file mode 100644 index 0000000..4333f36 --- /dev/null +++ b/conf/systemd/README.md @@ -0,0 +1,15 @@ +# Ubuntu Service Files + +I choose to install this service on Ubuntu 22.04 + +The process is not fully documented but I wanted to contribute the service files + +The file webvirt is beeing installed into /etc/default/webvirt and allows you to easily change the location of the webvirtcloud installation path + +The PATH variable being set for these services includes /usr/bin which contains the ssh executable. That is being used by webvirt-cloud and webvirt-novncd + +Should the executable be located in another location please adjust the path + +The error you should be seeing is "ssh executable not found" + + diff --git a/conf/systemd/install.sh b/conf/systemd/install.sh new file mode 100755 index 0000000..5fc9d07 --- /dev/null +++ b/conf/systemd/install.sh @@ -0,0 +1,7 @@ +#!/bin/bash +FILEPATH=$(readlink -f "$0"); +SCRIPTPATH=$(dirname "$FILEPATH"); +cd "$SCRIPTPATH" +cp webvirt-* /lib/systemd/system/ +cp webvirt /etc/default/ +echo Run to start services \"systemctl daemon-reload\; systemctl enable --now $(ls webvirt-* | tr "\n" " ")\" diff --git a/conf/systemd/webvirt b/conf/systemd/webvirt new file mode 100644 index 0000000..8ea90b7 --- /dev/null +++ b/conf/systemd/webvirt @@ -0,0 +1,2 @@ +WEBVIRT_PATH="/srv/webvirtcloud" +SERVICE_PATH="$WEBVIRT_PATH/venv/bin:/usr/bin" diff --git a/conf/systemd/webvirt-cloud.service b/conf/systemd/webvirt-cloud.service new file mode 100644 index 0000000..9fe3307 --- /dev/null +++ b/conf/systemd/webvirt-cloud.service @@ -0,0 +1,23 @@ +[Unit] +Description=Webvirt Cloud Webinterface +Wants=network-online.target +After=network-online.target + +[Service] +Type=simple +Restart=on-failure +RestartSec=10 +User=www-data +Group=www-data +LimitNOFILE=64000 +AmbientCapabilities=CAP_NET_BIND_SERVICE +EnvironmentFile=/etc/default/webvirt + +ExecStart=/bin/bash -c "cd ${WEBVIRT_PATH};${WEBVIRT_PATH}/venv/bin/gunicorn webvirtcloud.wsgi:application -c ${WEBVIRT_PATH}/gunicorn.conf.py" + +# Make sure stderr/stdout is captured in the systemd journal. +StandardOutput=journal +StandardError=journal + +[Install] +WantedBy=multi-user.target diff --git a/conf/systemd/webvirt-gstfsd.service b/conf/systemd/webvirt-gstfsd.service new file mode 100644 index 0000000..6e89e1c --- /dev/null +++ b/conf/systemd/webvirt-gstfsd.service @@ -0,0 +1,19 @@ +[Unit] +Description=Webvirt Cloud GSTFSD +Wants=network-online.target +After=network-online.target + +[Service] +Type=simple +Restart=on-failure +RestartSec=10 +LimitNOFILE=64000 + +ExecStart=/usr/bin/python3 /usr/local/bin/gstfsd + +# Make sure stderr/stdout is captured in the systemd journal. +StandardOutput=journal +StandardError=journal + +[Install] +WantedBy=multi-user.target diff --git a/conf/systemd/webvirt-novncd.service b/conf/systemd/webvirt-novncd.service new file mode 100644 index 0000000..0cac27d --- /dev/null +++ b/conf/systemd/webvirt-novncd.service @@ -0,0 +1,23 @@ +[Unit] +Description=Webvirt Cloud NOVNCD +Wants=network-online.target +After=network-online.target + +[Service] +Type=simple +Restart=on-failure +RestartSec=10 +User=www-data +Group=www-data +LimitNOFILE=64000 +AmbientCapabilities=CAP_NET_BIND_SERVICE +EnvironmentFile=/etc/default/webvirt + +ExecStart=/bin/bash -c "cd ${WEBVIRT_PATH};${WEBVIRT_PATH}/venv/bin/python3 ${WEBVIRT_PATH}/console/novncd" + +# Make sure stderr/stdout is captured in the systemd journal. +StandardOutput=journal +StandardError=journal + +[Install] +WantedBy=multi-user.target diff --git a/conf/systemd/webvirt-socketiod.service b/conf/systemd/webvirt-socketiod.service new file mode 100644 index 0000000..741f0dc --- /dev/null +++ b/conf/systemd/webvirt-socketiod.service @@ -0,0 +1,23 @@ +[Unit] +Description=Webvirt Cloud NOVNCD +Wants=network-online.target +After=network-online.target + +[Service] +Type=simple +Restart=on-failure +RestartSec=10 +User=www-data +Group=www-data +LimitNOFILE=64000 +AmbientCapabilities=CAP_NET_BIND_SERVICE +EnvironmentFile=/etc/default/webvirt + +ExecStart=/bin/bash -c "cd ${WEBVIRT_PATH};${WEBVIRT_PATH}/venv/bin/python3 ${WEBVIRT_PATH}/console/socketiod -d" + +# Make sure stderr/stdout is captured in the systemd journal. +StandardOutput=journal +StandardError=journal + +[Install] +WantedBy=multi-user.target