Skip to content

Commit

Permalink
Merge pull request #187 from citusdata/bump-docker-compose-3
Browse files Browse the repository at this point in the history
  • Loading branch information
hanefi authored Apr 30, 2020
2 parents 0eb397c + 52573a3 commit 7e1d693
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.1'
version: '3'

services:
master:
Expand All @@ -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:
2 changes: 1 addition & 1 deletion nightly/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions wait-for-manager.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 7e1d693

Please sign in to comment.