Added wait-for-postgres, changed docker-compose files

pull/395/head
Piero Toffanin 2018-02-16 10:18:56 -05:00
rodzic 30a0ddb374
commit 17621e39b2
4 zmienionych plików z 18 dodań i 3 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
version: '2'
services:
webapp:
entrypoint: /bin/bash -c "chmod +x /webodm/*.sh && /bin/bash -c \"/webodm/wait-for-it.sh db:5432 -- /webodm/start.sh --create-default-pnode --setup-devenv\""
entrypoint: /bin/bash -c "chmod +x /webodm/*.sh && /bin/bash -c \"/webodm/wait-for-postgres.sh db /webodm/start.sh --create-default-pnode --setup-devenv\""
volumes:
- .:/webodm

Wyświetl plik

@ -5,7 +5,7 @@
version: '2'
services:
webapp:
entrypoint: /bin/bash -c "chmod +x /webodm/*.sh && /bin/bash -c \"/webodm/wait-for-it.sh db:5432 -- /webodm/start.sh --create-default-pnode\""
entrypoint: /bin/bash -c "chmod +x /webodm/*.sh && /bin/bash -c \"/webodm/wait-for-postgres.sh db /webodm/start.sh --create-default-pnode\""
depends_on:
- node-odm-1
node-odm-1:

Wyświetl plik

@ -17,7 +17,7 @@ services:
webapp:
image: opendronemap/webodm_webapp
container_name: webapp
entrypoint: /bin/bash -c "chmod +x /webodm/*.sh && /bin/bash -c \"/webodm/wait-for-it.sh db:5432 -- /webodm/start.sh\""
entrypoint: /bin/bash -c "chmod +x /webodm/*.sh && /bin/bash -c \"/webodm/wait-for-postgres.sh db /webodm/start.sh\""
volumes:
- ${WO_MEDIA_DIR}:/webodm/app/media
ports:

Wyświetl plik

@ -0,0 +1,15 @@
#!/bin/bash
set -e
host="$1"
shift
cmd="$@"
until psql -h "$host" -U "postgres" -c '\q'; do
>&2 echo "Postgres is unavailable - sleeping"
sleep 1
done
>&2 echo "Postgres is up - executing command"
exec $cmd