Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web UI #69

Merged
merged 6 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.settings/
.project
.classpath
target/
node_modules/
# Created by .ignore support plugin (hsz.mobi)
### Java template
# Compiled class file
Expand Down Expand Up @@ -140,4 +145,4 @@ Icon
Network Trash Folder
Temporary Items
.apdisk
./logs
./logs
33 changes: 13 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ https://xie.infoq.cn/article/1af0cb75be056fea788e6c86b
**主要功能**:包含任务配置、启/停任务、告警、日志等功能,支持sql语法提示,格式化、sql语句校验。

**目的**:减少开发、降低成本 完全实现sql化 流计算任务。 😂

由于前端UI是本人自己写的,不够专业,样式有点丑 请多多包含!!!


该项目获得 [Flink Forward Asia Hackathon (2021) 季军 ](https://mp.weixin.qq.com/s/J2OkX_D34ktfwSfhwdmXYQ)


### 1、主要功能

Expand Down Expand Up @@ -213,19 +215,12 @@ https://nightlies.apache.org/flink/flink-docs-release-1.13/zh/docs/connectors/ta
## 七、RoadMap


1、 支持除官方以外的连接器 如:阿里云的sls
1、支持多版本flink

2、 任务告警自动拉起 (完成)
2、 完善文档 (持续过程)

3、 支持Application模式
3、UI

4、 完善文档 (持续过程)

5、 支持sql预校验,编写sql的时候语法提示等友好的用户体验(完成)

6、 checkpoint支持rocksDB (完成)

7、 支持jar模式提交任务 (完成)



Expand All @@ -244,20 +239,18 @@ https://nightlies.apache.org/flink/flink-docs-release-1.13/zh/docs/connectors/ta
http://img.ccblog.cn/flink/dd2.png


微信二维码 http://img.ccblog.cn/flink/wx2.png


[微信二维码](http://img.ccblog.cn/flink/wx2.png)




## 十、使用情况


[2021-03-18 和 2021-03-19 两天 做的调研 ](/docs/img2.md)

## 十一、 捐赠

## 十一、 鸣谢
感谢文香炯(湖南草花互动科技股份公司)贡献前端代码 :https://gitee.com/wenxiangjiong/flink-streaming-platform-web.git


## 十二、 捐赠

[点击打开支付宝捐赠](http://img.ccblog.cn/jz/zfb.jpg)

Expand Down
1 change: 0 additions & 1 deletion deployer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>com.streaming.platform.web</groupId>
<artifactId>deployer</artifactId>
<version>${flink_streaming_version}</version>

Expand Down
1 change: 1 addition & 0 deletions deployer/src/main/assembly/dev.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<outputDirectory>lib</outputDirectory>
<scope>runtime</scope>
<excludes>
<exclude>io.*:*</exclude>
<exclude>org.*:*</exclude>
<exclude>net.*:*</exclude>
<exclude>ch.*:*</exclude>
Expand Down
62 changes: 25 additions & 37 deletions deployer/src/main/bin/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/usr/bin/env bash

#! /bin/bash

#具体执行哪个步骤
ACTION=$1

echo "开始执行脚本 启动参数 $1"

source /etc/profile
##source /etc/profile
set -e

# Find the java binary
Expand All @@ -21,7 +20,9 @@ else
fi
fi


curr_path=`pwd`
shell_path=$(cd $(dirname $0); pwd)
cd ${shell_path}
echo "JAVA_HOME= ${JAVA_HOME}"

##变量设置##
Expand All @@ -39,51 +40,38 @@ start(){
echo $pid
if [ -z $pid ]
then

echo "开始启动进程执行命令 java $JAVA_OPTS -jar $project --spring.profiles.active=$env --spring.config.additional-location=../conf/application.properties "

java $JAVA_OPTS -jar $project --spring.profiles.active=$env --spring.config.additional-location=../conf/application.properties >/dev/null 2>&1 &
sleep 20
echo "开始启动进程执行命令 java $JAVA_OPTS -jar $project --spring.profiles.active=$env --spring.config.additional-location=../conf/application.properties "
java $JAVA_OPTS -jar $project --spring.profiles.active=$env --spring.config.additional-location=../conf/application.properties >/dev/null 2>&1 &
sleep 5
pid=$(ps x | grep $project | grep -v grep | awk '{print $1}')

if [ -z $pid ]
then
echo "启动应用进程失败 请手动执行一下 java -jar $project --spring.profiles.active=$env --spring.config.additional-location=../conf/application.properties "
echo "启动应用进程失败 请手动执行一下 java -jar $project --spring.profiles.active=$env --spring.config.additional-location=../conf/application.properties "
else
echo "启动成功 pid=" $pid
fi

echo "可通过命令 tail -fn 300 ../logs/info.log 查看web日志"

else
echo " $project 进程已经存 pid=" $pid
fi


}

stop()
{
pid=$(ps x | grep $project | grep -v grep | awk '{print $1}')
echo "进程 $pid"

echo "------>Check pid of $project"

if [ -z "$pid" ]
then
echo "------>APP_NAME process [$project] is already stopped"
else
for pid in ${pid[*]}
do
echo "------>Kill process which pid=$pid"
/bin/kill $pid
done
sleep 30

fi



pid=$(ps x | grep $project | grep -v grep | awk '{print $1}')
echo "进程 $pid"
echo "------>Check pid of $project"
if [ -z "$pid" ]
then
echo "------>APP_NAME process [$project] is already stopped"
else
for pid in ${pid[*]}
do
echo "------>Kill process which pid=$pid"
/bin/kill $pid
done
sleep 5
fi
}

restart()
Expand All @@ -93,16 +81,16 @@ restart()
}

case "$ACTION" in

restart)
cp $project $project$time
restart
;;
start)
start
;;

stop)
stop
;;
esac
cd ${curr_path}

2 changes: 1 addition & 1 deletion deployer/src/main/bin/docker-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ACTION=$1

##变量设置##
env=docker
project="/data/projects/flink-streaming-platform-web/lib/flink-streaming-web-1.3.0.RELEASE.jar"
project="/data/projects/flink-streaming-platform-web/lib/flink-streaming-web-1.4.0.RELEASE.jar"


##JAVA_OPTS设置
Expand Down
15 changes: 15 additions & 0 deletions deployer/src/main/conf/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# 如果公司内部使用了nacos 可以将有些配置放到nacos 如果没有请不要填写相关配置
#nacos.core.auth.enabled=true
#nacos.config.bootstrap.enable=true
#nacos.config.server-addr=172.16.167.37:8848
#nacos.config.group=DEFAULT_GROUP
#nacos.config.data-id=flink-web.properties
#nacos.config.namespace=dev
#nacos.config.username=nacos
#nacos.config.password=nacos
#nacos.config.type=properties
#nacos.config.max-retry=10
#nacos.config.auto-refresh=true
#nacos.config.config-retry-time=2333
#nacos.config.config-long-poll-timeout=46000

####jdbc信息
server.port=9084
spring.datasource.url=jdbc:mysql://localhost:3306/flink_web?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false
Expand Down
6 changes: 3 additions & 3 deletions docs/idea-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

6、将 flink-streaming-core/target/flink-streaming-core.jar 移动到 刚创建的lib 中

7、将 flink-streaming-core.jar 改名为 flink-streaming-core-1.3.0.RELEASE.jar
7、将 flink-streaming-core.jar 改名为 flink-streaming-core-1.4.0.RELEASE.jar

8、flink-streaming-web 模块是REST服务模块,运行启动类是:com.flink.streaming.web.StartApplication

Expand All @@ -38,9 +38,9 @@

2、command 类似于,下面这个命令是 平台生成的 使用 yarn 提交 批任务

/Users/gump/dreamware/flink-1.13.1/bin/flink run -yjm 1024m -ytm 1024m -p 1 -yqu default -ynm flink@my_batch_job -yd -m yarn-cluster -c com.flink.streaming.core.JobApplication /Users/gump/study/source/github/flink-streaming-platform-web/lib/flink-streaming-core-1.3.0.RELEASE.jar -sql /Users/gump/study/source/github/flink-streaming-platform-web/sql/job_sql_3.sql -type 2
/Users/gump/dreamware/flink-1.13.1/bin/flink run -yjm 1024m -ytm 1024m -p 1 -yqu default -ynm flink@my_batch_job -yd -m yarn-cluster -c com.flink.streaming.core.JobApplication /Users/gump/study/source/github/flink-streaming-platform-web/lib/flink-streaming-core-1.4.0.RELEASE.jar -sql /Users/gump/study/source/github/flink-streaming-platform-web/sql/job_sql_3.sql -type 2

3、大家可以去分析这个命令,其实就是要知道 Flink 的客户端在哪个目录 ,提交的jar 就是导入到lib下的 flink-streaming-core-1.3.0.RELEASE.jar
3、大家可以去分析这个命令,其实就是要知道 Flink 的客户端在哪个目录 ,提交的jar 就是导入到lib下的 flink-streaming-core-1.4.0.RELEASE.jar

4、yarn 的url 貌似只是 日志那里有使用

Expand Down
27 changes: 6 additions & 21 deletions docs/img.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,9 @@



![图片](http://img.ccblog.cn/flink/0.png)
![图片](http://img.ccblog.cn/flink/1-1.png)
![图片](http://img.ccblog.cn/flink/1.png)
![图片](http://img.ccblog.cn/flink/2.png)
![图片](http://img.ccblog.cn/flink/3-1.png)
![图片](http://img.ccblog.cn/flink/3.png)
![图片](http://img.ccblog.cn/flink/4.png)
![图片](http://img.ccblog.cn/flink/5.png)
![图片](http://img.ccblog.cn/flink/6.png)
![图片](http://img.ccblog.cn/flink/7.png)
![图片](http://img.ccblog.cn/flink/9.png)
![图片](http://img.ccblog.cn/flink/10.png)
![图片](http://img.ccblog.cn/flink/12.png)
![图片](http://img.ccblog.cn/flink/13.png)
![图片](http://img.ccblog.cn/flink/1-0.png)
![图片](http://img.ccblog.cn/flink/1-2.png)
![图片](http://img.ccblog.cn/flink/1-3.png)
![图片](http://img.ccblog.cn/flink/1-4.png)
![图片](http://img.ccblog.cn/flink/1-5.png)
![图片](http://img.ccblog.cn/flink/1-6.png)
![图片](http://img.ccblog.cn/flink/1-7.png)
![图片](img_preview/1.png)
![图片](img_preview/2.png)
![图片](img_preview/6.png)
![图片](img_preview/3.png)
![图片](img_preview/4.png)
![图片](img_preview/5.png)
Binary file added docs/img_preview/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img_preview/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img_preview/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img_preview/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img_preview/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img_preview/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
5. flink-streaming-valication: sql校验模块

6. flink-streaming-web: web平台模块
1. 任务管理
1.
2. 用户管理
3. 日志管理
4. 系统配置等.
Expand Down
12 changes: 12 additions & 0 deletions docs/sql/2022-1-升级ui所需sql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- 老版本升级需要的sql
ALTER TABLE job_config ADD COLUMN job_desc VARCHAR(255) NULL COMMENT '任务描述' AFTER job_name;
ALTER TABLE job_config_history ADD COLUMN job_desc VARCHAR(255) NULL COMMENT '任务描述' AFTER job_name;
ALTER TABLE job_config_history add `job_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '任务类型 0:sql 1:自定义jar' AFTER version ;
ALTER TABLE job_run_log ADD COLUMN job_desc VARCHAR(255) NULL COMMENT '任务描述' AFTER job_name;
ALTER TABLE user ADD COLUMN `name` VARCHAR(100) NOT NULL COMMENT '用户姓名' AFTER `username`;
ALTER TABLE `user` ADD COLUMN `status` tinyint(1) NOT NULL COMMENT '1:启用 0: 停用' AFTER stauts; -- 修正status字段命名,兼容处理,只增加字段
ALTER TABLE `user` modify COLUMN `stauts` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1:启用 0: 停用';
ALTER TABLE `user` modify COLUMN `username` varchar(100) COLLATE utf8mb4_bin NOT NULL COMMENT '用户帐号';
update user set name='系统管理员' where id=1;
update user set status=1 where id=1;
update job_config_history a, job_config b set a.job_type=b.job_type where a.job_config_id=b.id;
25 changes: 18 additions & 7 deletions docs/sql/flink_web.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

CREATE DATABASE `flink_web` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
USE flink_web;
-- ----------------------------
-- Table structure for alart_log
-- ----------------------------
Expand Down Expand Up @@ -72,7 +74,7 @@ ALTER TABLE job_config add `job_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '
ALTER TABLE job_config add `custom_args` varchar(128) DEFAULT NULL COMMENT '启动jar可能需要使用的自定义参数' AFTER job_type;
ALTER TABLE job_config add `custom_main_class` varchar(128) DEFAULT NULL COMMENT '程序入口类' AFTER custom_args;
ALTER TABLE job_config add `custom_jar_url` varchar(128) DEFAULT NULL COMMENT'自定义jar的http地址 如:http://ccblog.cn/xx.jar' AFTER custom_main_class;

ALTER TABLE job_config ADD COLUMN job_desc VARCHAR(255) NULL COMMENT '任务描述' AFTER job_name;

-- ----------------------------
-- Table structure for job_config_history
Expand All @@ -95,8 +97,8 @@ CREATE TABLE `job_config_history` (
PRIMARY KEY (`id`),
KEY `index_job_config_id` (`job_config_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='flink任务配置历史变更表';


ALTER TABLE job_config_history ADD COLUMN job_desc VARCHAR(255) NULL COMMENT '任务描述' AFTER job_name;
ALTER TABLE job_config_history add `job_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '任务类型 0:sql 1:自定义jar' AFTER version ;

-- ----------------------------
-- Table structure for job_run_log
Expand All @@ -122,7 +124,7 @@ CREATE TABLE `job_run_log` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='运行任务日志';

ALTER TABLE job_run_log add `run_ip` varchar(64) DEFAULT NULL COMMENT '任务运行所在的机器' AFTER local_log ;

ALTER TABLE job_run_log ADD COLUMN job_desc VARCHAR(255) NULL COMMENT '任务描述' AFTER job_name;

-- ----------------------------
-- Table structure for savepoint_backup
Expand Down Expand Up @@ -169,7 +171,7 @@ CREATE TABLE `system_config` (
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '用户名',
`username` varchar(100) COLLATE utf8mb4_bin NOT NULL COMMENT '用户帐号',
`password` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '密码',
`stauts` tinyint(1) NOT NULL COMMENT '1:启用 0: 停用',
`is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1:删除 0: 未删除',
Expand All @@ -180,7 +182,9 @@ CREATE TABLE `user` (
PRIMARY KEY (`id`),
UNIQUE KEY `index_uk` (`username`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

ALTER TABLE user ADD COLUMN `name` VARCHAR(100) NOT NULL COMMENT '用户姓名' AFTER `username`;
ALTER TABLE `user` ADD COLUMN `status` tinyint(1) NOT NULL COMMENT '1:启用 0: 停用' AFTER stauts; -- 修正status字段命名,兼容处理,只增加字段
ALTER TABLE `user` modify COLUMN `stauts` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1:启用 0: 停用';


CREATE TABLE `job_alarm_config`
Expand All @@ -203,7 +207,14 @@ CREATE TABLE `job_alarm_config`
-- Records of user 默认密码是 123456
-- ----------------------------
BEGIN;
INSERT INTO `user` VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, 0, '2020-07-10 22:15:04', '2020-07-24 22:21:35', 'sys', 'sys');
INSERT INTO `user` VALUES (1, 'admin', '系统管理员', 'e10adc3949ba59abbe56e057f20f883e', 1, 0, '2020-07-10 22:15:04', '2020-07-24 22:21:35', 'sys', 'sys');
COMMIT;


--------------





SET FOREIGN_KEY_CHECKS = 1;
Loading