openvidu-server: connection to Docker daemon failure response improved

pull/203/head
pabloFuente 2019-01-30 18:10:37 +01:00
parent 334a1d6b70
commit 403c8583b4
3 changed files with 19 additions and 8 deletions

View File

@ -48,9 +48,9 @@ public class OpenViduException extends JsonRpcErrorException {
SIGNAL_FORMAT_INVALID_ERROR_CODE(600), SIGNAL_TO_INVALID_ERROR_CODE(601),
SIGNAL_MESSAGE_INVALID_ERROR_CODE(602),
RECORDING_PATH_NOT_VALID(708), RECORDING_FILE_EMPTY_ERROR(707), RECORDING_DELETE_ERROR_CODE(706),
RECORDING_LIST_ERROR_CODE(705), RECORDING_STOP_ERROR_CODE(704), RECORDING_START_ERROR_CODE(703),
RECORDING_REPORT_ERROR_CODE(702), RECORDING_COMPLETION_ERROR_CODE(701);
RECORDING_ENABLED_BUT_DOCKER_NOT_FOUND(709), RECORDING_PATH_NOT_VALID(708), RECORDING_FILE_EMPTY_ERROR(707),
RECORDING_DELETE_ERROR_CODE(706), RECORDING_LIST_ERROR_CODE(705), RECORDING_STOP_ERROR_CODE(704),
RECORDING_START_ERROR_CODE(703), RECORDING_REPORT_ERROR_CODE(702), RECORDING_COMPLETION_ERROR_CODE(701);
private int value;

View File

@ -45,6 +45,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import io.openvidu.client.OpenViduException;
import io.openvidu.client.OpenViduException.Code;
import io.openvidu.server.cdr.CDRLoggerFile;
import io.openvidu.server.cdr.CallDetailRecord;
import io.openvidu.server.config.OpenviduConfig;
@ -237,9 +238,15 @@ public class OpenViduServer implements JsonRpcConfigurer {
try {
this.recordingManager().initializeRecordingManager();
} catch (OpenViduException e) {
log.error(
"Error initializing recording path \"{}\" set with system property \"openvidu.recording.path\". Shutting down OpenVidu Server",
this.openviduConfig().getOpenViduRecordingPath());
String finalErrorMessage = "";
if (e.getCodeValue() == Code.RECORDING_ENABLED_BUT_DOCKER_NOT_FOUND.getValue()) {
finalErrorMessage = "Error connecting to Docker daemon. Enabling OpenVidu recording module requires Docker";
} else if (e.getCodeValue() == Code.RECORDING_PATH_NOT_VALID.getValue()) {
finalErrorMessage = "Error initializing recording path \""
+ this.openviduConfig().getOpenViduRecordingPath()
+ "\" set with system property \"openvidu.recording.path\". Shutting down OpenVidu Server";
}
log.error(finalErrorMessage);
System.exit(1);
}
}

View File

@ -133,10 +133,14 @@ public class RecordingManager {
+ " -e MY_UID=$(id -u $USER)" + NEW_LINE + " -v /var/run/docker.sock:/var/run/docker.sock"
+ NEW_LINE + " -v /YOUR/PATH/TO/VIDEO/FILES:/YOUR/PATH/TO/VIDEO/FILES" + NEW_LINE;
} else {
message += "you need Docker installed in this machine to enable OpenVidu recording service";
message += "you need Docker CE installed in this machine to enable OpenVidu recording service. "
+ "If Docker CE is already installed, make sure to add OpenVidu Server user to "
+ "\"docker\" group: " + System.lineSeparator() + " 1) $ sudo usermod -aG docker $USER"
+ System.lineSeparator()
+ " 2) Log out and log back to the host to reevaluate group membership";
}
log.error(message);
throw new RuntimeException(message);
throw new OpenViduException(Code.RECORDING_ENABLED_BUT_DOCKER_NOT_FOUND, message);
}
if (imageExists) {