From a372a2e414001839c37c3e8bf31b6319543c53f6 Mon Sep 17 00:00:00 2001
From: quartztester <91350035+quartztester@users.noreply.github.com>
Date: Wed, 6 Jul 2022 13:16:33 -0400
Subject: [PATCH] Extended condition for depends_upon db

---
 docker-compose.yml | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/docker-compose.yml b/docker-compose.yml
index ecbb944..4ef1068 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -33,7 +33,13 @@ services:
     volumes:
       - ${data}/db:/var/lib/postgresql/data
     command: postgres -c fsync=off -c synchronous_commit=off -c full_page_writes=off -c random_page_cost=1.0
-
+    #Checking health of Postgres db
+    healthcheck:
+      test: ["CMD-SHELL", "pg_isready -U ${dbUser}"]
+      interval: 5s
+      timeout: 5s
+      retries: 5
+      
   frontend:
     image: reallibrephotos/librephotos-frontend:${tag}
     container_name: frontend
@@ -74,7 +80,8 @@ services:
 
     # Wait for Postgres
     depends_on:
-      - db
+      db:
+        condition: service_healthy
 
   redis:
     image: redis:6
-- 
GitLab