Update docker-compose.yml: add healthchecks

Added healthchecks for redis, db and misp-core services.
misp-core and misp-modules now wait for redis and db to be healthy before starting.
pull/36/head
ftoppi 2024-03-29 16:26:52 +01:00 committed by GitHub
parent 2900f7de96
commit c0a1eda407
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 24 additions and 3 deletions

View File

@ -13,6 +13,12 @@ services:
redis:
image: eqalpha/keydb:x86_64_v6.3.4
healthcheck:
test: keydb-cli ping || exit 1
interval: 2s
timeout: 1s
retries: 3
start_period: 30s
db:
# We use MariaDB because it supports ARM and has the expected collations
@ -27,6 +33,12 @@ services:
- mysql_data:/var/lib/mysql
cap_add:
- SYS_NICE # CAP_SYS_NICE Prevent runaway mysql log
healthcheck:
test: mysqladmin --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD status
interval: 2s
timeout: 1s
retries: 3
start_period: 30s
misp-core:
image: ghcr.io/misp/misp-docker/misp-core:latest
@ -46,8 +58,16 @@ services:
- PYPI_CYBOX_VERSION=${PYPI_CYBOX_VERSION}
- PYPI_PYMISP_VERSION=${PYPI_PYMISP_VERSION}
depends_on:
- redis
- db
redis:
condition: service_healthy
db:
condition: service_healthy
healthcheck:
test: curl -ks https://localhost/users/login > /dev/null || exit 1
interval: 2s
timeout: 1s
retries: 3
start_period: 30s
ports:
- "80:80"
- "443:443"
@ -126,7 +146,8 @@ services:
environment:
- "REDIS_BACKEND=redis"
depends_on:
- redis
redis:
condition: service_healthy
volumes:
mysql_data: