Skip to content

Commit

Permalink
[Improve] run hertzbeat in docker compose support dependen service co…
Browse files Browse the repository at this point in the history
…ndition (#1748)
  • Loading branch information
gjjjj0101 authored Apr 15, 2024
1 parent 37869aa commit 778666c
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 24 deletions.
17 changes: 15 additions & 2 deletions script/docker-compose/hertzbeat-mysql-iotdb/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ services:
container_name: compose-mysql
hostname: mysql
restart: always
healthcheck:
test: ['CMD-SHELL', 'mysqladmin ping -h 127.0.0.1 --silent']
interval: 3s
retries: 5
start_period: 3m
ports:
- "3306"
environment:
Expand All @@ -41,6 +46,12 @@ services:
container_name: compose-iotdb
hostname: iotdb
restart: always
healthcheck:
test: ["CMD", "ls", "/iotdb/data"]
interval: 10s
retries: 5
timeout: 5s
start_period: 30s
environment:
TZ: Asia/Shanghai
ports:
Expand All @@ -60,8 +71,10 @@ services:
TZ: Asia/Shanghai
LANG: zh_CN.UTF-8
depends_on:
- mysql
- iotdb
mysql:
condition: service_healthy
iotdb:
condition: service_healthy
volumes:
- ./conf/application.yml:/opt/hertzbeat/config/application.yml
- ./conf/sureness.yml:/opt/hertzbeat/config/sureness.yml
Expand Down
17 changes: 15 additions & 2 deletions script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ services:
container_name: compose-mysql
hostname: mysql
restart: always
healthcheck:
test: ['CMD-SHELL', 'mysqladmin ping -h 127.0.0.1 --silent']
interval: 3s
retries: 5
start_period: 3m
ports:
- "3306"
environment:
Expand All @@ -41,6 +46,12 @@ services:
container_name: compose-tdengine
hostname: tdengine
restart: always
healthcheck:
test: ['CMD-SHELL', 'curl -u root:taosdata -d "show databases" tdengine:6041/rest/sql']
interval: 10s
retries: 5
timeout: 5s
start_period: 1m
environment:
TZ: Asia/Shanghai
ports:
Expand All @@ -59,8 +70,10 @@ services:
TZ: Asia/Shanghai
LANG: zh_CN.UTF-8
depends_on:
- mysql
- tdengine
mysql:
condition: service_healthy
tdengine:
condition: service_healthy
volumes:
- ./conf/application.yml:/opt/hertzbeat/config/application.yml
- ./conf/sureness.yml:/opt/hertzbeat/config/sureness.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ services:
container_name: compose-mysql
hostname: mysql
restart: always
healthcheck:
test: ['CMD-SHELL', 'mysqladmin ping -h 127.0.0.1 --silent']
interval: 3s
retries: 5
start_period: 3m
ports:
- "3306"
environment:
Expand All @@ -41,6 +46,12 @@ services:
container_name: compose-victoria-metrics
hostname: victoria-metrics
restart: always
healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://victoria-metrics:8428/-/healthy"]
interval: 10s
retries: 5
timeout: 5s
start_period: 30s
environment:
TZ: Asia/Shanghai
ports:
Expand All @@ -59,8 +70,10 @@ services:
TZ: Asia/Shanghai
LANG: zh_CN.UTF-8
depends_on:
- mysql
- victoria-metrics
mysql:
condition: service_healthy
victoria-metrics:
condition: service_healthy
volumes:
- ./conf/application.yml:/opt/hertzbeat/config/application.yml
- ./conf/sureness.yml:/opt/hertzbeat/config/sureness.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@ spring:

# 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
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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ services:
container_name: compose-postgresql
hostname: postgresql
restart: always
healthcheck:
test: [ "CMD", "pg_isready" ]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
ports:
- '5432:5432'
environment:
Expand All @@ -41,6 +47,12 @@ services:
container_name: compose-iotdb
hostname: iotdb
restart: always
healthcheck:
test: ["CMD", "ls", "/iotdb/data"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
environment:
TZ: Asia/Shanghai
ports:
Expand All @@ -60,8 +72,10 @@ services:
TZ: Asia/Shanghai
LANG: zh_CN.UTF-8
depends_on:
- postgres
- iotdb
postgres:
condition: service_healthy
iotdb:
condition: service_healthy
volumes:
- ./conf/application.yml:/opt/hertzbeat/config/application.yml
- ./conf/sureness.yml:/opt/hertzbeat/config/sureness.yml
Expand Down

0 comments on commit 778666c

Please sign in to comment.