Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/zhitom/zkweb
Browse files Browse the repository at this point in the history
  • Loading branch information
zhitom committed May 30, 2019
2 parents 1d8fd59 + 0278689 commit d1a4184
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 69 deletions.
146 changes: 77 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,77 @@
## zkWeb-en

zkWeb is zookeeper web to manager and monitor zookeeper cluster with builtin H2 database.This is based on TaoBao God(yasenagat)'s zkWeb code,and have a big upgrade and modification,It can run as two methods:

1. put <war-file> to tomcat and execute it!
2. java -jar <jar-file> to execute it!

### old zkWeb code address

yasenagat-zkweb svn: [http://code.taobao.org/svn/zkweb/](http://code.taobao.org/svn/zkweb/ "yasenagat-zkweb")

### Major Modification

- Upgrade depend jars include spring\zookeeper ...
- Upgrade easyui to EasyUI for jQuery 1.5.5.4、jQuery v1.12.4
- Optimize page layout,such as: multi-tabs switch,one zk to one tab;add filter within cfg pages.
- Support High version of Tomcat,and tested ok with tomcat 8
- Add zookeeper cluster's state-monitor function,and use four-word cmd to get state infomation
- Add zookeeper loop-check connect state
- Front-end web add i18n Internationalization plugin,Support english and zh_CN,and server-end data don't added this.
- Upgrade to use spring boot 2
- Add favicon.ico
- jsp -> Thymeleaf

## zkWeb-zh_CN
zookeeper web管理和监控界面,使用内置的H2数据库,此版本基于淘宝大神yasenagat的zkWeb源码基础之上进行了大幅升级和修改,有两种运行方式:

1. 直接将war包放入tomcat即可运行!
2. 直接运行: java -jar <jar-file>

### 旧zkWeb源码地址

yasenagat-zkweb svn: [http://code.taobao.org/svn/zkweb/](http://code.taobao.org/svn/zkweb/ "yasenagat-zkweb")

### 重大修改点

- 升级依赖的第三方库,包括spring、zookeeper等
- 升级easyui到EasyUI for jQuery 1.5.5.4、jQuery v1.12.4
- 优化页面布局,如:支持多TAB切换,一个zk连接一个TAB标签;在配置界面增加过滤器;
- 支持tomcat高版本,目前在tomcat8测试通过
- 增加zk集群状态的监控功能,使用了四字命令获取监控信息
- 增加zk集群自动检测连接状态功能
- 前端web增加i18n国际化插件,支持界面英文展示,注:服务端数据未支持国际化。
- 使用spring boot 2升级改造,可以不依赖tomcat
- 增加了浏览器图标favicon.ico
- jsp -> Thymeleaf

### screen snapshot

connected: [https://user-images.githubusercontent.com/2204457/41921088-a39f7856-7994-11e8-8620-90cd81dc33ce.png](https://user-images.githubusercontent.com/2204457/41921088-a39f7856-7994-11e8-8620-90cd81dc33ce.png "connected")

disconnected: [https://user-images.githubusercontent.com/2204457/41921099-a9d53620-7994-11e8-868c-1da341334184.png](https://user-images.githubusercontent.com/2204457/41921099-a9d53620-7994-11e8-868c-1da341334184.png "disconnected")

## spring boot修改备注

- 打jar包,webapp/resources无法访问,需修改代码addResourceHandlers:
- `registry.addResourceHandler("/resources/**").addResourceLocations("classpath:/resources/",
"classpath:/META-INF/resources/webapp/resources/");`

- 打war包,webapp/resources被默认打包到根目录下导致无法访问,需要打包到WEB-INF/classes/resources

- 改造为使用Thymeleaf模版后,目前已经将webapp目录移除了
- pom-jar.xml for jar,pom-tomcat.xml for tomcat

## TODO

- docker实现
- 使用curator代替原生zk

## zkWeb-en

zkWeb is zookeeper web to manager and monitor zookeeper cluster with builtin H2 database.This is based on TaoBao God(yasenagat)'s zkWeb code,and have a big upgrade and modification,It can run as two methods:

1. put <war-file> to tomcat and execute it!
2. java -jar <jar-file> to execute it!

### old zkWeb code address

yasenagat-zkweb svn: [http://code.taobao.org/svn/zkweb/](http://code.taobao.org/svn/zkweb/ "yasenagat-zkweb")

### Major Modification

- Upgrade depend jars include spring\zookeeper ...
- Upgrade easyui to EasyUI for jQuery 1.5.5.4、jQuery v1.12.4
- Optimize page layout,such as: multi-tabs switch,one zk to one tab;add filter within cfg pages.
- Support High version of Tomcat,and tested ok with tomcat 8
- Add zookeeper cluster's state-monitor function,and use four-word cmd to get state infomation
- Add zookeeper loop-check connect state
- Front-end web add i18n Internationalization plugin,Support english and zh_CN,and server-end data don't added this.
- Upgrade to use spring boot 2
- Add favicon.ico
- jsp -> Thymeleaf

## zkWeb-zh_CN
zookeeper web管理和监控界面,使用内置的H2数据库,此版本基于淘宝大神yasenagat的zkWeb源码基础之上进行了大幅升级和修改,有两种运行方式:

1. 直接将war包放入tomcat即可运行!
2. 直接运行: java -jar <jar-file>

### 旧zkWeb源码地址

yasenagat-zkweb svn: [http://code.taobao.org/svn/zkweb/](http://code.taobao.org/svn/zkweb/ "yasenagat-zkweb")

### 重大修改点

- 升级依赖的第三方库,包括spring、zookeeper等
- 升级easyui到EasyUI for jQuery 1.5.5.4、jQuery v1.12.4
- 优化页面布局,如:支持多TAB切换,一个zk连接一个TAB标签;在配置界面增加过滤器;
- 支持tomcat高版本,目前在tomcat8测试通过
- 增加zk集群状态的监控功能,使用了四字命令获取监控信息
- 增加zk集群自动检测连接状态功能
- 前端web增加i18n国际化插件,支持界面英文展示,注:服务端数据未支持国际化。
- 使用spring boot 2升级改造,可以不依赖tomcat
- 增加了浏览器图标favicon.ico
- jsp -> Thymeleaf

### screen snapshot

connected: [https://user-images.githubusercontent.com/2204457/41921088-a39f7856-7994-11e8-8620-90cd81dc33ce.png](https://user-images.githubusercontent.com/2204457/41921088-a39f7856-7994-11e8-8620-90cd81dc33ce.png "connected")

disconnected: [https://user-images.githubusercontent.com/2204457/41921099-a9d53620-7994-11e8-868c-1da341334184.png](https://user-images.githubusercontent.com/2204457/41921099-a9d53620-7994-11e8-868c-1da341334184.png "disconnected")

## spring boot修改备注

- 打jar包,webapp/resources无法访问,需修改代码addResourceHandlers:
- `registry.addResourceHandler("/resources/**").addResourceLocations("classpath:/resources/",
"classpath:/META-INF/resources/webapp/resources/");`

- 打war包,webapp/resources被默认打包到根目录下导致无法访问,需要打包到WEB-INF/classes/resources

- 改造为使用Thymeleaf模版后,目前已经将webapp目录移除了
- pom-jar.xml for jar,pom-tomcat.xml for tomcat

## docker一键启动命令
```
docker run -p 8099:8099 --name zkweb -d peterpoker/zkweb:v1.2.1
```


## docker 打包
参考src下的Dockerfile文件中的使用说明
## TODO


- 使用curator代替原生zk

23 changes: 23 additions & 0 deletions pom-jar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,29 @@
<!-- </configuration> -->
<!-- </plugin> -->
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<!--打包Dockerfile-->
<resource>
<!-- 设定主资源目录 -->
<directory>${basedir}/src/main/docker</directory>

<!-- maven default生命周期,process-resources阶段执行maven-resources-plugin插件的resources目标处理主资源目下的资源文件时,只处理如下配置中包含的资源类型 -->
<includes>
<include>*</include>
</includes>

<!-- maven default生命周期,process-resources阶段执行maven-resources-plugin插件的resources目标处理主资源目下的资源文件时,指定处理后的资源文件输出目录,默认是${build.outputDirectory}指定的目录 -->
<targetPath>${project.build.directory}</targetPath>

<!-- maven default生命周期,process-resources阶段执行maven-resources-plugin插件的resources目标处理主资源目下的资源文件时,是否对主资源目录开启资源过滤 -->
<filtering>true</filtering>

</resource>
</resources>
</build>
<dependencies>
<!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starters</artifactId>
Expand Down
39 changes: 39 additions & 0 deletions src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#############################################################################
# zkweb
#
# 容器构建镜像
# 1. 使用命令将dockerfile和maven打包好的jar包放在target目录下:
# $ mvn clean package -f pom-jar.xml
#
# 2. 在target目录下运行命令构建镜像:
# $ docker build -t zkweb:v1.2.1 .
#
# 容器启动
# 1. 命令: docker run -p 8099:8099 --name zkweb -d zkweb:v1.2.1
#
#
#############################################################################


# java镜像
FROM daocloud.io/java:8

# 将本地文件夹挂载到当前容器
# 创建/tmp目录并持久化到Docker数据文件夹,因为Spring Boot使用的内嵌Tomcat容器默认使用/tmp作为工作目录。
VOLUME ["/tmp"]

# 解决容器时间和宿主主机时间不一致问题
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone


# 拷贝文件到容器
COPY zkWeb-v1.2.1.jar /opt/app.jar

# 打开服务端口
EXPOSE 8099 8099

# 配置环境变量 todo jvm优化参数可以设置这里
ENV JAVA_OPTS='-Xmx4096m -Xms4096m ' APP_OPTS=''

# 配置容器启动后执行的命令
ENTRYPOINT java $JAVA_OPTS -server -Dfile.encoding=UTF-8 -Duser.language=zh -Duser.region=CN -Djava.security.egd=file:/dev/./urandom -jar /opt/app.jar $APP_OPTS

0 comments on commit d1a4184

Please sign in to comment.