Update yaml to include mariadb health check

This commit is contained in:
aditya.chandel
2025-03-13 09:52:02 -06:00
parent f2af06bdca
commit c27970a04c
2 changed files with 16 additions and 7 deletions

View File

@@ -62,9 +62,7 @@ MARIADB_CONFIG_PATH=/path/to/mariadb/config # Example: /home/user/booklore/m
Create a `docker-compose.yml` file in your project directory: Create a `docker-compose.yml` file in your project directory:
```ini ```yaml
version: '3.8'
services: services:
booklore: booklore:
image: ghcr.io/adityachandelgit/booklore-app:${BOOKLORE_IMAGE_TAG} image: ghcr.io/adityachandelgit/booklore-app:${BOOKLORE_IMAGE_TAG}
@@ -72,7 +70,8 @@ services:
env_file: env_file:
- .env - .env
depends_on: depends_on:
- mariadb mariadb:
condition: service_healthy
ports: ports:
- "6060:6060" - "6060:6060"
volumes: volumes:
@@ -87,6 +86,11 @@ services:
volumes: volumes:
- ${MARIADB_CONFIG_PATH}:/config - ${MARIADB_CONFIG_PATH}:/config
restart: unless-stopped restart: unless-stopped
healthcheck:
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
``` ```
Note: You can find the latest BookLore image tag `BOOKLORE_IMAGE_TAG` (e.g. v.0.x.x) from the Releases section: Note: You can find the latest BookLore image tag `BOOKLORE_IMAGE_TAG` (e.g. v.0.x.x) from the Releases section:
📦 [Latest Image Tag GitHub Releases](https://github.com/adityachandelgit/BookLore/releases) 📦 [Latest Image Tag GitHub Releases](https://github.com/adityachandelgit/BookLore/releases)

View File

@@ -1,4 +1,3 @@
version: '3.8'
services: services:
booklore: booklore:
image: ghcr.io/adityachandelgit/booklore-app:${BOOKLORE_IMAGE_TAG} image: ghcr.io/adityachandelgit/booklore-app:${BOOKLORE_IMAGE_TAG}
@@ -6,7 +5,8 @@ services:
env_file: env_file:
- .env - .env
depends_on: depends_on:
- mariadb mariadb:
condition: service_healthy
ports: ports:
- "6060:6060" - "6060:6060"
volumes: volumes:
@@ -21,3 +21,8 @@ services:
volumes: volumes:
- ${MARIADB_CONFIG_PATH}:/config - ${MARIADB_CONFIG_PATH}:/config
restart: unless-stopped restart: unless-stopped
healthcheck:
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5