Web container waits for DB container to be ready

Fixes the setup issue almost all Raspberry Pi users have and probably some others with slow or low spec systems.
The web_recipes container waits for db_recipes to be healthy.
db_recipes is healthy, as soon as postgres is completely ready.

Note: ps_isready doesn't work here for some reason.

Tested multiple times with a Raspberry Pi 4.
This commit is contained in:
MaxJa4
2022-01-30 01:19:50 +01:00
committed by GitHub
parent 9fcfa17004
commit fb29db7aad

View File

@@ -7,6 +7,11 @@ services:
- ./postgresql:/var/lib/postgresql/data
env_file:
- ./.env
healthcheck:
test: ["CMD-SHELL", "psql -U $$POSTGRES_USER -d $$POSTGRES_DB --list || exit 1"]
interval: 5s
timeout: 2s
retries: 5
web_recipes:
image: vabene1111/recipes
@@ -18,7 +23,8 @@ services:
- nginx_config:/opt/recipes/nginx/conf.d
- ./mediafiles:/opt/recipes/mediafiles
depends_on:
- db_recipes
db_recipes:
condition: service_healthy
nginx_recipes:
image: nginx:mainline-alpine
@@ -36,4 +42,4 @@ services:
volumes:
nginx_config:
staticfiles:
staticfiles: