openvidu-recording Docker image tag as property

pull/39/head
pabloFuente 2018-03-15 19:11:49 +01:00
parent 13d231b9ab
commit efbb4e7763
6 changed files with 40 additions and 17 deletions

View File

@ -214,8 +214,9 @@ public class OpenViduServer implements JsonRpcConfigurer {
boolean recordingModuleEnabled = openviduConf.isRecordingModuleEnabled();
if (recordingModuleEnabled) {
ComposedRecordingService recordingService = context.getBean(ComposedRecordingService.class);
System.out.println(
"Recording module required: Downloading openvidu/openvidu-recording Docker image (800 MB aprox)");
recordingService.setRecordingVersion(openviduConf.getOpenViduRecordingVersion());
System.out.println("Recording module required: Downloading openvidu/openvidu-recording:"
+ openviduConf.getOpenViduRecordingVersion() + " Docker image (800 MB aprox)");
boolean imageExists = false;
try {

View File

@ -27,6 +27,9 @@ public class OpenviduConfig {
@Value("${openvidu.recording.free-access}")
boolean openviduRecordingFreeAccess;
@Value("${openvidu.recording.version}")
String openviduRecordingVersion;
private String finalUrl;
public String getOpenViduPublicUrl() {
@ -73,4 +76,8 @@ public class OpenviduConfig {
this.finalUrl = finalUrl.endsWith("/") ? (finalUrl) : (finalUrl + "/");
}
public String getOpenViduRecordingVersion() {
return this.openviduRecordingVersion;
}
}

View File

@ -64,6 +64,7 @@ public class ComposedRecordingService {
private Map<String, Recording> sessionsRecordings = new ConcurrentHashMap<>();
private final String IMAGE_NAME = "openvidu/openvidu-recording";
private String IMAGE_TAG;
private final String RECORDING_ENTITY_FILE = ".recording.";
private DockerClient dockerClient;
@ -192,7 +193,7 @@ public class ComposedRecordingService {
public boolean recordingImageExistsLocally() {
boolean imageExists = false;
try {
dockerClient.inspectImageCmd(IMAGE_NAME).exec();
dockerClient.inspectImageCmd(IMAGE_NAME + ":" + IMAGE_TAG).exec();
imageExists = true;
} catch (NotFoundException nfe) {
imageExists = false;
@ -204,15 +205,15 @@ public class ComposedRecordingService {
public void downloadRecordingImage() {
try {
dockerClient.pullImageCmd(IMAGE_NAME).exec(new PullImageResultCallback()).awaitSuccess();
dockerClient.pullImageCmd(IMAGE_NAME + ":" + IMAGE_TAG).exec(new PullImageResultCallback()).awaitSuccess();
} catch (NotFoundException | InternalServerErrorException e) {
if (imageExistsLocally(IMAGE_NAME)) {
log.info("Docker image '{}' exists locally", IMAGE_NAME);
if (imageExistsLocally(IMAGE_NAME + ":" + IMAGE_TAG)) {
log.info("Docker image '{}' exists locally", IMAGE_NAME + ":" + IMAGE_TAG);
} else {
throw e;
}
} catch (DockerClientException e) {
log.info("Error on Pulling '{}' image. Probably because the user has stopped the execution", IMAGE_NAME);
log.info("Error on Pulling '{}' image. Probably because the user has stopped the execution", IMAGE_NAME + ":" + IMAGE_TAG);
throw e;
}
}
@ -231,7 +232,7 @@ public class ComposedRecordingService {
private String runRecordingContainer(List<String> envs, String containerName) {
Volume volume1 = new Volume("/recordings");
CreateContainerCmd cmd = dockerClient.createContainerCmd(IMAGE_NAME).withName(containerName).withEnv(envs)
CreateContainerCmd cmd = dockerClient.createContainerCmd(IMAGE_NAME + ":" + IMAGE_TAG).withName(containerName).withEnv(envs)
.withNetworkMode("host").withVolumes(volume1)
.withBinds(new Bind(openviduConfig.getOpenViduRecordingPath(), volume1));
CreateContainerResponse container = null;
@ -399,4 +400,8 @@ public class ComposedRecordingService {
throw e;
}
public void setRecordingVersion(String version) {
this.IMAGE_TAG = version;
}
}

View File

@ -16,12 +16,12 @@
},
{
"name": "openvidu.cdr",
"type": "java.lang.String",
"type": "java.lang.Boolean",
"description": "Whether to enable Call Detail Record or not"
},
{
"name": "openvidu.recording",
"type": "java.lang.String",
"type": "java.lang.Boolean",
"description": "Whether to start OpenVidu Server with recording module service available or not (a Docker image will be downloaded during the first execution). Apart from setting this param to true, it is also necessary to explicitly configure sessions to be recorded"
},
{
@ -31,7 +31,12 @@
},
{
"name": "openvidu.recording.free-access",
"type": "java.lang.String",
"type": "java.lang.Boolean",
"description": "'true' to allow free access to the video files specified in 'openviu.recording.path'. 'false' to only allow access to authenticated users"
},
{
"name": "openvidu.recording.version",
"type": "java.lang.String",
"description": "Tag for openvidu/openvidu-recording Docker image"
}
]}

View File

@ -11,3 +11,4 @@ openvidu.cdr: false
openvidu.recording: false
openvidu.recording.path: /opt/openvidu/recordings
openvidu.recording.free-access: false
openvidu.recording.version: 1.8.0

View File

@ -1,12 +1,16 @@
server.port: 8443
server.address: 0.0.0.0
server.ssl.enabled: true
openvidu.recording.version: 1.8.0
server.port: 8443
server.ssl.key-store: classpath:openvidu-selfsigned.jks
server.ssl.key-store-password: openvidu
server.ssl.key-store-type: JKS
server.ssl.key-alias: openvidu-selfsigned
kms.uris=[\"ws://localhost:8888/kurento\"]
openvidu.secret: MY_SECRET
openvidu.publicurl: local
openvidu.cdr: false