Commit da253db7 authored by 李丛阳's avatar 李丛阳

apache

parent ad8204f3
......@@ -82,8 +82,12 @@ public class BCodeLxcServiceImpl implements BCodeLxcService {
result = new CommandResult(ResultCode.FAIL,"容器配置文件有误!",lxc);
return result;
}
/*启动路径*/
String dockerPath = global.getPHYSICAL_UPLOAD_SERVER_LOCATION() + File.separator +
global.getLxcDockerfilePath() + File.separator + lxc.getUserId() + File.separator;
/*2.docker-compose 起容器*/
result = lxcCommand.startOrDownLxc(destPath);
log.info("执行路径:{}",dockerPath);
result = lxcCommand.startOrDownLxc(dockerPath);
if(!result.isSuccess()) {
result = new CommandResult(ResultCode.FAIL,"容器启动失败!",lxc);
return result;
......@@ -103,7 +107,7 @@ public class BCodeLxcServiceImpl implements BCodeLxcService {
Map jobParam = new HashMap();
jobParam.put("redisKeyId",key);
jobParam.put("containerName",this.getModelProject(lxc.getCode()) + "_" + lxc.getUserId());
jobParam.put("containerPath",destPath);
jobParam.put("containerPath",dockerPath);
jobParam.put("containerPort",port);
JobDetail job = JobBuilder.newJob(StopLxcJob.class).
withIdentity(global.getLxcPrefix() + lxc.getUserId(), JOB_LXC_GROUP).
......
......@@ -34,6 +34,11 @@ public class Global {
@Value("${global.path.base_upload_server_location}")
private String BASE_UPLOAD_SERVER_LOCATION;
/*容器外路径*/
@Value("${global.path.physical_upload_server_location}")
private String PHYSICAL_UPLOAD_SERVER_LOCATION;
/*课程相关文件路径*/
@Value("${global.path.course_location}")
private String COURSE_LOCATION;
......
......@@ -58,11 +58,13 @@ public class LxcCommand {
CommandResult commandResult = null;
try {
File dirPath = new File(dest);
if(!dirPath.exists() || !dirPath.isDirectory()){
if(!isRemote) {
if (!dirPath.exists() || !dirPath.isDirectory()) {
log.error("目录错误 ...." + dest);
commandResult = new CommandResult(ResultCode.FAIL,"目录不存在",null);
commandResult = new CommandResult(ResultCode.FAIL, "目录不存在", null);
return commandResult;
}
}
if (isStart)
if (isRemote)
remoteExecuteCommand.execute(START_LXC_COMMAND,dest);
......@@ -73,8 +75,10 @@ public class LxcCommand {
remoteExecuteCommand.execute(DOWN_LXC_COMMAND,dest);
else
Runtime.getRuntime().exec("cd " + dest + " && " + DOWN_LXC_COMMAND);
if(!isRemote) {
dirPath.delete();
}
}
commandResult = new CommandResult(ResultCode.SUCCESS,null,null);
}catch (Exception e){
log.error(e.getMessage());
......
......@@ -105,6 +105,7 @@ global:
max_password: 16
path:
base_upload_server_location: /working/resource/eduServer/
physical_upload_server_location: /working/resource/eduServer
course_location: course
lesson_location: lesson
sl_location: sl
......
......@@ -55,7 +55,7 @@ spring:
add-mappings: false
redis:
host: 106.2.3.134
port: 7481
port: 7482
pool:
max-idle: 50
max-active: 1000
......@@ -105,6 +105,7 @@ global:
max_password: 16
path:
base_upload_server_location: /working/resource/eduServer/
physical_upload_server_location: /working/dockervolume/edu2_data_ubuntu/eduServer
course_location: course
lesson_location: lesson
sl_location: sl
......@@ -141,6 +142,6 @@ global:
html_project: '1002'
serverLxc:
ip: 192.168.1.130
ip: 106.2.3.134
username: root
password: 123456
\ No newline at end of file
password: 91isoft_xunda
\ No newline at end of file
spring:
profiles:
active: dev
\ No newline at end of file
active: prod
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment