mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: COMPOSED recording container update
parent
ac81abf7fd
commit
1e03af3ea3
|
@ -1,23 +1,25 @@
|
||||||
FROM ubuntu:16.04
|
FROM ubuntu:20.04
|
||||||
MAINTAINER openvidu@gmail.com
|
MAINTAINER openvidu@gmail.com
|
||||||
|
|
||||||
# Install Chrome
|
# Install packages
|
||||||
RUN apt-get update && apt-get -y upgrade && apt-get install -y wget sudo
|
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
|
||||||
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
|
wget \
|
||||||
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list && \
|
sudo \
|
||||||
apt-get update && apt-get install -y google-chrome-stable
|
gnupg2 \
|
||||||
|
apt-utils \
|
||||||
|
software-properties-common \
|
||||||
|
ffmpeg \
|
||||||
|
pulseaudio \
|
||||||
|
xvfb \
|
||||||
|
jq \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install media packages
|
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \
|
||||||
RUN apt-get install -y software-properties-common
|
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
|
||||||
RUN add-apt-repository ppa:jonathonf/ffmpeg-4
|
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y google-chrome-stable && rm -rf /var/lib/apt/lists/*
|
||||||
RUN apt-get update
|
|
||||||
RUN apt-get install -y ffmpeg pulseaudio xvfb
|
|
||||||
|
|
||||||
# Install jq for managing JSON
|
|
||||||
RUN apt-get install -y jq
|
|
||||||
|
|
||||||
# Clean
|
# Clean
|
||||||
RUN apt-get autoclean
|
RUN apt-get clean && apt-get autoclean && apt-get autoremove
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
RUN ["chmod", "+x", "/entrypoint.sh"]
|
RUN ["chmod", "+x", "/entrypoint.sh"]
|
||||||
|
|
|
@ -68,7 +68,7 @@ pulseaudio -D
|
||||||
|
|
||||||
touch xvfb.log
|
touch xvfb.log
|
||||||
chmod 777 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
|
touch stop
|
||||||
chmod 777 /recordings
|
chmod 777 /recordings
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
@ -169,17 +169,13 @@ public class ComposedRecordingService extends RecordingService {
|
||||||
final String container = RecordingManager.IMAGE_NAME + ":" + RecordingManager.IMAGE_TAG;
|
final String container = RecordingManager.IMAGE_NAME + ":" + RecordingManager.IMAGE_TAG;
|
||||||
final String containerName = "recording_" + recording.getId();
|
final String containerName = "recording_" + recording.getId();
|
||||||
Volume volume1 = new Volume("/recordings");
|
Volume volume1 = new Volume("/recordings");
|
||||||
Volume volume2 = new Volume("/dev/shm");
|
|
||||||
List<Volume> volumes = new ArrayList<>();
|
List<Volume> volumes = new ArrayList<>();
|
||||||
volumes.add(volume1);
|
volumes.add(volume1);
|
||||||
volumes.add(volume2);
|
|
||||||
Bind bind1 = new Bind(openviduConfig.getOpenViduRecordingPath(), volume1);
|
Bind bind1 = new Bind(openviduConfig.getOpenViduRecordingPath(), volume1);
|
||||||
Bind bind2 = new Bind("/dev/shm", volume2);
|
|
||||||
List<Bind> binds = new ArrayList<>();
|
List<Bind> binds = new ArrayList<>();
|
||||||
binds.add(bind1);
|
binds.add(bind1);
|
||||||
binds.add(bind2);
|
containerId = dockerManager.runContainer(container, containerName, null, volumes, binds, "host", envs, null,
|
||||||
containerId = dockerManager.runContainer(container, containerName, null,
|
536870912L);
|
||||||
volumes, binds, "host", envs, null);
|
|
||||||
containers.put(containerId, containerName);
|
containers.put(containerId, containerName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.cleanRecordingMaps(recording);
|
this.cleanRecordingMaps(recording);
|
||||||
|
|
|
@ -104,7 +104,8 @@ public class DockerManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String runContainer(String container, String containerName, String user, List<Volume> volumes,
|
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);
|
CreateContainerCmd cmd = dockerClient.createContainerCmd(container).withEnv(envs);
|
||||||
if (containerName != null) {
|
if (containerName != null) {
|
||||||
|
@ -116,6 +117,9 @@ public class DockerManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
HostConfig hostConfig = new HostConfig().withNetworkMode(networkMode);
|
HostConfig hostConfig = new HostConfig().withNetworkMode(networkMode);
|
||||||
|
if (shmSize != null) {
|
||||||
|
hostConfig.withShmSize(shmSize);
|
||||||
|
}
|
||||||
if (volumes != null) {
|
if (volumes != null) {
|
||||||
cmd.withVolumes(volumes);
|
cmd.withVolumes(volumes);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue