openvidu-server: COMPOSED recording container update

pull/508/head
pabloFuente 2020-06-08 12:19:30 +02:00
parent ac81abf7fd
commit 1e03af3ea3
4 changed files with 25 additions and 23 deletions

View File

@ -1,23 +1,25 @@
FROM ubuntu:16.04
FROM ubuntu:20.04
MAINTAINER openvidu@gmail.com
# Install Chrome
RUN apt-get update && apt-get -y upgrade && apt-get install -y wget sudo
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list && \
apt-get update && apt-get install -y google-chrome-stable
# 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 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
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y google-chrome-stable && rm -rf /var/lib/apt/lists/*
# Clean
RUN apt-get autoclean
RUN apt-get clean && apt-get autoclean && apt-get autoremove
COPY entrypoint.sh /entrypoint.sh
RUN ["chmod", "+x", "/entrypoint.sh"]

View File

@ -68,7 +68,7 @@ pulseaudio -D
touch xvfb.log
chmod 777 xvfb.log
xvfb-run --server-num=${DISPLAY_NUM} --server-args="-ac -screen 0 ${RESOLUTION}x24 -noreset" google-chrome --start-maximized --no-sandbox --test-type --disable-infobars --window-size=$WIDTH,$HEIGHT --window-position=0,0 --no-first-run --ignore-certificate-errors --autoplay-policy=no-user-gesture-required --kiosk $URL &> xvfb.log &
xvfb-run --server-num=${DISPLAY_NUM} --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 --autoplay-policy=no-user-gesture-required $URL &> xvfb.log &
touch stop
chmod 777 /recordings
sleep 2

View File

@ -169,17 +169,13 @@ public class ComposedRecordingService extends RecordingService {
final String container = RecordingManager.IMAGE_NAME + ":" + RecordingManager.IMAGE_TAG;
final String containerName = "recording_" + recording.getId();
Volume volume1 = new Volume("/recordings");
Volume volume2 = new Volume("/dev/shm");
List<Volume> volumes = new ArrayList<>();
volumes.add(volume1);
volumes.add(volume2);
Bind bind1 = new Bind(openviduConfig.getOpenViduRecordingPath(), volume1);
Bind bind2 = new Bind("/dev/shm", volume2);
List<Bind> binds = new ArrayList<>();
binds.add(bind1);
binds.add(bind2);
containerId = dockerManager.runContainer(container, containerName, null,
volumes, binds, "host", envs, null);
containerId = dockerManager.runContainer(container, containerName, null, volumes, binds, "host", envs, null,
536870912L);
containers.put(containerId, containerName);
} catch (Exception e) {
this.cleanRecordingMaps(recording);

View File

@ -104,7 +104,8 @@ public class DockerManager {
}
public String runContainer(String container, String containerName, String user, List<Volume> volumes,
List<Bind> binds, String networkMode, List<String> envs, List<String> command) throws Exception {
List<Bind> binds, String networkMode, List<String> envs, List<String> command, Long shmSize)
throws Exception {
CreateContainerCmd cmd = dockerClient.createContainerCmd(container).withEnv(envs);
if (containerName != null) {
@ -116,6 +117,9 @@ public class DockerManager {
}
HostConfig hostConfig = new HostConfig().withNetworkMode(networkMode);
if (shmSize != null) {
hostConfig.withShmSize(shmSize);
}
if (volumes != null) {
cmd.withVolumes(volumes);
}