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

apache

parent 23c5ec19
......@@ -171,7 +171,7 @@ public class BCodeLxcServiceImpl implements BCodeLxcService {
if(global.getJavaProject().equals(code))
return "java";
else if(global.getHtmlProject().equals(code))
return "html";
return "apache";
else
return "";
}
......
......@@ -17,6 +17,7 @@ import org.rcisoft.business.bstudent.entity.BStudentDto;
import org.rcisoft.common.component.Global;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.CommandResult;
import org.rcisoft.core.result.ResultExceptionEnum;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.service.RcRedisService;
import org.rcisoft.core.service.SerializationUtils;
......@@ -75,13 +76,13 @@ public class BCodeServiceImpl implements BCodeService {
return this.readSimpleFile(slId,chapId,CodeType.SIM_JAVA,userInfo,studentCode);
/*java 工程*/
if(examType.equals(global.getJavaProject()))
return this.readProjectFile(slId,chapId,userInfo,studentCode);
return this.readProjectFile(slId,chapId,userInfo,studentCode,global.getJavaProject());
/*html 单文件*/
if(examType.equals(global.getHtmlSimple()))
return this.readSimpleFile(slId,chapId,CodeType.SIM_HTML,userInfo,studentCode);
/*html 工程*/
if(examType.equals(global.getHtmlProject()))
return this.readProjectFile(slId,chapId,userInfo,studentCode);
return this.readProjectFile(slId,chapId,userInfo,studentCode,global.getHtmlProject());
return null;
}
......@@ -153,8 +154,16 @@ public class BCodeServiceImpl implements BCodeService {
+ global.getCOURSE_PROJECT_LOCATION() + File.separator
+ userInfo + File.separator
+ StudentCode;
/*工程 容器docker dir*/
String dirPath = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator
+ global.getCOURSE_LOCATION() + File.separator
+ global.getSL_LOCATION() + File.separator
+ slId + File.separator
+ chapterId +File.separator
+ global.getCOURSE_PROJECT_LOCATION() + File.separator
+ userInfo + File.separator;
lxc.setUserId(userInfo);
lxc.setWorkingDir(path);
lxc.setWorkingDir(dirPath);
lxc.setCode(examCode);
lxc.setSl(slId);
lxc.setChapterId(chapterId);
......
......@@ -51,7 +51,7 @@ public class StopLxcJob implements Job {
/*3.移除容器*/
rcRedisServiceImpl.remove(redisKeyId);
/*4.移除端口*/
rcRedisServiceImpl.setList("lxcKeys",
rcRedisServiceImpl.removeList("lxcKeys",
redisKeyId);
rcRedisServiceImpl.removeList("lxcPorts",containerPort + "");
}
......
......@@ -9,7 +9,6 @@ import org.rcisoft.core.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
* Created with CodeGenerator on .
......
package org.rcisoft.business.listener;
import lombok.extern.slf4j.Slf4j;
import org.quartz.*;
import org.rcisoft.business.bcode.task.ClearLxcJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.util.HashMap;
/**
* Created by lcy on 18/1/19.
*
*
*
* JobDetail job = JobBuilder.newJob(ClearLxcJob.class).
withIdentity(IDENTITY_LXC_GROUP, JOB_LXC_GROUP).
usingJobData(new JobDataMap(new HashMap())).build();
Trigger trigger = TriggerBuilder.newTrigger().forJob(job)
.usingJobData(new JobDataMap(new HashMap()))
.withIdentity(IDENTITY_LXC_GROUP)
.startNow().build();
// 触发器时间设定
Scheduler sched = schedulerFactoryBean.getScheduler();
try {
sched.scheduleJob(job, trigger);
// 启动
if (!sched.isShutdown()) {
sched.start();
}
}catch (Exception e){
log.error(e.getMessage());
}
*/
@Slf4j
public class RcListener implements ServletContextListener {
......@@ -39,24 +58,6 @@ public class RcListener implements ServletContextListener {
*/
@Override
public void contextInitialized(ServletContextEvent arg0) {
JobDetail job = JobBuilder.newJob(ClearLxcJob.class).
withIdentity(IDENTITY_LXC_GROUP, JOB_LXC_GROUP).
usingJobData(new JobDataMap(new HashMap())).build();
Trigger trigger = TriggerBuilder.newTrigger().forJob(job)
.usingJobData(new JobDataMap(new HashMap()))
.withIdentity(IDENTITY_LXC_GROUP)
.startNow().build();
// 触发器时间设定
Scheduler sched = schedulerFactoryBean.getScheduler();
/*触发器*/
try {
sched.scheduleJob(job, trigger);
// 启动
if (!sched.isShutdown()) {
sched.start();
}
}catch (Exception e){
log.error(e.getMessage());
}
}
}
......@@ -245,7 +245,7 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
* 监听器
* @return
*/
//@Bean
@Bean
public ServletListenerRegistrationBean servletListenerRegistrationBean(){
ServletListenerRegistrationBean servletListenerRegistrationBean = new ServletListenerRegistrationBean();
servletListenerRegistrationBean.setListener(new RcListener());
......
......@@ -74,7 +74,7 @@ lxc:
lxc_dockerfilePath: /eduLxc
lxc_initPort: 20001
lxc_maxPort: 30000
lxc_minu: 3
lxc_minu: 15
lxc_isRemote: 1
springfox:
documentation:
......
......@@ -54,22 +54,19 @@ spring:
resources:
add-mappings: false
redis:
host: 106.2.3.134
port: 7481
pool:
max-idle: 50
max-active: 1000
min-idle: 5
max-wait: -1
database: 0
password: ''
springfox:
documentation:
swagger:
v2:
path: /api-docs
host: 106.2.3.134
port: 7481
pool:
max-idle: 50
max-active: 1000
min-idle: 5
max-wait: -1
database: 0
password: ''
freemarker:
charset: UTF-8
suffix: .ftl
template-loader-path: classpath:/templates/
lxc:
lxc_prefix: lessonLxc
......@@ -79,6 +76,12 @@ lxc:
lxc_maxPort: 30000
lxc_minu: 30
lxc_isRemote: 1
springfox:
documentation:
swagger:
v2:
path: /api-docs
jwt:
header: Authorization
secret: mySecret
......@@ -138,6 +141,6 @@ global:
html_project: '1002'
serverLxc:
ip: 127.0.0.1
ip: 192.168.1.130
username: root
password: 123456
password: 123456
\ No newline at end of file
version: '2'
services:
java:
apache:
image: httpd:2.4
container_name: 'apache_${lxcName}'
restart: always
......
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