Merge pull request #2635 from tdonohue/docker_wait_on_db

[Docker] Ensure dspace container waits until db is accepting connections before starting Tomcat
This commit is contained in:
Tim Donohue
2020-01-09 11:23:53 -06:00
committed by GitHub

View File

@@ -20,11 +20,15 @@ services:
volumes:
- assetstore:/dspace/assetstore
- ./dspace/src/main/docker-compose/local.cfg:/dspace/config/local.cfg
# Ensure that the database is ready before starting tomcat
# Ensure that the database is ready BEFORE starting tomcat
# 1. While a TCP connection to dspacedb port 5432 is not available, continue to sleep
# 2. Then, run database migration to init database tables
# 3. Finally, start Tomcat
entrypoint:
- /bin/bash
- '-c'
- |
while (!</dev/tcp/dspacedb/5432) > /dev/null 2>&1; do sleep 1; done;
/dspace/bin/dspace database migrate
catalina.sh run
dspacedb:
@@ -34,6 +38,9 @@ services:
image: dspace/dspace-postgres-pgcrypto
networks:
dspacenet:
ports:
- published: 5432
target: 5432
stdin_open: true
tty: true
volumes: