diff --git a/recording/docker-compose/Dockerfile b/recording/docker-compose/Dockerfile new file mode 100644 index 00000000000..1f680e0f72f --- /dev/null +++ b/recording/docker-compose/Dockerfile @@ -0,0 +1,48 @@ +FROM ubuntu:20.04 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get --assume-yes update +RUN apt-get --assume-yes upgrade + +# Common dependencies +RUN apt-get --assume-yes install software-properties-common + +# spreed-recording dependencies +RUN apt-get --assume-yes install ffmpeg pulseaudio python3-pip xvfb +RUN pip3 install --upgrade requests + +# firefox +RUN apt-get --assume-yes install firefox firefox-geckodriver + +# chromium +# The phd/chromium repository for Ubuntu is used because since Ubuntu 20.04 +# Chromium is provided as a snap package, and the equivalent PPA has been +# discontinued. +RUN echo "deb https://freeshell.de/phd/chromium/focal /" > /etc/apt/sources.list.d/phd-chromium.list +RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 869689FE09306074 +RUN apt-get update +RUN apt-get --assume-yes install chromium + +COPY ./docker-compose/wrap_chromium_binary /opt/bin/wrap_chromium_binary +RUN /opt/bin/wrap_chromium_binary + +# spreed-recording config +RUN useradd --create-home recording +COPY server.conf.in /etc/nextcloud-talk-recording/server.conf +RUN sed --in-place 's/#listen =.*/listen = 0.0.0.0:8000/' /etc/nextcloud-talk-recording/server.conf + +# Deploy recording server +RUN mkdir --parents /tmp/recording +COPY src /tmp/recording/ +COPY pyproject.toml /tmp/recording/ +RUN python3 -m pip install /tmp/recording/ + +# Cleanup +RUN apt-get clean && rm --recursive --force /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN rm --recursive --force /tmp/recording + +# Switch user and start the recording server +WORKDIR "/home/recording/" +USER "recording" +CMD ["python3", "-m", "nextcloud.talk.recording", "--config", "/etc/nextcloud-talk-recording/server.conf"] diff --git a/recording/docker-compose/docker-compose.yml b/recording/docker-compose/docker-compose.yml new file mode 100644 index 00000000000..7b9cd07247d --- /dev/null +++ b/recording/docker-compose/docker-compose.yml @@ -0,0 +1,21 @@ +version: "3.9" + +services: + + nextcloud-talk-recording: + build: + context: .. + dockerfile: ./docker-compose/Dockerfile + init: true + shm_size: '2gb' + restart: on-failure + # By default the recording server is reachable through the network "nextcloud-talk-recording" + # Depending on your setup (if you need to reach the recording server externally for example) you might need + # to expose the used ports to the host machine, e.g.: + #ports: + # - "8000:8000" + networks: + - nextcloud-talk-recording + +networks: + nextcloud-talk-recording: diff --git a/recording/docker-compose/wrap_chromium_binary b/recording/docker-compose/wrap_chromium_binary new file mode 100755 index 00000000000..ab6338d9e01 --- /dev/null +++ b/recording/docker-compose/wrap_chromium_binary @@ -0,0 +1,33 @@ +#!/bin/bash + +# Originally adjusted from https://github.com/SeleniumHQ/docker-selenium/blob/c6df1ab8dc6a5aca05c163c429a062ada1d79c51/NodeChrome/wrap_chrome_binary +# which is licensed under the Apache license 2.0 (https://github.com/SeleniumHQ/docker-selenium/blob/c6df1ab8dc6a5aca05c163c429a062ada1d79c51/LICENSE.md) + +WRAPPER_PATH=$(readlink -f /usr/bin/chromium) +BASE_PATH="$WRAPPER_PATH-base" +mv "$WRAPPER_PATH" "$BASE_PATH" + +cat > "$WRAPPER_PATH" <<_EOF +#!/bin/bash + +# umask 002 ensures default permissions of files are 664 (rw-rw-r--) and directories are 775 (rwxrwxr-x). +umask 002 + +# Debian/Ubuntu seems to not respect --lang, it instead needs to be a LANGUAGE environment var +# See: https://stackoverflow.com/a/41893197/359999 +for var in "\$@"; do + if [[ \$var == --lang=* ]]; then + LANGUAGE=\${var//--lang=} + fi +done + +# Set language environment variable +export LANGUAGE="\$LANGUAGE" + +# Note: exec -a below is a bashism. +exec -a "\$0" "$BASE_PATH" --no-sandbox "\$@" +_EOF +chmod +x "$WRAPPER_PATH" + +# Also add the executable name expected by Selenium Manager +ln --symbolic "$WRAPPER_PATH" /usr/bin/chrome