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

apache

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