Kaynağa Gözat

[home,script]官网更新, 添加SQL脚本

tomsun28 4 yıl önce
ebeveyn
işleme
71ee8e4731

+ 48 - 27
home/docs/start/docker-deploy.md

@@ -4,32 +4,53 @@ title: 通过Docker方式安装HertzBeat
 sidebar_label: Docker方式部署    
 ---
 
-### 🐕 开始使用
-
-- 如果您不想部署而是直接使用,我们提供SAAS监控云-[TanCloud探云](https://console.tancloud.cn),即刻[登陆注册](https://console.tancloud.cn)免费使用。  
-- 如果您是想将HertzBeat部署到内网环境搭建监控系统,请参考下面的部署文档进行操作。 
-
-### 🐵 依赖服务部署   
-
-> HertzBeat最少依赖于 关系型数据库[MYSQL8+](https://www.mysql.com/) 和 时序性数据库[TDengine2+](https://www.taosdata.com/getting-started)
-
-##### 安装MYSQL  
-1. docker安装MYSQl  
-`docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql`   
-2. 创建名称为hertzBeat的数据库  
-3. 执行位于项目仓库script目录下的数据库脚本 schema.sql    
-
-##### 安装TDengine   
-1. docker安装TDengine   
-`docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp --name tdengine tdengine/tdengine`     
-2. 创建名称为hertzBeat的数据库
-
-### 🍞 HertzBeat安装   
-> HertzBeat支持通过源码安装启动,Docker容器运行和安装包方式安装部署。  
-
-#### Docker方式快速安装
-`docker run -d -p 1157:1157 --name hertzbeat tancloud/hertzbeat:latest`  
-#### 通过安装包安装   
-todo  
+> 推荐使用docker部署HertzBeat  
+
+1. 下载安装Docker环境   
+   Docker 工具自身的下载请参考 [Docker官网文档](https://docs.docker.com/get-docker/)。
+   安装完毕后终端查看Docker版本是否正常输出。
+   ```
+   $ docker -v
+   Docker version 20.10.12, build e91ed57
+   ```
+
+2. 拉取HertzBeat Docker镜像   
+   ``` 
+   $ docker pull tancloud/hertzbeat:latest 
+   ```
+3. 配置HertzBeat的配置文件  
+   在主机目录下创建application.yml,eg:/opt/application.yml   
+   配置文件内容参考 项目仓库/script/application.yml,需要替换里面的MYSQL服务和TDengine服务参数,IP端口账户密码(若使用邮件告警,需替换里面的邮件服务器参数)
+   具体替换参数如下:
+   ``` 
+   spring.datasource.url
+   spring.datasource.username
+   spring.datasource.password
+   
+   warehouse.store.td-engine.url
+   warehouse.store.td-engine.username
+   warehouse.store.td-engine.password
+   
+   spring.mail.host
+   spring.mail.port
+   spring.mail.username
+   spring.mail.password
+   
+   ```
+
+5. 启动HertzBeat Docker容器  
+   ``` 
+   $ docker run -d -p 1157:1157 -v /opt/application.yml:/opt/hertz-beat/config/application.yml --name hertzbeat tancloud/hertzbeat:latest
+   526aa188da767ae94b244226a2b2eec2b5f17dd8eff592893d9ec0cd0f3a1ccd
+   ```
+   这条命令启动一个运行HertzBeat的Docker容器,并且将容器的1157端口映射到宿主机的1157端口上。若宿主机已有进程占用该端口,则需要修改主机映射端口。
+   - docker run -d : 通过Docker运行一个容器,使其在后台运行
+   - -p 1157:1157  : 映射容器端口到主机端口
+   - -v /opt/application.yml:/opt/hertz-beat/config/application.yml  : 挂载上一步修改的本地配置文件到容器中,即使用本地配置文件覆盖容器配置文件。我们需要修改此配置文件的MYSQL,TDengine配置信息来连接外部服务。
+   - --name hertzbeat : 命名容器名称 hertzbeat 
+   - tancloud/hertzbeat:latest : 使用拉取的HertzBeat官方发布的应用镜像来启动容器 
+   
+6. 开始探索HertzBeat  
+   浏览器访问 http://ip:1157 开始使用HertzBeat进行监控告警。
 
 **HAVE FUN**

+ 1 - 1
home/docs/start/mysql-init.md

@@ -25,6 +25,6 @@ MYSQL是一款值得信赖的关系型数据库,HertzBeat使用其存储监控
 ### SQL脚本执行   
 1. 进入MYSQL或使用客户端连接MYSQL服务
 2. 创建名称为hertzbeat的数据库
-3. 执行位于项目仓库script目录下的数据库建表初始化脚本 schema.sql
+3. 执行位于项目仓库/script/sql/目录下的数据库建表初始化脚本 schema.sql
 4. 查看hertzbeat数据库是否成功建表
 

+ 26 - 28
home/docs/start/package-deploy.md

@@ -3,33 +3,31 @@ id: package-deploy
 title: 通过安装包安装HertzBeat    
 sidebar_label: 安装包方式部署    
 ---
-
-### 🐕 开始使用
-
-- 如果您不想部署而是直接使用,我们提供SAAS监控云-[TanCloud探云](https://console.tancloud.cn),即刻[登陆注册](https://console.tancloud.cn)免费使用。  
-- 如果您是想将HertzBeat部署到内网环境搭建监控系统,请参考下面的部署文档进行操作。 
-
-### 🐵 依赖服务部署   
-
-> HertzBeat最少依赖于 关系型数据库[MYSQL8+](https://www.mysql.com/) 和 时序性数据库[TDengine2+](https://www.taosdata.com/getting-started)
-
-##### 安装MYSQL  
-1. docker安装MYSQl  
-`docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql`   
-2. 创建名称为hertzBeat的数据库  
-3. 执行位于项目仓库script目录下的数据库脚本 schema.sql    
-
-##### 安装TDengine   
-1. docker安装TDengine   
-`docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp --name tdengine tdengine/tdengine`     
-2. 创建名称为hertzBeat的数据库
-
-### 🍞 HertzBeat安装   
-> HertzBeat支持通过源码安装启动,Docker容器运行和安装包方式安装部署。  
-
-#### Docker方式快速安装
-`docker run -d -p 1157:1157 --name hertzbeat tancloud/hertzbeat:latest`  
-#### 通过安装包安装   
-todo  
+> HertzBeat支持在Linux Windows Mac系统安装运行,CPU支持X64/ARM64。由于安装包自身不包含JAVA运行环境,需您提前准备JAVA运行环境。
+
+1. 安装JAVA运行环境-可参考[官方网站](http://www.oracle.com/technetwork/java/javase/downloads/index.html)    
+   要求:JDK8+(已验证JDK8)   
+   下载JAVA安装包: [镜像站](https://repo.huaweicloud.com/java/jdk/)   
+   安装后命令行检查是否成功安装   
+   ```
+   $ java -version
+   openjdk version "1.8.0_312"
+   OpenJDK Runtime Environment (Zulu 8.58.0.13-CA-macos-aarch64) (build 1.8.0_312-b07)
+   OpenJDK 64-Bit Server VM (Zulu 8.58.0.13-CA-macos-aarch64) (build 25.312-b07, mixed mode)
+   ```
+2. 下载HertzBeat安装包
+   下载您系统环境对应的安装包
+   - 从[GITEE Release](https://gitee.com/usthe/hertzbeat/releases) 仓库下载
+   - 从[GITHUB Release](https://github.com/usthe/hertzbeat/releases) 仓库下载
+
+3. 部署启动
+   解压安装包到主机 eg: /opt/hertz-beat
+   ``` 
+   $ tar zxvf hertz-beat-1.0.tar.gz 
+   ```
+   执行位于安装目录/bin/下的启动脚本 startup.sh 
+   ``` 
+   $ ./startup.sh 
+   ```
 
 **HAVE FUN**

+ 1 - 1
home/docs/start/quickstart.md

@@ -17,7 +17,7 @@ sidebar_label: 快速开始
 1. docker安装MYSQl  
 `docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql`   
 2. 创建名称为hertzbeat的数据库  
-3. 执行位于项目仓库script目录下的数据库脚本 schema.sql    
+3. 执行位于项目仓库/script/sql/目录下的数据库脚本 schema.sql    
 
 详细步骤参考 [依赖服务MYSQL安装初始化](mysql-init.md)    
 

+ 14 - 10
home/docusaurus.config.js

@@ -148,12 +148,12 @@ module.exports = {
                     title: '产品介绍',
                     items: [
                         {
-                            label: 'Github',
-                            href: 'https://github.com/dromara/sureness',
+                            label: '使用介绍',
+                            to: 'docs/introduce',
                         },
                         {
-                            label: 'Gitee',
-                            href: 'https://gitee.com/dromara/sureness',
+                            label: '安装文档',
+                            to: 'docs/start/quickstart',
                         },
                         {
                             label: 'High Performance',
@@ -190,16 +190,20 @@ module.exports = {
                     title: '相关资源',
                     items: [
                         {
-                            label: 'Tom Blog',
-                            to: 'https://blog.usthe.com',
+                            label: 'Github仓库',
+                            href: 'https://github.com/usthe/hertzbeat',
                         },
                         {
-                            label: 'USTHE',
-                            href: 'https://github.com/usthe',
+                            label: 'Gitee仓库',
+                            href: 'https://gitee.com/usthe/hertzbeat',
                         },
                         {
-                            label: 'Tom',
-                            href: 'https://github.com/tomsun28',
+                            label: 'HertzBeat赫兹节拍',
+                            href: 'https://hertzbeat.com',
+                        },
+                        {
+                            label: 'TanCloud探云',
+                            href: 'https://tancloud.cn',
                         },
                     ],
                 },

+ 0 - 1
manager/pom.xml

@@ -107,7 +107,6 @@
                     <include>application.yml</include>
                     <include>sureness.yml</include>
                     <include>banner.txt</include>
-                    <include>db/**</include>
                     <include>define/**</include>
                 </includes>
             </resource>

+ 0 - 71
manager/src/main/resources/db/data.sql

@@ -1,71 +0,0 @@
-use usthe ;
--- ----------------------------
--- Records of auth_resource
--- ----------------------------
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (101, 'User get token', 'ACCOUNT_TOKEN', '/auth/token', 'account', 'POST', 9, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (102, 'User register', 'ACCOUNT_REGISTER', '/auth/register', 'account', 'POST', 9, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (103, 'Add resource', 'ADD_RESOURCE', '/resource', 'resource', 'POST', 1, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (104, 'Update resource', 'UPDATE_RESOURCE', '/resource', 'resource', 'PUT', 1, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (105, 'Delete resource', 'DELETE_RESOURCE', '/resource/*', 'resource', 'DELETE', 1, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (106, 'Get resource', 'GET_RESOURCES', '/resource/*/*', 'resource', 'GET', 1, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (107, 'Add role', 'ADD_ROLE', '/role', 'role', 'POST', 1, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (108, 'Update role', 'UPDATE_ROLE', '/role', 'role', 'PUT', 1, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (109, 'Delete role', 'DELETE_ROLE', '/role/*', 'role', 'DELETE', 1, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (110, 'Get role', 'GET_ROLES', '/role/*/*', 'role', 'GET', 1, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (111, 'User get custom token', 'ACCOUNT_CUSTOM_TOKEN', '/auth/custom/token', 'account', 'POST', 9, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (112, 'Static Resource', 'Static Resource', '/**/*.html', 'static', 'GET', 9, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (113, 'Static Resource', 'Static Resource', '/**/*.js', 'static', 'GET', 9, null);
-insert into auth_resource (id, name, code, uri, type, method, status, description) values (114, 'Static Resource', 'Static Resource', '/**/*.css', 'static', 'GET', 9, null);
-
--- ----------------------------
--- Records of auth_role
--- ----------------------------
-insert into auth_role (id, name, code, status, description) values (100, 'admin role', 'role_admin', 1, null);
-insert into auth_role (id, name, code, status, description) values (102, 'user role', 'role_user', 1, null);
-insert into auth_role (id, name, code, status, description) values (103, 'guest role', 'role_guest', 1, null);
-
--- ----------------------------
--- Records of auth_role_resource_bind
--- ----------------------------
--- role_admin has these resource
-insert into auth_role_resource_bind (id, role_id, resource_id) values (1, 100, 101);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (2, 100, 102);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (3, 100, 103);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (4, 100, 104);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (5, 100, 105);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (6, 100, 106);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (7, 100, 107);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (8, 100, 108);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (9, 100, 109);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (10, 100, 110);
-
--- role_user has "get,add,update" related resources, do not have "delete" related resources
-insert into auth_role_resource_bind (id, role_id, resource_id) values (11, 102, 103);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (12, 102, 104);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (13, 102, 106);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (14, 102, 107);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (15, 102, 108);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (16, 102, 110);
-
--- role_guest has "get" related resources
-insert into auth_role_resource_bind (id, role_id, resource_id) values (17, 103, 106);
-insert into auth_role_resource_bind (id, role_id, resource_id) values (18, 103, 110);
-
-
--- ----------------------------
--- Records of auth_user
--- ----------------------------
-insert into  auth_user (id, username, password, salt, avatar, phone, email, sex, status, create_where) values (111, 'admin', 'admin', null, null, null, null, null, 1, 1);
-insert into  auth_user (id, username, password, salt, avatar, phone, email, sex, status, create_where) values (112, 'user', 'user', null, null, null, null, null, 1, 1);
-insert into  auth_user (id, username, password, salt, avatar, phone, email, sex, status, create_where) values (113, 'guest', 'guest', null, null, null, null, null, 1, 1);
-insert into  auth_user (id, username, password, salt, avatar, phone, email, sex, status, create_where) values (114, 'noRole', 'noRole', null, null, null, null, null, 1, 1);
-
-
-
--- ----------------------------
--- Records of auth_user_role_bind
--- ----------------------------
-insert into  auth_user_role_bind (id, user_id, role_id) values (12, 111, 100);
-insert into  auth_user_role_bind (id, user_id, role_id) values (13, 111, 102);
-insert into  auth_user_role_bind (id, user_id, role_id) values (14, 112, 102);
-insert into  auth_user_role_bind (id, user_id, role_id) values (15, 113, 103);

+ 59 - 0
script/application.yml

@@ -0,0 +1,59 @@
+server:
+  port: 1157
+spring:
+  application:
+    name: ${HOSTNAME:@hertzbeat@}${PID}
+  profiles:
+    active: prod
+  mvc:
+    static-path-pattern: /console/**
+  resources:
+    static-locations:
+      - classpath:/dist/
+      - classpath:../dist/
+  jackson:
+    default-property-inclusion: NON_EMPTY
+
+sureness:
+  auths:
+    - digest
+    - basic
+    - jwt
+
+---
+spring:
+  config:
+    activate:
+      on-profile: prod
+  datasource:
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    username: admin
+    password: admin
+    url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
+    platform: mysql
+    hikari:
+      max-lifetime: 120000
+  jpa:
+    database: mysql
+
+  mail:
+    host: smtp.exmail.qq.com
+    username: example@qq.com
+    password: example
+    port: 465
+    default-encoding: UTF-8
+    properties:
+      mail:
+        smtp:
+          socketFactoryClass: javax.net.ssl.SSLSocketFactory
+          ssl:
+            enable: true
+
+warehouse:
+  store:
+    td-engine:
+      enabled: true
+      driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
+      url: jdbc:TAOS-RS://localhost:6041/hertzbeat
+      username: root
+      password: taosdata

+ 1 - 1
manager/src/main/resources/db/schema.sql → script/sql/schema.sql

@@ -12,7 +12,7 @@ CREATE TABLE  monitor
      app          varchar(100) not null comment '监控的类型:linux,mysql,jvm...',
      host         varchar(100) not null comment '监控的对端host:ipv4,ipv6,域名',
      intervals    int          not null default 600 comment '监控的采集间隔时间,单位秒',
-     status       tinyint      not null default 1 comment '监控状态 0:未监控,1:可用,2:不可用,3:不可达,4:挂起',
+     status       tinyint      not null default 1 comment '监控状态 0:未监控,1:可用,2:不可用,3:不可达',
      description  varchar(255) comment '描述备注信息',
      creator      varchar(100) comment '创建者',
      modifier     varchar(100) comment '最新修改者',

+ 8 - 0
web-app/README.md

@@ -7,4 +7,12 @@
 
 ## 编译打包  
 
+web-app目录下执行
+
 ```ng build --prod --base-href /console/```
+
+manager目录下执行
+
+```mvn package```
+
+生成的安装包在 manager/target/hertz-beta-1.0.tar.gz