diff --git a/openvidu-server/docker/openvidu-recording/firefox/Dockerfile b/openvidu-server/docker/openvidu-recording/firefox/Dockerfile index d4ccaebe..98a6fcb1 100644 --- a/openvidu-server/docker/openvidu-recording/firefox/Dockerfile +++ b/openvidu-server/docker/openvidu-recording/firefox/Dockerfile @@ -1,21 +1,24 @@ -FROM ubuntu:16.04 +FROM ubuntu:20.04 MAINTAINER openvidu@gmail.com +# Install packages +RUN apt-get update && apt-get -y upgrade && apt-get install -y \ + wget \ + sudo \ + gnupg2 \ + apt-utils \ + software-properties-common \ + ffmpeg \ + pulseaudio \ + xvfb \ + jq \ + && rm -rf /var/lib/apt/lists/* + # Install Firefox -RUN apt-get update && apt-get -y upgrade && apt-get install -y wget sudo -RUN apt-get install -y firefox +RUN apt-get update && apt-get -y upgrade && apt-get install -y firefox -# Install media packages -RUN apt-get install -y software-properties-common -RUN add-apt-repository ppa:jonathonf/ffmpeg-4 -RUN apt-get update -RUN apt-get install -y ffmpeg pulseaudio xvfb - -# Install jq for managing JSON -RUN apt-get install -y jq - -# Clean -RUN apt-get autoclean +# Clean +RUN apt-get clean && apt-get autoclean && apt-get autoremove COPY entrypoint.sh /entrypoint.sh COPY configuration/autoconfig.js /usr/lib/firefox/defaults/pref/autoconfig.js diff --git a/openvidu-server/docker/openvidu-recording/firefox/configuration/customconfig.cfg b/openvidu-server/docker/openvidu-recording/firefox/configuration/customconfig.cfg index 3aac4941..173433b0 100644 --- a/openvidu-server/docker/openvidu-recording/firefox/configuration/customconfig.cfg +++ b/openvidu-server/docker/openvidu-recording/firefox/configuration/customconfig.cfg @@ -5,4 +5,6 @@ lockPref("extensions.autoDisableScopes", 0); lockPref("extensions.enabledScopes", 15); lockPref("security.ssl.enable_ocsp_stapling", false); lockPref("network.stricttransportsecurity.preloadlist", false); -lockPref("network.http.phishy-userpass-length", 300); \ No newline at end of file +lockPref("network.http.phishy-userpass-length", 300); +lockPref("security.enterprise_roots.enabled", true); +lockPref("network.websocket.allowInsecureFromHTTPS", true); \ No newline at end of file diff --git a/openvidu-server/docker/openvidu-recording/firefox/create_image.sh b/openvidu-server/docker/openvidu-recording/firefox/create_image.sh index beb53402..a7caa7af 100755 --- a/openvidu-server/docker/openvidu-recording/firefox/create_image.sh +++ b/openvidu-server/docker/openvidu-recording/firefox/create_image.sh @@ -1 +1 @@ -docker build --rm -t openvidu/openvidu-recording:2.10.0-firefox . +docker build --rm -t openvidu/openvidu-recording:2.15.0-firefox . diff --git a/openvidu-server/docker/openvidu-recording/firefox/entrypoint.sh b/openvidu-server/docker/openvidu-recording/firefox/entrypoint.sh index 5732cfe7..4a59f02e 100755 --- a/openvidu-server/docker/openvidu-recording/firefox/entrypoint.sh +++ b/openvidu-server/docker/openvidu-recording/firefox/entrypoint.sh @@ -30,38 +30,28 @@ mkdir /recordings/$VIDEO_ID chmod 777 /recordings/$VIDEO_ID echo $RECORDING_JSON > /recordings/$VIDEO_ID/.recording.$VIDEO_ID -### Get a free display identificator ### - -DISPLAY_NUM=99 -DONE="no" - -while [ "$DONE" == "no" ] -do - out=$(xdpyinfo -display :$DISPLAY_NUM 2>&1) - if [[ "$out" == name* ]] || [[ "$out" == Invalid* ]] - then - # Command succeeded; or failed with access error; display exists - (( DISPLAY_NUM+=1 )) - else - # Display doesn't exist - DONE="yes" - fi -done - -export DISPLAY_NUM - -echo "First available display -> :$DISPLAY_NUM" -echo "----------------------------------------" - pulseaudio -D -### Start Chrome in headless mode with xvfb, using the display num previously obtained ### +### Start Chrome in headless mode with xvfb, using an automatically provided free display num ### touch xvfb.log chmod 777 xvfb.log -xvfb-run --server-num=${DISPLAY_NUM} --server-args="-ac -screen 0 ${RESOLUTION}x24 -noreset" firefox --width $WIDTH --height $HEIGHT $URL &> xvfb.log & +xvfb-run --auto-servernum --server-args="-ac -screen 0 ${RESOLUTION}x24 -noreset" firefox --width $WIDTH --height $HEIGHT $URL &> xvfb.log & touch stop chmod 777 /recordings + +until pids=$(pidof Xvfb) +do + sleep 0.1 +done + +### Calculate the display num in use parsing args of command "Xvfb" + +XVFB_ARGS=$(ps -eo args | grep [X]vfb) +DISPLAY_NUM=$(echo $XVFB_ARGS | sed 's/Xvfb :\([0-9]\+\).*/\1/') +echo "Display in use -> :$DISPLAY_NUM" +echo "----------------------------------------" + sleep 5 ### Start recording with ffmpeg ###