Compare commits
7 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
da658e6975 | |
|
|
5e51154a96 | |
|
|
aed8748754 | |
|
|
a716047e94 | |
|
|
9ea48133db | |
|
|
973aa77771 | |
|
|
99b8b4f8df |
|
|
@ -3,6 +3,7 @@
|
|||
*.class
|
||||
./.idea/
|
||||
.idea/
|
||||
target/
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
|
@ -25,3 +26,4 @@
|
|||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ public class K8sService {
|
|||
if (StringUtils.isNotEmpty(nodeSelectMapKey)) {
|
||||
nodeSelectMap.put(nodeSelectMapKey, "true");
|
||||
} else {
|
||||
nodeSelectMap.put("type", "others");// 普通实训
|
||||
nodeSelectMap.put("braincloud", "others");// 普通实训
|
||||
}
|
||||
if (createImage != null && createImage) {
|
||||
nodeSelectMap.put("forevernode", "true");// 永久节点
|
||||
|
|
@ -698,6 +698,7 @@ public class K8sService {
|
|||
|
||||
logger.info("开始创建 service {}, nodePort: {}", name, nodePort);
|
||||
// 定义service的labels
|
||||
name = name.replace("_", "-");
|
||||
Map<String, String> labels = new HashMap<>();
|
||||
labels.put("name", name);
|
||||
labels.put("tpiID", tpiID);
|
||||
|
|
|
|||
|
|
@ -173,6 +173,10 @@ public class AppConfig {
|
|||
@Value("${workspace.nfs.configs}")
|
||||
private String workspaceNFSConfigs;
|
||||
|
||||
|
||||
@Value("${fixed.service.port:39876}")
|
||||
private String fixedServicePort;
|
||||
|
||||
public Integer getSophgoDelayTime() {
|
||||
return sophgoDelayTime;
|
||||
}
|
||||
|
|
@ -433,4 +437,8 @@ public class AppConfig {
|
|||
public String getWorkspaceNFSConfigs() {
|
||||
return workspaceNFSConfigs;
|
||||
}
|
||||
|
||||
public String getFixedServicePort() {
|
||||
return fixedServicePort;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,14 +26,14 @@ registry=BRI_DOCKER_REGISTRY
|
|||
|
||||
|
||||
#GIT_IP
|
||||
gitIP=118.31.13.117
|
||||
gitBackUpIP=118.31.13.117
|
||||
gitIP=121.41.90.210
|
||||
gitBackUpIP=121.41.90.210
|
||||
gitPort=64300
|
||||
gitBackupDirs=/opt/repositories/2018,/opt/repositories/2018-2
|
||||
gitRepoDir=/data/repositories
|
||||
#git\u7528\u6237\u540d\u53ca\u5bc6\u7801
|
||||
gitUsername=wangwei10061
|
||||
gitPassword=wang199637
|
||||
gitPassword=zq123456
|
||||
|
||||
workspace=/data/workspace
|
||||
secretWorkspace=/opt/workspace/secret
|
||||
|
|
@ -134,7 +134,8 @@ aliyun.flex.ruleAri=ari:acs:ess:cn-hangzhou:1829848226361863:scalingrule/asr-bp1
|
|||
secretKey=priEn3UwXfJs3PmyXnSG
|
||||
|
||||
#vscode?????? ???? codeserver1.vnc.educoder.net
|
||||
vscodeDomain=testcodeserver1.vnc.educoder.net
|
||||
#vscodeDomain=testcodeserver1.vnc.educoder.net
|
||||
vscodeDomain=analysis-kyxt.pcl.ac.cn
|
||||
|
||||
|
||||
spring.config.import=classpath:cron.properties
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"groups": [
|
||||
{
|
||||
"name": "mystarter.config.student",
|
||||
"type": "com.imitate.common.test.PersonConfigProperties",
|
||||
"sourceType": "com.imitate.common.test.PersonConfigProperties"
|
||||
}
|
||||
],
|
||||
"properties": [
|
||||
{
|
||||
"name": "mystarter.config.student.age",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "com.imitate.common.test.PersonConfigProperties"
|
||||
},
|
||||
{
|
||||
"name": "mystarter.config.student.gender",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "com.imitate.common.test.PersonConfigProperties"
|
||||
},
|
||||
{
|
||||
"name": "mystarter.config.student.name",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "com.imitate.common.test.PersonConfigProperties"
|
||||
}
|
||||
],
|
||||
"hints": []
|
||||
}
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
mystarter.config.enable=true
|
||||
mystarter.config.student.name=yc
|
||||
mystarter.config.student.age=18
|
||||
mystarter.config.student.gender=man
|
||||
|
||||
|
||||
|
||||
|
||||
useMq=true
|
||||
netNames=en0
|
||||
#web\u56de\u8c03\u5730\u5740
|
||||
educoderURL=https://www.educoder.net/api/myshixuns/training_task_status.json
|
||||
simpileEducoderURL=https://www.educoder.net/api/myshixuns/code_runinng_message.json
|
||||
ojEvaCallBackURL=https://www.educoder.net/api/myproblems/:tpiid/listen_result.json
|
||||
|
||||
#git\u670d\u52a1\u5668\u57df\u540d\uff0c\u8fdc\u7a0b\u96c6\u7fa4\u9700\u8981\u4f7f\u7528\u8fd9\u4e2a\u57df\u540d\u6765\u4e0b\u8f7d
|
||||
gitServiceDomain=https://git.educoder.net
|
||||
|
||||
#\u6d4b\u8bd5\u7248dockerURL(\u4e3b\u8282\u70b9)
|
||||
dockerMaster=http://172.16.94.148:4243
|
||||
#\u6d4b\u8bd5\u7248dockerURL(\u526f\u8282\u70b9)
|
||||
dockerDeputies=http://172.16.94.167:4243;http://172.16.94.169:4243;http://172.16.94.172:4243
|
||||
|
||||
#\u955c\u50cf\u4ed3\u5e93\u5730\u5740
|
||||
registry=BRI_DOCKER_REGISTRY
|
||||
|
||||
|
||||
#GIT_IP
|
||||
gitIP=172.16.94.154
|
||||
gitBackUpIP=172.16.94.154
|
||||
gitPort=30122
|
||||
gitBackupDirs=/opt/repositories/2018,/opt/repositories/2018-2
|
||||
gitRepoDir=/opt/repositories
|
||||
#git\u7528\u6237\u540d\u53ca\u5bc6\u7801
|
||||
gitUsername=edugit
|
||||
gitPassword=xinedugit#
|
||||
|
||||
workspace=/opt/workspace
|
||||
secretWorkspace=/opt/workspace/secret
|
||||
datadir=/opt/shixunfiles
|
||||
bigDataDir=/opt/bigfiles
|
||||
|
||||
|
||||
|
||||
#GPU \u955c\u50cf
|
||||
gpuImage=nvidia
|
||||
gpuBigImage=gpu-big
|
||||
#shenlong \u955c\u50cf\u7279\u6027
|
||||
shenlong.image.character=shenlong
|
||||
|
||||
#novnc port
|
||||
vncPort=6901
|
||||
|
||||
#jupyter \u76f8\u5173\u914d\u7f6e
|
||||
jupyterPort=80
|
||||
jupyterSurvivalMinute=60
|
||||
jupyterDelayMinute=20
|
||||
tpmJupyterDelayMinute=120
|
||||
tpmJupyterSurvivalMinute=120
|
||||
|
||||
webssh.delayMinute=21
|
||||
|
||||
eva.MaxPoolSize=800
|
||||
eva.HttpMaxConnTotal=800
|
||||
eva.HttpMaxConnPerRoute=200
|
||||
git.HttpMaxConnTotal=400
|
||||
git.HttpMaxConnPerRoute=400
|
||||
k8s.MaxConcurrentRequests=640
|
||||
k8s.MaxConcurrentRequestsPerHost=50
|
||||
|
||||
windows.forwardTableId=ftb-2zepf6ofbt3qitk1jevs0
|
||||
windows.externalIp=39.105.62.120
|
||||
windows.username=administrator
|
||||
windows.password=Edu_123123
|
||||
windows.workspace=C:/Windows/AppReadiness/
|
||||
windows.initTime=3600
|
||||
windows.delayTime=3600
|
||||
linux.username=root
|
||||
|
||||
|
||||
testCaseDir=/opt/bigfiles/filecase
|
||||
testCaseActualOutDir=/opt/workspace/filecase
|
||||
|
||||
|
||||
|
||||
|
||||
#limit of running pod number
|
||||
maxRunningPodNum=20000
|
||||
#\u6d4b\u8bd5\u7248\u8d44\u6e90\u603b\u91cf
|
||||
cpuAllocatable=4000
|
||||
memAllocatable=10000
|
||||
|
||||
|
||||
# defaultTimeLimit of executing time in a pod.
|
||||
defaultTimeLimit=90
|
||||
# delay delete time
|
||||
evaluate.pod.pass.delayDeleteTime=0
|
||||
evaluate.pod.default.delayDeleteTime=60
|
||||
#\u7f16\u8bd1\u7ed3\u679c\u6700\u5927\u957f\u5ea6
|
||||
outputSize=65535
|
||||
|
||||
|
||||
|
||||
|
||||
# sophgo
|
||||
sophgo.apiKey=touge@126.com
|
||||
sophgo.apiSecret=y2odnlm44zsbmd0j1aznzzqrev5w76cj
|
||||
# sophgo API address
|
||||
sophgo.api.domain=http://175.102.182.50:19028
|
||||
# sophgo sub ???????? url ????
|
||||
sophgo.api.notifyUrl=http://pre-bridge.educoder.net/bridge/sophgo/notify
|
||||
sophgo.delayTime=3600
|
||||
|
||||
# nfs?
|
||||
workspace.nfs.configs=/opt/workspace,/opt/workspace2
|
||||
bridge.errorOutPuts=\u7edf\u7e41\u5fd9\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5\n\
|
||||
\u7a0b\u5e8f\u6267\u884c\u5931\u8d25\u5bfc\u81f4\u8bc4\u6d4b\u63d0\u524d\u7ec8\u6b62\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5\u6216\u8054\u7cfb\u7cfb\u7edf\u7ba1\u7406\u5458\n\
|
||||
\u6b21\u8bc4\u6d4b\u7f51\u7edc\u5ef6\u8fdf\u8f83\u9ad8\uff0c\u8d44\u6e90\u65e0\u6cd5\u6b63\u5e38\u52a0\u8f7d\uff0c\u8bf7\u0031\u0030\u0073\u540e\u91cd\u8bd5\n\
|
||||
\u5f53\u524d\u5b9e\u9a8c\u73af\u5883\u6b63\u5728\u66f4\u65b0\u4e2d\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5\u6216\u8054\u7cfb\u7cfb\u7edf\u7ba1\u7406\u5458\uff01\n\
|
||||
\u5f53\u524d\u7f51\u7edc\u8f83\u5dee\uff0c\u4ee3\u7801\u4e0b\u8f7d\u8d85\u65f6\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5\uff01\n\
|
||||
\u8bc4\u6d4b\u811a\u672c\u8bbe\u7f6e\u5f02\u5e38\uff0c\u5efa\u8bae\u60a8\u5728\u5b9e\u8bad\u7684\u914d\u7f6e\u9875\u9762\u91cd\u65b0\u9009\u62e9\u6216\u4fee\u6539\u8bc4\u6d4b\u811a\u672c
|
||||
|
||||
# ???????
|
||||
dingding.bridge.evaluation.token=1069c45d4dfab187bb95599faeaf3687b630f79eda0d6fff914a18ee9e25db6f
|
||||
dingding.bridge.evaluation.secret=SEC7431097248ee9c19b9d7a2c61883e29082bea79c88c3e8f02e5fa121c2837dbc
|
||||
|
||||
# ?????client??
|
||||
aliyun.flex.accessKeyId=LTAI5tG6z2pg3yQ42RQZLUKc
|
||||
aliyun.flex.accessKeySecret=EzNHWle4HDZERwnc5syBPV86PZLmow
|
||||
# ????id
|
||||
aliyun.flex.ruleAri=ari:acs:ess:cn-hangzhou:1829848226361863:scalingrule/asr-bp1cozzmradkyct0cntj
|
||||
|
||||
#\u8ba4\u8bc1\u5bc6\u94a5
|
||||
secretKey=priEn3UwXfJs3PmyXnSG
|
||||
|
||||
#vscode?????? ???? codeserver1.vnc.educoder.net
|
||||
vscodeDomain=testcodeserver1.vnc.educoder.net
|
||||
|
||||
|
||||
spring.config.import=classpath:cron.properties
|
||||
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ public class VscodeController extends BasicController {
|
|||
private static final String C_IMAGE_NAME = "W3siaW1hZ2UiOiJnY2MtY29kZXNlcnZlci13dzp2MS4wIiwiY3B1TGltaXQiOjIuMCwiY3B1UmVxdWVzdCI6MC4zLCJtZW1vcnlMaW1pdCI6IjIwNDhNIiwibWVtb3J5UmVxdWVzdCI6IjEwMjRNIiwicmVzb3VyY2VMaW1pdCI6IjEwMDAwSyIsInN0YXJ0VGltZSI6MjAwLCJ0eXBlIjoibWFpbiJ9XQo=";
|
||||
private static final String JAVA_IMAGE_NAME = "W3siaW1hZ2UiOiJ2c2NvZGUtd3c6djEuMCIsImNwdUxpbWl0IjoyLjAsImNwdVJlcXVlc3QiOjAuMywibWVtb3J5TGltaXQiOiIyMDQ4TSIsIm1lbW9yeVJlcXVlc3QiOiIxMDI0TSIsInJlc291cmNlTGltaXQiOiIxMDAwMEsiLCJzdGFydFRpbWUiOjIwMCwidHlwZSI6Im1haW4ifV0K";
|
||||
private static final String PYTHON_IMAGE_NAME = "W3siaW1hZ2UiOiJweXRob24zZDctY29kZXNlcnZlcjp2MS4wIiwiY3B1TGltaXQiOjIuMCwiY3B1UmVxdWVzdCI6MC4zLCJtZW1vcnlMaW1pdCI6IjIwNDhNIiwibWVtb3J5UmVxdWVzdCI6IjEwMjRNIiwicmVzb3VyY2VMaW1pdCI6IjEwMDAwSyIsInN0YXJ0VGltZSI6MjAwLCJ0eXBlIjoibWFpbiJ9XQo=";
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private VscodeService vscodeService;
|
||||
|
|
@ -90,6 +90,8 @@ public class VscodeController extends BasicController {
|
|||
return actionResultWithBindingResult(ErrorCodeEnum.BIND_EXCEPTION,bindingResult);
|
||||
}
|
||||
vsCodeParam.setTpiID(StringUtil.getPodName(vsCodeParam.getProjectId(),vsCodeParam.getUserId()).toLowerCase(Locale.ROOT));
|
||||
vsCodeParam.setTpiID(vsCodeParam.getTpiID().replace("_", "-"));
|
||||
vsCodeParam.setSurvivalSecond(3600 * 10);
|
||||
logger.info("[start]获取vscode连接信息 {}", JSONObject.toJSONString(vsCodeParam));
|
||||
JSONObject resp = new JSONObject();
|
||||
|
||||
|
|
@ -162,10 +164,8 @@ public class VscodeController extends BasicController {
|
|||
Map<String, Object> respData = new HashMap<>(2);
|
||||
respData.put("url", targetUrl);
|
||||
|
||||
String podName = TpUtils.buildWebPodName(vsCodeParam.getTpiID(), vsCodeParam.getPodType());
|
||||
RunPod runPod = runPodService.getRunPodByName(podName);
|
||||
//存活秒数
|
||||
respData.put("remainingTime",runPodService.getRemainingTime(runPod));
|
||||
respData.put("remainingTime", 3600 * 10);
|
||||
return R.ok().setData(respData);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* vscode
|
||||
|
|
@ -67,13 +69,40 @@ public class VscodeService {
|
|||
|
||||
}
|
||||
|
||||
private void getServicePort(final String cluster, String tpiID, Integer podType, Integer port, String svcPort) {
|
||||
String podName = TpUtils.buildVscodePodName(tpiID, podType);
|
||||
String serviceName = podName + "-" + port;
|
||||
|
||||
// 查询
|
||||
io.fabric8.kubernetes.api.model.Service service = k8sService.getService(cluster, serviceName);
|
||||
// 查询不到创建
|
||||
if (service != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 固定一个端口
|
||||
k8sService.createService(cluster, serviceName, podName, tpiID, port, Integer.parseInt(svcPort));
|
||||
if (port == 8080) {
|
||||
runPodService.updateRunPodSshPort(podName, svcPort);
|
||||
}
|
||||
}
|
||||
|
||||
public String getVscode(String cluster, String tpiID, Integer podType, String containers, String bigDataFile, Integer survivalSecond, Boolean createImage, Integer needPortMapping) throws InterruptedException {
|
||||
// 判断是否已经存在vscode,删除其他的vscode保证只留一个
|
||||
List<Pod> podList = k8sService.getPodList(TpCsts.LOCAL_CLUSTER, "type", "vscode");
|
||||
String podName = TpUtils.buildVscodePodName(tpiID, podType).replace("_", "-");
|
||||
for (Pod pod : podList) {
|
||||
String name = pod.getMetadata().getName();
|
||||
if(!podName.equals(name)){
|
||||
k8sService.deletePodSync(TpCsts.LOCAL_CLUSTER, name);
|
||||
}
|
||||
}
|
||||
// 获取pod vscode的工作目录 /data/workspace 重做镜像 默认command
|
||||
Pod pod = getVscodePracticePod(cluster,tpiID, podType, containers, bigDataFile, survivalSecond, createImage);
|
||||
|
||||
// 获取vscode service
|
||||
String vscodePort = getServicePort(cluster, tpiID, podType, 8080);
|
||||
String targetUrl = "https://" + vscodePort + appConfig.getVscodeDomain() + "?folder=" + appConfig.getWorkspace() + "/" + TpCsts.TP_UNIFY_REPO_NAME;
|
||||
getServicePort(cluster, tpiID, podType, 8080 , appConfig.getFixedServicePort());
|
||||
String targetUrl = "https://" + appConfig.getVscodeDomain() + "?folder=" + appConfig.getWorkspace() + "/" + TpCsts.TP_UNIFY_REPO_NAME;
|
||||
|
||||
//等待5秒让容器的codeserver启动
|
||||
Thread.sleep(5000);
|
||||
|
|
@ -92,7 +121,7 @@ public class VscodeService {
|
|||
*/
|
||||
private Pod getVscodePracticePod(String cluster, String tpiID, Integer podType, String containers, String bigDataFile, Integer survivalSecond, Boolean createImage) {
|
||||
// 如果存在pod,重置pod过期时间
|
||||
String podName = TpUtils.buildVscodePodName(tpiID, podType);
|
||||
String podName = TpUtils.buildVscodePodName(tpiID, podType).replace("_", "-");
|
||||
int delaySecond = (createImage && survivalSecond != null) ? survivalSecond : sysConfigService.getVscodePodDelaSecond();
|
||||
runPodService.deleteRunPodAfterTime(podName, delaySecond);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ spring.config.import=classpath:common.properties
|
|||
|
||||
# mysql
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://rm-bp13v5020p7828r5rso.mysql.rds.aliyuncs.com:3306/braincloud?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false
|
||||
spring.datasource.url=jdbc:mysql://rm-bp13v5020p7828r5r.mysql.rds.aliyuncs.com:3306/braincloud?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false
|
||||
spring.datasource.username=testeducoder
|
||||
spring.datasource.password=TEST@123
|
||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
server.port=8088
|
||||
server.servlet.context-path=/
|
||||
server.max-http-header-size=8192
|
||||
server.compression.enabled=true
|
||||
server.compression.min-response-size=1024
|
||||
server.compression.mime-types=text/plain,text/css,text/xml,text/javascript,application/json,application/javascript,application/xml,application/xml+rss,application/x-javascript,application/x-httpd-php,image/jpeg,image/gif,image/png
|
||||
server.tomcat.uri-encoding=UTF-8
|
||||
|
||||
|
||||
|
||||
spring.config.import=classpath:common.properties
|
||||
|
||||
|
||||
|
||||
# mysql
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://rm-bp13v5020p7828r5rso.mysql.rds.aliyuncs.com:3306/imitate_sys?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false
|
||||
spring.datasource.username=testeducoder
|
||||
spring.datasource.password=TEST@123
|
||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
spring.datasource.initialSize=200
|
||||
spring.datasource.maxActive=400
|
||||
spring.datasource.minIdle=200
|
||||
spring.datasource.validationQuery=select 1
|
||||
spring.datasource.testOnBorrow=false
|
||||
spring.datasource.testOnReturn=false
|
||||
spring.datasource.testWhileIdle=true
|
||||
mybatis.type-aliases-package=com.imitate.web.persistence.beans
|
||||
mybatis.mapperLocations=classpath*:mybatis/*.xml
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|
||||
#mapper
|
||||
mapper.mappers=com.imitate.common.util.BaseMapper
|
||||
mapper.not-empty=false
|
||||
mapper.identity=MYSQL
|
||||
|
||||
|
||||
# pagehelper
|
||||
pagehelper.helper-dialect=mysql
|
||||
pagehelper.reasonable=true
|
||||
pagehelper.support-methods-arguments=true
|
||||
pagehelper.params=count=countSql
|
||||
|
||||
|
||||
#showSql
|
||||
logging.level.com.imitate.web.persistence.mapper=debug
|
||||
|
||||
|
||||
# redis
|
||||
spring.redis.host=127.0.0.1
|
||||
spring.redis.port=6379
|
||||
spring.redis.password=
|
||||
spring.redis.lettuce.pool.max-active=8
|
||||
spring.redis.lettuce.pool.max-idle=8
|
||||
spring.redis.lettuce.pool.max-wait=-1ms
|
||||
spring.redis.lettuce.pool.min-idle=0
|
||||
spring.redis.lettuce.shutdown-timeout=100ms
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue