Skip to content

Commit

Permalink
feat: 新增健康檢查到Traefik的Docker Compose設定
Browse files Browse the repository at this point in the history
新增了一個健康檢查服務到Traefik的Docker Compose設定中,以確保MySQL資料庫的可用性。

- 新增了一個健康檢查服務,使用`mysqladmin ping`命令來檢查MySQL資料庫的連線狀態。
- 設定了健康檢查的超時時間為20秒,最大重試次數為10次。
  • Loading branch information
hanshino committed Sep 16, 2024
1 parent 889dea7 commit a090ecc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docker-compose.traefik.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ services:
options:
max-size: "1k"
max-file: "3"
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-u $$DB_USER", "-p$$DB_PASSWORD" ]
timeout: 20s
retries: 10
environment:
"MYSQL_DATABASE": "${DB_DATABASE}"
"MYSQL_USER": "${DB_USER}"
Expand Down

0 comments on commit a090ecc

Please sign in to comment.