Skip to content

Commit

Permalink
Merge pull request #2635 from tdonohue/docker_wait_on_db
Browse files Browse the repository at this point in the history
[Docker] Ensure dspace container waits until db is accepting connections before starting Tomcat
  • Loading branch information
tdonohue committed Jan 9, 2020
2 parents a0ca6e2 + da3a48e commit 053eb1b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -34,6 +38,9 @@ services:
image: dspace/dspace-postgres-pgcrypto
networks:
dspacenet:
ports:
- published: 5432
target: 5432
stdin_open: true
tty: true
volumes:
Expand Down

0 comments on commit 053eb1b

Please sign in to comment.