request = new HttpEntity<>(JSON.toJSONString(jobRunRequestInfo));
+ String res =
+ HttpUtil.buildRestTemplate(HttpUtil.TIME_OUT_1_M).postForEntity(url, request, String.class).getBody();
+ JobRunInfo info = JSON.parseObject(res, JobRunInfo.class);
+ if (info == null) {
+ throw new BizException("run jar 失败");
+ }
+ return info.getJobId();
+ }
+
@Override
public JobStandaloneInfo getJobInfoForStandaloneByAppId(String appId, DeployModeEnum deployModeEnum) {
if (StringUtils.isEmpty(appId)) {
diff --git a/flink-streaming-web/src/main/java/com/flink/streaming/web/rpc/model/JobRunInfo.java b/flink-streaming-web/src/main/java/com/flink/streaming/web/rpc/model/JobRunInfo.java
new file mode 100644
index 00000000..db3de860
--- /dev/null
+++ b/flink-streaming-web/src/main/java/com/flink/streaming/web/rpc/model/JobRunInfo.java
@@ -0,0 +1,25 @@
+package com.flink.streaming.web.rpc.model;
+
+/**
+ * @author earthchen
+ * @date 2021/6/24
+ **/
+public class JobRunInfo {
+
+ private String jobId;
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ @Override
+ public String toString() {
+ return "JobRunInfo{" +
+ "jobId='" + jobId + '\'' +
+ '}';
+ }
+}
diff --git a/flink-streaming-web/src/main/java/com/flink/streaming/web/rpc/model/UploadJarInfo.java b/flink-streaming-web/src/main/java/com/flink/streaming/web/rpc/model/UploadJarInfo.java
new file mode 100644
index 00000000..bcb22e61
--- /dev/null
+++ b/flink-streaming-web/src/main/java/com/flink/streaming/web/rpc/model/UploadJarInfo.java
@@ -0,0 +1,46 @@
+package com.flink.streaming.web.rpc.model;
+
+/**
+ * @author earthchen
+ * @date 2021/6/24
+ **/
+public class UploadJarInfo {
+
+ private String filename;
+
+ private String status;
+
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ return "UploadJarInfo{" +
+ "filename='" + filename + '\'' +
+ ", status='" + status + '\'' +
+ '}';
+ }
+
+ public String getJarId() {
+ String[] ans = filename.split("/");
+ if (ans.length == 0) {
+ return null;
+ }
+ return ans[ans.length - 1];
+ }
+
+
+}
diff --git a/flink-streaming-web/src/main/java/com/flink/streaming/web/service/impl/SystemConfigServiceImpl.java b/flink-streaming-web/src/main/java/com/flink/streaming/web/service/impl/SystemConfigServiceImpl.java
index 21be4123..186f575f 100644
--- a/flink-streaming-web/src/main/java/com/flink/streaming/web/service/impl/SystemConfigServiceImpl.java
+++ b/flink-streaming-web/src/main/java/com/flink/streaming/web/service/impl/SystemConfigServiceImpl.java
@@ -98,6 +98,7 @@ public String getFlinkHttpAddress(DeployModeEnum deployModeEnum) {
return urlLocal.trim();
}
throw new BizException("网络异常 url=" + urlLocal);
+ case REST:
case STANDALONE:
String urlHA = this.getSystemConfigByKey(SysConfigEnum.FLINK_REST_HA_HTTP_ADDRESS.getKey());
if (StringUtils.isEmpty(urlHA)) {
diff --git a/flink-streaming-web/src/main/resources/application-prod.properties b/flink-streaming-web/src/main/resources/application-prod.properties
index 90cb5280..bcc69627 100644
--- a/flink-streaming-web/src/main/resources/application-prod.properties
+++ b/flink-streaming-web/src/main/resources/application-prod.properties
@@ -1,6 +1,5 @@
-spring.profiles.active=prod
-logging.config= classpath:logging/logback-${spring.profiles.active}.xml
+#logging.config=classpath:logging/logback-prod.xml
-spring.devtools.livereload.enabled= false
+spring.devtools.livereload.enabled=false
diff --git a/flink-streaming-web/src/main/resources/application.properties b/flink-streaming-web/src/main/resources/application.properties
index 8f7bf1fd..8de02995 100644
--- a/flink-streaming-web/src/main/resources/application.properties
+++ b/flink-streaming-web/src/main/resources/application.properties
@@ -1,6 +1,6 @@
-server.port=8080
+server.port=8082
spring.profiles.active=dev
-logging.config= classpath:logging/logback-${spring.profiles.active}.xml
+#logging.config=classpath:logging/logback-${spring.profiles.active}.xml
spring.devtools.livereload.enabled= true
@@ -19,9 +19,9 @@ mybatis.mapper-locations=classpath:mapper/*.xml
####jdbc连接池
-spring.datasource.url=jdbc:mysql://localhost:3306/flink_web?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false
-spring.datasource.username=root
-spring.datasource.password=root
+spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:flink_web}?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=${MYSQL_SSL:false}
+spring.datasource.username=${MYSQL_USERNAME:root}
+spring.datasource.password=${MYSQL_PASSWORD:123456}
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.druid.initial-size=5
@@ -48,7 +48,7 @@ spring.datasource.druid.stat-view-servlet.login-password=123456
#日志
-log.file.root= ../logs/
+log.file.root= ${LOG_HOME:../logs/}
log.file.maxHistory= 20
log.file.maxSize= 200MB
diff --git a/flink-streaming-web/src/main/resources/templates/screen/job_config/addPage.ftl b/flink-streaming-web/src/main/resources/templates/screen/job_config/addPage.ftl
index 7b55f222..3f97116a 100644
--- a/flink-streaming-web/src/main/resources/templates/screen/job_config/addPage.ftl
+++ b/flink-streaming-web/src/main/resources/templates/screen/job_config/addPage.ftl
@@ -89,6 +89,7 @@
+
diff --git a/flink-streaming-web/src/main/resources/templates/screen/job_config/editPage.ftl b/flink-streaming-web/src/main/resources/templates/screen/job_config/editPage.ftl
index 3759f096..ad757f0f 100644
--- a/flink-streaming-web/src/main/resources/templates/screen/job_config/editPage.ftl
+++ b/flink-streaming-web/src/main/resources/templates/screen/job_config/editPage.ftl
@@ -108,6 +108,7 @@
+
diff --git a/http/flink-rest-client.http b/http/flink-rest-client.http
new file mode 100644
index 00000000..608b27dc
--- /dev/null
+++ b/http/flink-rest-client.http
@@ -0,0 +1,28 @@
+### 上传 jar
+#curl -X POST -H "Expect:" -F "jarfile=@/Users/earthchen/study/flink/flink-streaming-platform-web/lib/flink-streaming-core.jar" http://127.0.0.1:8081/jars/upload
+POST http://localhost:8081/jars/upload
+Content-Type: multipart/form-data; boundary=WebAppBoundary
+
+--WebAppBoundary
+Content-Disposition: name="jarfile";
+
+< /Users/earthchen/study/flink/flink-streaming-platform-web/lib/flink-streaming-core.jar
+--WebAppBoundary--
+
+
+
+### 运行 job
+POST http://localhost:8081/jars/f3b73878-7764-401e-8992-e6507b6569d2_flink-streaming-core.jar/run
+Content-Type: application/json
+
+{
+ "entryClass": "com.flink.streaming.core.JobApplication",
+ "programArgs": "--sql /Users/earthchen/code-tool/flink/upload/sql/test.sql --type 0"
+}
+
+### 查询 jars
+GET http://localhost:8081/jars
+
+
+# command =/Users/earthchen/code-tool/flink/flink-1.12.4/bin/flink run -d -c com.flink.streaming.core.JobApplication /Users/earthchen/study/flink/flink-streaming-platform-web/lib/flink-streaming-core.jar -sql /Users/earthchen/study/flink/flink-streaming-platform-web/sql/job_sql_1.sql -type 0
+