Add healthchecks to docker-compose.yml (#36)

Add healthchecks
pull/54/head
ftoppi 2024-04-24 14:00:23 +02:00 committed by GitHub
parent 66a683c075
commit a20eece2d5
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: redis:
image: valkey/valkey:7.2 image: valkey/valkey:7.2
healthcheck:
test: valkey-cli ping || exit 1
interval: 2s
timeout: 1s
retries: 3
start_period: 30s
db: db:
# We use MariaDB because it supports ARM and has the expected collations # We use MariaDB because it supports ARM and has the expected collations
@ -27,6 +33,12 @@ services:
- mysql_data:/var/lib/mysql - mysql_data:/var/lib/mysql
cap_add: cap_add:
- SYS_NICE # CAP_SYS_NICE Prevent runaway mysql log - 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: misp-core:
image: ghcr.io/misp/misp-docker/misp-core:latest image: ghcr.io/misp/misp-docker/misp-core:latest
@ -46,8 +58,16 @@ services:
- PYPI_CYBOX_VERSION=${PYPI_CYBOX_VERSION} - PYPI_CYBOX_VERSION=${PYPI_CYBOX_VERSION}
- PYPI_PYMISP_VERSION=${PYPI_PYMISP_VERSION} - PYPI_PYMISP_VERSION=${PYPI_PYMISP_VERSION}
depends_on: depends_on:
- redis redis:
- db 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: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
@ -138,7 +158,8 @@ services:
environment: environment:
- "REDIS_BACKEND=redis" - "REDIS_BACKEND=redis"
depends_on: depends_on:
- redis redis:
condition: service_healthy
volumes: volumes:
mysql_data: mysql_data: