]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Update docker composer file version and wait for postgres #2784 2976/head
authorEmory Freitas <emory.rvf@gmail.com>
Mon, 11 Jan 2021 19:05:53 +0000 (15:05 -0400)
committerEmory Freitas <emory.rvf@gmail.com>
Mon, 11 Jan 2021 19:12:44 +0000 (15:12 -0400)
This is a new approach to avoid Docker image python app initialize first, causing a failure in connection between python app and postgres.

Signed-off-by: Emory Freitas <emory.rvf@gmail.com>
demos/blog/docker-compose.yml

index 95f8e84f4b0f7fd4383df2153508c1de7b9090a8..778800b18d6b4ac0cc06dc786702e2a3ee8d6726 100644 (file)
@@ -1,15 +1,25 @@
-postgres:
-  image: postgres:10.3
-  environment:
-    POSTGRES_USER: blog
-    POSTGRES_PASSWORD: blog
-    POSTGRES_DB: blog
-  ports:
-    - "3306"
-blog:
-  build: .
-  links:
-    - postgres
-  ports:
-    - "8888:8888"
-  command: --db_host=postgres
+version: "3.8"
+services:
+  postgres:
+    image: postgres:10.3
+    environment:
+      POSTGRES_USER: blog
+      POSTGRES_PASSWORD: blog
+      POSTGRES_DB: blog
+    ports:
+      - "3306"
+    healthcheck:
+      test: ["CMD-SHELL", "pg_isready -U postgres"]
+      interval: 5s
+      timeout: 5s
+      retries: 5
+  blog:
+    build: .
+    links:
+      - postgres
+    depends_on:
+      postgres:
+        condition: service_healthy
+    ports:
+      - "8888:8888"
+    command: --db_host=postgres