Browse Source

added healthcheck

admin 2 months ago
parent
commit
a91c706fba
1 changed files with 16 additions and 11 deletions
  1. 16 11
      docker-compose.yml

+ 16 - 11
docker-compose.yml

@@ -1,16 +1,21 @@
 version: '3.8'
 
 services:
-   db:
-     image: mariadb:10.6 # pinned to stable release
-     container_name: db
-     volumes:
-       - ./data/mysql:/var/lib/mysql/
-       - ./data/backup:/mnt/backup
-     restart: on-failure:3
-     environment:
-       MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
+  db:
+    image: mariadb:10.6 # pinned to stable release
+    container_name: db
+    volumes:
+      - ./data/mysql:/var/lib/mysql/
+      - ./data/backup:/mnt/backup
+    restart: on-failure:3
+    environment:
+      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
+    healthcheck:
+      test: ["CMD", "/usr/local/bin/healthcheck.sh", "--connect"]
+      interval: 15s #interval for the first and subsequent checks
+      timeout: 10s
+      retries: 3
 
 networks:
-   db_default:
-     external: true
+  db_default:
+    external: true