[DockerCompose] Add host to db healthchecks to wait for initdb scripts to run

This commit is contained in:
Aaro Koivukangas
2026-08-09 01:48:41 +03:00
committed by Aaro Koivukangas
parent 25c14aac0f
commit 2eeb9b0bd0
4 changed files with 33 additions and 25 deletions
+5 -3
View File
@@ -2,9 +2,11 @@ x-defaults: &defaults
restart: unless-stopped
x-healthcheck-defaults: &healthcheck-defaults
interval: 1s
timeout: 3s
retries: 30
interval: 30s # Normal healthcehck interval
timeout: 5s
retries: 10 # Retries until SIGKILl
start_interval: 3s # How often healthcheck runs while starting
start_period: 15s # How long startup period is
services:
kone-db:
+11 -9
View File
@@ -4,9 +4,11 @@ x-defaults: &defaults
restart: unless-stopped
x-healthcheck-defaults: &healthcheck-defaults
interval: 1s
timeout: 3s
retries: 30
interval: 30s # Normal healthcehck interval
timeout: 5s
retries: 10 # Retries until SIGKILl
start_interval: 3s # How often healthcheck runs while starting
start_period: 30s # How long startup period is
services:
backend:
@@ -71,7 +73,7 @@ services:
ports:
- 4321:5432
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
test: ['CMD', 'pg_isready', '-U', 'postgres', '-h', '127.0.0.1']
<<: *healthcheck-defaults
user-db:
@@ -85,7 +87,7 @@ services:
ports:
- 4320:5432
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
test: ['CMD', 'pg_isready', '-U', 'postgres', '-h', '127.0.0.1']
<<: *healthcheck-defaults
redis:
@@ -112,7 +114,7 @@ services:
ports:
- 12345:5432
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
test: ['CMD', 'pg_isready', '-U', 'postgres', '-h', '127.0.0.1']
<<: *healthcheck-defaults
sis-importer-db:
@@ -124,7 +126,7 @@ services:
ports:
- 12346:5432
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
test: ['CMD', 'pg_isready', '-U', 'postgres', '-h', '127.0.0.1']
<<: *healthcheck-defaults
jami:
@@ -145,14 +147,14 @@ services:
jami-db:
<<: *defaults
container_name: oodikone-jami-db
image: postgres:15.10
image: registry-toska.ext.ocp-prod-0.k8s.it.helsinki.fi/jami-db
environment:
- PGDATA=/data
- POSTGRES_PASSWORD=postgres
ports:
- 5433:5432
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
test: ['CMD', 'pg_isready', '-U', 'postgres', '-h', '127.0.0.1']
<<: *healthcheck-defaults
# This is still needed to make backend calls correctly route from localhost:5000/api to localhost:8080
+6 -4
View File
@@ -4,9 +4,11 @@ x-defaults: &defaults
restart: unless-stopped
x-healthcheck-defaults: &healthcheck-defaults
interval: 1s
timeout: 3s
retries: 30
interval: 30s # Normal healthcehck interval
timeout: 5s
retries: 10 # Retries until SIGKILl
start_interval: 3s # How often healthcheck runs while starting
start_period: 30s # How long startup period is
services:
sis-db:
@@ -23,5 +25,5 @@ services:
ports:
- 12345:5432
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
test: ['CMD', 'pg_isready', '-U', 'postgres', '-h', '127.0.0.1']
<<: *healthcheck-defaults
+11 -9
View File
@@ -7,9 +7,11 @@ x-build_defaults: &build_defaults
dockerfile: dev.Dockerfile
x-healthcheck-defaults: &healthcheck-defaults
interval: 1s
timeout: 3s
retries: 30
interval: 30s # Normal healthcehck interval
timeout: 5s
retries: 10 # Retries until SIGKILl
start_interval: 3s # How often healthcheck runs while starting
start_period: 30s # How long startup period is
services:
adminer:
@@ -94,7 +96,7 @@ services:
volumes:
- kone-db-data:/data
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
test: ['CMD', 'pg_isready', '-U', 'postgres', '-h', '127.0.0.1']
<<: *healthcheck-defaults
user-db:
@@ -108,7 +110,7 @@ services:
volumes:
- user-db-data:/data
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
test: ['CMD', 'pg_isready', '-U', 'postgres', '-h', '127.0.0.1']
<<: *healthcheck-defaults
redis:
@@ -134,7 +136,7 @@ services:
ports:
- 12345:5432
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
test: ['CMD', 'pg_isready', '-U', 'postgres', '-h', '127.0.0.1']
<<: *healthcheck-defaults
sis-importer-db:
@@ -148,7 +150,7 @@ services:
ports:
- 12346:5432
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
test: ['CMD', 'pg_isready', '-U', 'postgres', '-h', '127.0.0.1']
<<: *healthcheck-defaults
jami:
@@ -171,7 +173,7 @@ services:
jami-db:
<<: *defaults
container_name: oodikone-jami-db
image: postgres:15.10
image: registry-toska.ext.ocp-prod-0.k8s.it.helsinki.fi/jami-db
environment:
- PGDATA=/data
- POSTGRES_PASSWORD=postgres
@@ -180,7 +182,7 @@ services:
volumes:
- jami-data:/data
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
test: ['CMD', 'pg_isready', '-U', 'postgres', '-h', '127.0.0.1']
<<: *healthcheck-defaults
sis-updater-worker: