From e6a0c0461ed3040fa8c4c9e2c17940b7fae85faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 30 Nov 2023 22:51:13 +0100 Subject: [PATCH] jibri: add check for /dev/shm size If the container was staryed without a /dev/shm of at least 2GB (defaults to 6MB in Docker) Chrome will behave erratically or crash. Catch this with a tiny binary and make the container fail to start. Ref: https://github.com/jitsi/docker-jitsi-meet/issues/1653 --- jibri/Dockerfile | 8 +++++++- jibri/rootfs/etc/cont-init.d/10-config | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/jibri/Dockerfile b/jibri/Dockerfile index 52f8698..fbe9506 100644 --- a/jibri/Dockerfile +++ b/jibri/Dockerfile @@ -20,6 +20,12 @@ RUN apt-dpkg-wrap apt-get update && \ apt-dpkg-wrap apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" jibri libgl1-mesa-dri procps jitsi-upload-integrations jitsi-autoscaler-sidecar jq pulseaudio dbus dbus-x11 rtkit unzip fonts-noto && \ /usr/bin/install-chrome.sh && \ apt-cleanup && \ - adduser jibri rtkit + adduser jibri rtkit && \ + case ${TARGETPLATFORM} in \ + "linux/amd64") SC_ARCH=x86_64 ;; \ + "linux/arm64") SC_ARCH=aarch64 ;; \ + esac && \ + wget -qO /usr/bin/shm-check https://github.com/saghul/shm-check/releases/download/v1.0.0/shm-check-${SC_ARCH} && \ + chmod +x /usr/bin/shm-check VOLUME /config diff --git a/jibri/rootfs/etc/cont-init.d/10-config b/jibri/rootfs/etc/cont-init.d/10-config index a90c673..9d3b1f5 100644 --- a/jibri/rootfs/etc/cont-init.d/10-config +++ b/jibri/rootfs/etc/cont-init.d/10-config @@ -1,5 +1,11 @@ #!/usr/bin/with-contenv bash +# Check if /dev/shm is large enough (2GB at least) +if ! shm-check; then + echo "/dev/shm must be at least 2GB in size" + exit 1 +fi + if [[ -z $JIBRI_RECORDER_PASSWORD || -z $JIBRI_XMPP_PASSWORD ]]; then echo 'FATAL ERROR: Jibri recorder password and auth password must be set' exit 1