Skip to content

Commit

Permalink
openvidu-server: connection to Docker daemon failure response improved
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloFuente committed Jan 30, 2019
1 parent 334a1d6 commit 403c858
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public static enum Code {
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
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;
Expand Down Expand Up @@ -237,9 +238,15 @@ public void init() throws MalformedURLException, InterruptedException {
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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,14 @@ public void initializeRecordingManager() throws OpenViduException {
+ " -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) {
Expand Down

0 comments on commit 403c858

Please sign in to comment.