From: Emory Freitas Date: Mon, 11 Jan 2021 19:05:53 +0000 (-0400) Subject: Update docker composer file version and wait for postgres #2784 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67fb8c62c0beafa7788470ef00a724a824e2305f;p=thirdparty%2Ftornado.git Update docker composer file version and wait for postgres #2784 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 --- diff --git a/demos/blog/docker-compose.yml b/demos/blog/docker-compose.yml index 95f8e84f4..778800b18 100644 --- a/demos/blog/docker-compose.yml +++ b/demos/blog/docker-compose.yml @@ -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