Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docker/image/console/root/usr/lib/task/database/available.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ function task_database_available()
local command=""

if [ "${DB_PLATFORM}" == "mysql" ]; then
command="mysqladmin -h $DB_HOST -u ${DB_ADMIN_USER:-$DB_USER} -p${DB_ROOT_PASS:-${DB_ADMIN_PASS:-$DB_PASS}} ping --connect_timeout=10"
command="mysqladmin -h $DB_HOST -u ${DB_ADMIN_USER:-$DB_USER} -p${DB_ROOT_PASS:-${DB_ADMIN_PASS:-$DB_PASS}} -P ${DB_PORT} ping --connect_timeout=10"
elif [ "${DB_PLATFORM}" == "postgres" ]; then
command="pg_isready -h $DB_HOST"
command="pg_isready -h $DB_HOST -U ${DB_ADMIN_USER:-$DB_USER} -p ${DB_PORT}"
elif [ "${DB_PLATFORM}" == "" ]; then
# no database is used
return
Expand All @@ -25,6 +25,10 @@ function task_database_available()
exit 1
fi

if ! (( counter % 5 )); then
echo "Waiting for database to become available: '${command}'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful about printing the database password out for mysql. Maybe direct to stderr too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "Waiting for database to become available: '${command}'"
echo "Waiting for database '$DB_HOST' to become available" >&2

fi

sleep 2
((++counter))
done
Expand Down