2017-07-21 22:22:01 +12:00
|
|
|
#!/usr/bin/with-contenv sh
|
|
|
|
|
|
|
|
|
|
# Wait for the DB to be reachable before proceeding. This avoids race condition
|
|
|
|
|
# whereby database is not ready (yet), and so TTRSS config isn't correctly created
|
|
|
|
|
|
|
|
|
|
#############
|
|
|
|
|
# This simply duplicates the logic from ttrss-configure-db.php
|
2017-07-21 22:41:52 +12:00
|
|
|
ename='DB';
|
|
|
|
|
eport=5432;
|
2017-07-21 22:22:01 +12:00
|
|
|
|
2017-07-21 22:41:52 +12:00
|
|
|
if [ '$DB_TYPE' = 'mysql' ];
|
2017-07-21 22:22:01 +12:00
|
|
|
then
|
2017-07-21 22:41:52 +12:00
|
|
|
eport=3306;
|
|
|
|
|
dbhost=$DB_PORT_3306_TCP_ADDR
|
2017-07-21 22:22:01 +12:00
|
|
|
else
|
2017-07-21 22:41:52 +12:00
|
|
|
eport=5432;
|
|
|
|
|
dbhost=$DB_PORT_5432_TCP_ADDR
|
2017-07-21 22:22:01 +12:00
|
|
|
fi
|
|
|
|
|
#############
|
|
|
|
|
|
|
|
|
|
# Run wait-for-it.sh to confirm DB comes up before we proceed
|
2017-07-21 22:56:08 +12:00
|
|
|
echo "Waiting up to 60s for $dbhost:$eport..."
|
|
|
|
|
/srv/wait-for $dbhost:$eport --timeout=60 -- echo "Done"
|