Skip to content

Commit

Permalink
mariadb healthcheck in docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
itsbekas committed Jan 25, 2025
1 parent 1f65958 commit bed0a02
Showing 1 changed file with 38 additions and 16 deletions.
54 changes: 38 additions & 16 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: "3.8"

services:
lifehub-mariadb:
image: mariadb:latest
Expand All @@ -14,19 +16,35 @@ services:
volumes:
- dbdata:/var/lib/mysql
- ./init-scripts/mariadb:/docker-entrypoint-initdb.d
healthcheck:
test:
[
"CMD",
"mariadb-admin",
"ping",
"-h",
"localhost",
"-u",
"${MARIADB_USER}",
"-p${MARIADB_PASSWORD}",
]
interval: 10s
retries: 5
start_period: 20s

lifehub-vault:
image: hashicorp/vault:latest
container_name: lifehub-vault
environment:
- VAULT_DEV_ROOT_TOKEN_ID=dev-root-token
- VAULT_DEV_LISTEN_ADDRESS=0.0.0.0:8200
VAULT_DEV_ROOT_TOKEN_ID: ${VAULT_DEV_ROOT_TOKEN_ID:-dev-root-token}
VAULT_DEV_LISTEN_ADDRESS: "0.0.0.0:8200"
ports:
- "8200:8200"
cap_add:
- IPC_LOCK
depends_on:
- lifehub-mariadb
lifehub-mariadb:
condition: service_healthy
volumes:
- vault-data:/vault/data

Expand All @@ -36,19 +54,21 @@ services:
dockerfile: Dockerfile.dev
container_name: lifehub-backend
environment:
- DB_HOST=lifehub-mariadb
- DB_NAME=${MARIADB_DATABASE}
- FRONTEND_URL=http://localhost
- VAULT_ADDR=http://lifehub-vault:8200
- VAULT_TOKEN=${VAULT_TOKEN}
- VAULT_DB_USER=${VAULT_DB_USER}
- VAULT_DB_PASSWORD=${VAULT_DB_PASSWORD}
- ENVIRONMENT=development
DB_HOST: lifehub-mariadb
DB_NAME: ${MARIADB_DATABASE}
FRONTEND_URL: http://localhost
VAULT_ADDR: http://lifehub-vault:8200
VAULT_TOKEN: ${VAULT_TOKEN}
VAULT_DB_USER: ${VAULT_DB_USER}
VAULT_DB_PASSWORD: ${VAULT_DB_PASSWORD}
ENVIRONMENT: development
ports:
- "8000:8000"
depends_on:
- lifehub-mariadb
- lifehub-vault
lifehub-mariadb:
condition: service_healthy
lifehub-vault:
condition: service_started
volumes:
- ./backend:/app

Expand All @@ -58,18 +78,20 @@ services:
dockerfile: Dockerfile.dev
container_name: lifehub-frontend
environment:
- VITE_BACKEND_URL=http://lifehub-backend:8000
- VITE_SESSION_SECRET=${SESSION_SECRET}
VITE_BACKEND_URL: http://lifehub-backend:8000
VITE_SESSION_SECRET: ${SESSION_SECRET}
ports:
- "80:5173"
depends_on:
- lifehub-backend
lifehub-backend:
condition: service_started
volumes:
- ./frontend:/app
- node_modules:/usr/src/app/node_modules

volumes:
node_modules:
driver: local
dbdata:
driver: local
vault-data:
Expand Down

0 comments on commit bed0a02

Please sign in to comment.