From ec747349da8417d6b8ea6067ff11d7af6ac4558a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanefi=20=C3=96nald=C4=B1?= Date: Mon, 13 Apr 2020 11:30:04 +0300 Subject: [PATCH 1/2] Implement service dependencies --- Dockerfile | 3 ++- docker-compose.yml | 17 ++++++++++++----- nightly/docker-compose.yml | 2 +- wait-for-manager.sh | 13 +++++++++++++ 4 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 wait-for-manager.sh diff --git a/Dockerfile b/Dockerfile index 6668b05..41e3019 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,8 @@ RUN echo "shared_preload_libraries='citus'" >> /usr/share/postgresql/postgresql. COPY 000-configure-stats.sh 001-create-citus-extension.sql /docker-entrypoint-initdb.d/ # add health check script -COPY pg_healthcheck / +COPY pg_healthcheck wait-for-manager.sh / +RUN chmod +x /wait-for-manager.sh # entry point unsets PGPASSWORD, but we need it to connect to workers # https://github.com/docker-library/postgres/blob/33bccfcaddd0679f55ee1028c012d26cd196537d/12/docker-entrypoint.sh#L303 diff --git a/docker-compose.yml b/docker-compose.yml index b0c2065..7743bd2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '2.1' +version: '3' services: master: @@ -15,11 +15,18 @@ services: worker: image: 'citusdata/citus:9.2.4' labels: ['com.citusdata.role=Worker'] - depends_on: { manager: { condition: service_healthy } } + depends_on: [ manager ] environment: *AUTH + command: "/wait-for-manager.sh" + volumes: + - healthcheck-volume:/healthcheck manager: container_name: "${COMPOSE_PROJECT_NAME:-citus}_manager" - image: 'citusdata/membership-manager:0.2.1' - volumes: ['/var/run/docker.sock:/var/run/docker.sock'] - depends_on: { master: { condition: service_healthy } } + image: 'citusdata/membership-manager:0.3.0' + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - healthcheck-volume:/healthcheck + depends_on: [ master ] environment: *AUTH +volumes: + healthcheck-volume: diff --git a/nightly/docker-compose.yml b/nightly/docker-compose.yml index 01a0b5a..b73a9df 100644 --- a/nightly/docker-compose.yml +++ b/nightly/docker-compose.yml @@ -19,7 +19,7 @@ services: environment: *AUTH manager: container_name: "${COMPOSE_PROJECT_NAME:-citus}_manager" - image: 'citusdata/membership-manager:0.2.1' + image: 'citusdata/membership-manager:latest' volumes: ['/var/run/docker.sock:/var/run/docker.sock'] depends_on: { master: { condition: service_healthy } } environment: *AUTH diff --git a/wait-for-manager.sh b/wait-for-manager.sh new file mode 100644 index 0000000..36e41d3 --- /dev/null +++ b/wait-for-manager.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# wait-for-manager.sh + +set -e + +until test -f /healthcheck/manager-ready ; do + >&2 echo "Manager is not ready - sleeping" + sleep 1 +done + +>&2 echo "Manager is up - starting worker" + +exec gosu postgres "/docker-entrypoint.sh" "postgres" From 52573a3002363e4fb9df5941998dbce33e7946df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanefi=20=C3=96nald=C4=B1?= Date: Thu, 30 Apr 2020 13:02:11 +0300 Subject: [PATCH 2/2] Add Changelog entry for Docker Compose V3 support --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3eeafe0..ac25053 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### citus-docker v9.2.4-2.docker (March 31, 2020) ### + +* Add Docker Compose V3 support + ### citus-docker v9.2.4.docker (March 31, 2020) ### * Bump Citus version to 9.2.4