mirror of https://github.com/OpenVidu/openvidu.git
openvidu: Safer way to run xvfb in openvidu-recording to fix concurrent recordings issue
parent
4d66a5b2a5
commit
2d74acb39d
|
@ -50,7 +50,7 @@ fi
|
|||
|
||||
touch xvfb.log
|
||||
chmod 777 xvfb.log
|
||||
xvfb-run --auto-servernum --server-args="-ac -screen 0 ${RESOLUTION}x24 -noreset" google-chrome --kiosk --start-maximized --test-type --no-sandbox --disable-infobars --disable-gpu --disable-popup-blocking --window-size=$WIDTH,$HEIGHT --window-position=0,0 --no-first-run --ignore-certificate-errors --disable-dev-shm-usage --autoplay-policy=no-user-gesture-required --simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT' $DEBUG_CHROME_FLAGS $URL &> xvfb.log &
|
||||
xvfb-run-safe --server-args="-ac -screen 0 ${RESOLUTION}x24 -noreset" google-chrome --kiosk --start-maximized --test-type --no-sandbox --disable-infobars --disable-gpu --disable-popup-blocking --window-size=$WIDTH,$HEIGHT --window-position=0,0 --no-first-run --ignore-certificate-errors --disable-dev-shm-usage --autoplay-policy=no-user-gesture-required --simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT' $DEBUG_CHROME_FLAGS $URL &> xvfb.log &
|
||||
touch stop
|
||||
chmod 777 /recordings
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ if [[ -z "${COMPOSED_QUICK_START_ACTION}" ]]; then
|
|||
|
||||
touch xvfb.log
|
||||
chmod 777 xvfb.log
|
||||
xvfb-run --auto-servernum --server-args="-ac -screen 0 ${RESOLUTION}x24 -noreset" google-chrome --kiosk --start-maximized --test-type --no-sandbox --disable-infobars --disable-gpu --disable-popup-blocking --window-size=$WIDTH,$HEIGHT --window-position=0,0 --no-first-run --ignore-certificate-errors --disable-dev-shm-usage --autoplay-policy=no-user-gesture-required --simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT' $DEBUG_CHROME_FLAGS $URL &> xvfb.log &
|
||||
xvfb-run-safe --server-args="-ac -screen 0 ${RESOLUTION}x24 -noreset" google-chrome --kiosk --start-maximized --test-type --no-sandbox --disable-infobars --disable-gpu --disable-popup-blocking --window-size=$WIDTH,$HEIGHT --window-position=0,0 --no-first-run --ignore-certificate-errors --disable-dev-shm-usage --autoplay-policy=no-user-gesture-required --simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT' $DEBUG_CHROME_FLAGS $URL &> xvfb.log &
|
||||
chmod 777 /recordings
|
||||
|
||||
until pids=$(pidof Xvfb)
|
||||
|
|
|
@ -26,9 +26,12 @@ RUN adduser root pulse-access
|
|||
RUN apt-get autoclean
|
||||
|
||||
COPY entrypoint.sh scripts/composed.sh scripts/composed_quick_start.sh ./
|
||||
RUN ["chmod", "+x", "/entrypoint.sh", "/composed.sh", "/composed_quick_start.sh"]
|
||||
COPY utils/xvfb-run-safe /usr/local/bin
|
||||
|
||||
RUN mkdir /recordings
|
||||
RUN chmod 777 /recordings
|
||||
# Prepare scripts and folders
|
||||
RUN chmod +x /entrypoint.sh /composed.sh /composed_quick_start.sh \
|
||||
&& chmod +x /usr/local/bin/xvfb-run-safe \
|
||||
&& mkdir /recordings \
|
||||
&& chmod 777 /recordings
|
||||
|
||||
ENTRYPOINT /entrypoint.sh
|
|
@ -30,9 +30,12 @@ RUN adduser root pulse-access
|
|||
RUN apt-get clean && apt-get autoclean && apt-get autoremove
|
||||
|
||||
COPY entrypoint.sh scripts/composed.sh scripts/composed_quick_start.sh ./
|
||||
RUN ["chmod", "+x", "/entrypoint.sh", "/composed.sh", "/composed_quick_start.sh"]
|
||||
COPY utils/xvfb-run-safe /usr/local/bin
|
||||
|
||||
RUN mkdir /recordings
|
||||
RUN chmod 777 /recordings
|
||||
# Prepare scripts and folders
|
||||
RUN chmod +x /entrypoint.sh /composed.sh /composed_quick_start.sh \
|
||||
&& chmod +x /usr/local/bin/xvfb-run-safe \
|
||||
&& mkdir /recordings \
|
||||
&& chmod 777 /recordings
|
||||
|
||||
ENTRYPOINT /entrypoint.sh
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# allow settings to be updated via environment
|
||||
: "${xvfb_lockdir:=/recordings/.xvfb-locks}" # Lock folder necessary to block displays
|
||||
: "${xvfb_display_min:=99}" # Min display
|
||||
: "${xvfb_display_max:=599}" # Max display
|
||||
|
||||
|
||||
|
||||
mkdir -p -- "$xvfb_lockdir" || exit
|
||||
|
||||
i=$xvfb_display_min # minimum display number
|
||||
while (( i < xvfb_display_max )); do
|
||||
if [ -f "/tmp/.X$i-lock" ]; then
|
||||
(( ++i )); continue
|
||||
fi
|
||||
exec 5>"$xvfb_lockdir/$i" || continue
|
||||
if flock -x -n 5; then
|
||||
exec xvfb-run --server-num="$i" "$@" || exit
|
||||
fi
|
||||
(( i++ ))
|
||||
done
|
Loading…
Reference in New Issue