Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing _check_db_availability function in run.sh #160

Merged
merged 1 commit into from
Dec 18, 2020
Merged
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
19 changes: 7 additions & 12 deletions src/app/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,13 @@ function _override_entrypoint() {
}

function _check_db_availability() {
_info "Verifying if Postgres in running..."
cmd=$(command -v pg_isready)
cmd="${cmd} -h ${DJANGO_DATABASE_HOST} -p ${DJANGO_DATABASE_PORT} -U ${DJANGO_DATABASE_USER} -d ${DJANGO_DATABASE_NAME} -t 1"
while ! ${cmd} >/dev/null 2>&1; do
TIMER=$((TIMER-1))
sleep 1
if [[ "${TIMER}" -eq 0 ]]; then
_error "Could not connect to database server. Exiting..."
exit 1
fi
echo -n "."
done
_info "Verifying Database connectivity..."
cmd=$(command -v python3)
"${cmd}" /dsmr/manage.py shell -c 'import django; print(django.db.connection.ensure_connection()); quit();'
if [[ "$?" -ne 0 ]]; then
_error "Could not connect to database server. Exiting..."
exit 1
fi
}

function _run_post_config() {
Expand Down