commit 534eb3f72354acbe1508315fa50380fee6b2b5e0
parent f3543ed164182de558c3ece885f21fad06bed13a
Author: Stefan Koch <programming@stefan-koch.name>
Date: Sun, 13 Dec 2020 15:19:49 +0100
create example for setting up jitsi
Diffstat:
4 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/examples/jitsi_auto_install/README.md b/examples/jitsi_auto_install/README.md
@@ -0,0 +1,27 @@
+Jitsi auto install
+==================
+
+Jitsi requires some host-specific configuration during installation and
+according to their forum it is easier to re-install the package with right
+configuration than to edit an existing installation.
+At least this goes for the automatic installation using the debian package.
+With the manual installation, we'd have all freedom. But let's stick to the
+deb-installation.
+
+This means, we will use a per-host script that is executed on the host
+during startup.
+
+For this, we will create a systemd unit that is execute in case a specific
+folder (`/etc/jitsi`) does not exist. This unit will then perform an
+unattended install of Jitsi.
+
+To achieve this, the systemd unit has to be installed into the QEMU image
+before boot. We achieve this with `guestmount`. All steps to change the image
+are given in `modify-image.sh`.
+
+As of the time of writing this guide, there is no functionality inside
+`aetherscale` to define ones own user script to execute during host boot.
+Since the environment variable `JITSI_HOSTNAME` has to be set differently
+for each VM it also does not work to prepare an image with these steps. Thus,
+at the time of writing this can only serve as an example what could be possible
+with a few modifications.
diff --git a/examples/jitsi_auto_install/jitsi-install.service b/examples/jitsi_auto_install/jitsi-install.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Install Jitsi
+ConditionPathExists=!/etc/jitsi
+
+[Service]
+Type=oneshot
+ExecStart=/root/jitsi-install.sh
+Environment=JITSI_HOSTNAME=jitsi.example.com
+
+[Install]
+WantedBy=multi-user.target
diff --git a/examples/jitsi_auto_install/jitsi-install.sh b/examples/jitsi_auto_install/jitsi-install.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+apt update
+apt -y install gnupg2 nginx-full apt-transport-https
+apt-add-repository universe
+apt update
+apt -y install openjdk-8-jdk
+
+hostnamectl set-hostname $JITSI_HOSTNAME
+
+curl https://download.jitsi.org/jitsi-key.gpg.key | sudo sh -c 'gpg --dearmor > /usr/share/keyrings/jitsi-keyring.gpg'
+echo 'deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg] https://download.jitsi.org stable/' | sudo tee /etc/apt/sources.list.d/jitsi-stable.list > /dev/null
+apt update
+
+echo "jitsi-videobridge jitsi-videobridge/jvb-hostname string $JITSI_HOSTNAME" | debconf-set-selections
+echo "jitsi-meet jitsi-meet/cert-choice select Self-signed certificate will be generated" | debconf-set-selections
+export DEBIAN_FRONTEND=noninteractive
+apt -y install jitsi-meet
diff --git a/examples/jitsi_auto_install/modify-image.sh b/examples/jitsi_auto_install/modify-image.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+MOUNT=/tmp/mount
+
+mkdir $MOUNT
+
+guestmount -a jitsi2.qcow2 -i $MOUNT
+cp jitsi-install.sh $MOUNT/root
+cp jitsi-install.service $MOUNT/etc/systemd/system/
+ln -s /etc/systemd/system/jitsi-install.service $MOUNT/etc/systemd/system/multi-user.target.wants/
+guestunmount $MOUNT