diff --git a/home/versioned_docs/version-v1.0.0/start/quickstart.md b/home/versioned_docs/version-v1.0.0/start/quickstart.md index 4596ae8590..7f5e68cfec 100644 --- a/home/versioned_docs/version-v1.0.0/start/quickstart.md +++ b/home/versioned_docs/version-v1.0.0/start/quickstart.md @@ -17,7 +17,7 @@ sidebar_label: 快速开始 ##### 安装MYSQL 1. docker安装MYSQl -`docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7` +`docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:8.0` 2. 创建名称为hertzbeat的数据库 3. 执行位于项目仓库/script/sql/目录下的数据库脚本 [schema.sql](https://gitee.com/dromara/hertzbeat/raw/master/script/sql/schema.sql) diff --git a/script/docker-compose/README.md b/script/docker-compose/README.md index d6b89714cc..25fac646c9 100644 --- a/script/docker-compose/README.md +++ b/script/docker-compose/README.md @@ -23,7 +23,7 @@ 2. 进入部署脚本 docker-compose 目录, 执行 - `docker-compose up -d` + `docker compose up -d` 3. 进入tdengine创建hertzbeat数据库 diff --git a/script/docker-compose/hertzbeat-mysql-iotdb/conf/application.yml b/script/docker-compose/hertzbeat-mysql-iotdb/conf/application.yml new file mode 100644 index 0000000000..2b98280625 --- /dev/null +++ b/script/docker-compose/hertzbeat-mysql-iotdb/conf/application.yml @@ -0,0 +1,94 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +server: + port: 1157 +spring: + application: + name: ${HOSTNAME:@hertzbeat@}${PID} + profiles: + active: prod + mvc: + static-path-pattern: /** + jackson: + default-property-inclusion: ALWAYS + web: + resources: + static-locations: + - classpath:/dist/ + - classpath:../dist/ + thymeleaf: + prefix: classpath:/templates/ + check-template-location: true + cache: true + suffix: .html + mode: HTML + +sureness: + auths: + - digest + - basic + - jwt + jwt: + secret: 'CyaFv0bwq2Eik0jdrKUtsA6bx3sDJeFV643R + LnfKefTjsIfJLBa2YkhEqEGtcHDTNe4CU6+9 + 8tVt4bisXQ13rbN0oxhUZR73M6EByXIO+SV5 + dKhaX0csgOCTlCxq20yhmUea6H6JIpSE2Rwp' + +--- +spring: + config: + activate: + on-profile: prod + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + username: root + password: 123456 + url: jdbc:mysql://mysql:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=false + platform: mysql + hikari: + max-lifetime: 120000 + jpa: + database: mysql + database-platform: org.hibernate.dialect.MySQL8Dialect + hibernate: + ddl-auto: update + # Not Require, Please config if you need email notify + # 非必填:不使用邮箱作为警告通知可以去掉spring.mail配置 + mail: + # Attention: this is mail server address. + # 请注意此为邮件服务器地址:qq邮箱为 smtp.qq.com qq企业邮箱为 smtp.exmail.qq.com + host: smtp.qq.com + username: example@qq.com + # Attention: this is not email account password, this requires an email authorization code + # 请注意此非邮箱账户密码 此需填写邮箱授权码 + password: xxqzvuqbnqvbbdac + port: 465 + default-encoding: UTF-8 + properties: + mail: + smtp: + socketFactoryClass: javax.net.ssl.SSLSocketFactory + ssl: + enable: true + +warehouse: + store: + iot-db: + enabled: true + host: iotdb + rpc-port: 6667 + username: root + password: root diff --git a/script/docker-compose/conf/sql/schema.sql b/script/docker-compose/hertzbeat-mysql-iotdb/conf/sql/schema.sql similarity index 100% rename from script/docker-compose/conf/sql/schema.sql rename to script/docker-compose/hertzbeat-mysql-iotdb/conf/sql/schema.sql diff --git a/script/docker-compose/conf/sureness.yml b/script/docker-compose/hertzbeat-mysql-iotdb/conf/sureness.yml similarity index 100% rename from script/docker-compose/conf/sureness.yml rename to script/docker-compose/hertzbeat-mysql-iotdb/conf/sureness.yml diff --git a/script/docker-compose/dbdata/mysqldata/.gitignore b/script/docker-compose/hertzbeat-mysql-iotdb/dbdata/mysqldata/.gitignore similarity index 100% rename from script/docker-compose/dbdata/mysqldata/.gitignore rename to script/docker-compose/hertzbeat-mysql-iotdb/dbdata/mysqldata/.gitignore diff --git a/script/docker-compose/dbdata/taosdata/.gitignore b/script/docker-compose/hertzbeat-mysql-iotdb/dbdata/taosdata/.gitignore similarity index 100% rename from script/docker-compose/dbdata/taosdata/.gitignore rename to script/docker-compose/hertzbeat-mysql-iotdb/dbdata/taosdata/.gitignore diff --git a/script/docker-compose/hertzbeat-mysql-iotdb/docker-compose.yaml b/script/docker-compose/hertzbeat-mysql-iotdb/docker-compose.yaml new file mode 100644 index 0000000000..145f775e1d --- /dev/null +++ b/script/docker-compose/hertzbeat-mysql-iotdb/docker-compose.yaml @@ -0,0 +1,68 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: "3.7" + +networks: + heartzbeat: + driver: bridge + +services: + mysql: + image: mysql:8 + container_name: mysql + hostname: mysql + restart: always + ports: + - "3306:3306" + environment: + TZ: Asia/Shanghai + MYSQL_ROOT_PASSWORD: 123456 + volumes: + - ./dbdata/mysqldata:/var/lib/mysql/ + - ./conf/sql:/docker-entrypoint-initdb.d/ + networks: + - heartzbeat + + iotdb: + image: apache/iotdb:0.13.3-node + container_name: iotdb + hostname: iotdb + restart: always + environment: + TZ: Asia/Shanghai + ports: + - "8181:8181" + - "6667:6667" + volumes: + - ./dbdata/taosdata:/iotdb/data + networks: + - heartzbeat + + hertzbeat: + image: tancloud/hertzbeat + container_name: hertzbeat + hostname: hertzbeat + restart: always + environment: + TZ: Asia/Shanghai + LANG: zh_CN.UTF-8 + volumes: + - ./conf/application.yml:/opt/hertzbeat/config/application.yml + - ./conf/sureness.yml:/opt/hertzbeat/config/sureness.yml + ports: + - "1157:1157" + networks: + - heartzbeat \ No newline at end of file diff --git a/script/docker-compose/conf/application.yml b/script/docker-compose/hertzbeat-mysql-tdengine/conf/application.yml similarity index 95% rename from script/docker-compose/conf/application.yml rename to script/docker-compose/hertzbeat-mysql-tdengine/conf/application.yml index 86add53eda..7213b21b7f 100644 --- a/script/docker-compose/conf/application.yml +++ b/script/docker-compose/hertzbeat-mysql-tdengine/conf/application.yml @@ -56,12 +56,13 @@ spring: driver-class-name: com.mysql.cj.jdbc.Driver username: root password: 123456 - url: jdbc:mysql://mysql:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false + url: jdbc:mysql://mysql:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=false platform: mysql hikari: max-lifetime: 120000 jpa: database: mysql + database-platform: org.hibernate.dialect.MySQL8Dialect hibernate: ddl-auto: update # Not Require, Please config if you need email notify diff --git a/script/docker-compose/hertzbeat-mysql-tdengine/conf/sql/schema.sql b/script/docker-compose/hertzbeat-mysql-tdengine/conf/sql/schema.sql new file mode 100644 index 0000000000..559d4f6cbb --- /dev/null +++ b/script/docker-compose/hertzbeat-mysql-tdengine/conf/sql/schema.sql @@ -0,0 +1,21 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you under the Apache License, Version 2.0 (the +-- "License"); you may not use this file except in compliance +-- with the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. + +-- this file works for MySQL. + +set names utf8mb4; +create database if not exists hertzbeat default charset utf8mb4 collate utf8mb4_general_ci; +commit; \ No newline at end of file diff --git a/script/docker-compose/hertzbeat-mysql-tdengine/conf/sureness.yml b/script/docker-compose/hertzbeat-mysql-tdengine/conf/sureness.yml new file mode 100644 index 0000000000..58da2b6939 --- /dev/null +++ b/script/docker-compose/hertzbeat-mysql-tdengine/conf/sureness.yml @@ -0,0 +1,104 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +## -- sureness.yml文本数据源 -- ## + +# 加载到匹配字典的资源,也就是需要被保护的,设置了所支持角色访问的资源 +# 没有配置的资源也默认被认证保护,但不鉴权 +# eg: /api/v1/source1===get===[admin] 表示 /api/v2/host===post 这条资源支持 admin 这一种角色访问 +# eg: /api/v1/source2===get===[] 表示 /api/v1/source2===get 这条资源不支持任何角色访问 +resourceRole: + - /api/account/auth/refresh===post===[admin,user,guest] + - /api/apps/**===get===[admin,user,guest] + - /api/monitor/**===get===[admin,user,guest] + - /api/monitor/**===post===[admin,user] + - /api/monitor/**===put===[admin,user] + - /api/monitor/**===delete==[admin] + - /api/monitors/**===get===[admin,user,guest] + - /api/monitors/**===post===[admin,user] + - /api/monitors/**===put===[admin,user] + - /api/monitors/**===delete===[admin] + - /api/alert/**===get===[admin,user,guest] + - /api/alert/**===post===[admin,user] + - /api/alert/**===put===[admin,user] + - /api/alert/**===delete===[admin] + - /api/alerts/**===get===[admin,user,guest] + - /api/alerts/**===post===[admin,user] + - /api/alerts/**===put===[admin,user] + - /api/alerts/**===delete===[admin] + - /api/notice/**===get===[admin,user,guest] + - /api/notice/**===post===[admin,user] + - /api/notice/**===put===[admin,user] + - /api/notice/**===delete===[admin] + - /api/tag/**===get===[admin,user,guest] + - /api/tag/**===post===[admin,user] + - /api/tag/**===put===[admin,user] + - /api/tag/**===delete===[admin] + - /api/summary/**===get===[admin,user,guest] + - /api/summary/**===post===[admin,user] + - /api/summary/**===put===[admin,user] + - /api/summary/**===delete===[admin] + +# 需要被过滤保护的资源,不认证鉴权直接访问 +# /api/v1/source3===get 表示 /api/v1/source3===get 可以被任何人访问 无需登录认证鉴权 +excludedResource: + - /api/account/auth/**===* + - /api/i18n/**===get + - /api/apps/hierarchy===get + # web ui 前端静态资源 + - /===get + - /dashboard/**===get + - /monitors/**===get + - /alert/**===get + - /account/**===get + - /setting/**===get + - /passport/**===get + - /**/*.html===get + - /**/*.js===get + - /**/*.css===get + - /**/*.ico===get + - /**/*.ttf===get + - /**/*.png===get + - /**/*.gif===get + - /**/*.jpg===get + - /**/*.svg===get + - /**/*.json===get + # swagger ui 资源 + - /swagger-resources/**===get + - /v2/api-docs===get + - /v3/api-docs===get + +# 用户账户信息 +# 下面有 admin tom lili 三个账户 +# eg: admin 拥有[admin,user]角色,密码为hertzbeat +# eg: tom 拥有[user],密码为hertzbeat +# eg: lili 拥有[guest],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289 +account: + - appId: admin + credential: hertzbeat + role: [admin,user] + - appId: tom + credential: hertzbeat + role: [user] + - appId: guest + credential: hertzbeat + role: [guest] + - appId: lili + # 注意 Digest认证不支持加盐加密的密码账户 + # 加盐加密的密码,通过 MD5(password+salt)计算 + # 此账户的原始密码为 lili + credential: 1A676730B0C7F54654B0E09184448289 + salt: 123 + role: [guest] diff --git a/script/docker-compose/hertzbeat-mysql-tdengine/dbdata/mysqldata/.gitignore b/script/docker-compose/hertzbeat-mysql-tdengine/dbdata/mysqldata/.gitignore new file mode 100644 index 0000000000..c1aefd2012 --- /dev/null +++ b/script/docker-compose/hertzbeat-mysql-tdengine/dbdata/mysqldata/.gitignore @@ -0,0 +1,2 @@ +.gitignore +!.gitignore diff --git a/script/docker-compose/hertzbeat-mysql-tdengine/dbdata/taosdata/.gitignore b/script/docker-compose/hertzbeat-mysql-tdengine/dbdata/taosdata/.gitignore new file mode 100644 index 0000000000..c1aefd2012 --- /dev/null +++ b/script/docker-compose/hertzbeat-mysql-tdengine/dbdata/taosdata/.gitignore @@ -0,0 +1,2 @@ +.gitignore +!.gitignore diff --git a/script/docker-compose/docker-compose.yaml b/script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml similarity index 94% rename from script/docker-compose/docker-compose.yaml rename to script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml index ad551c6fb7..e4dd204a5f 100644 --- a/script/docker-compose/docker-compose.yaml +++ b/script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml @@ -21,7 +21,7 @@ networks: services: mysql: - image: "mysql:5.7" + image: mysql:8 container_name: mysql hostname: mysql restart: always @@ -36,8 +36,8 @@ services: networks: - heartzbeat - TDengine: - image: "tdengine/tdengine:2.4.0.12" + tdengine: + image: tdengine/tdengine:2.4.0.12 container_name: tdengine hostname: tdengine restart: always @@ -52,7 +52,7 @@ services: - heartzbeat hertzbeat: - image: "tancloud/hertzbeat" + image: tancloud/hertzbeat container_name: hertzbeat hostname: hertzbeat restart: always