Merge pull request #10583 from coolbry95/waitfordb

wait for database connection
This commit is contained in:
Shane McDonald 2021-07-22 14:12:30 -04:00 committed by GitHub
commit 0e30c6639a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View File

@ -13,6 +13,10 @@ if [ -n "${AWX_KUBE_DEVEL}" ]; then
export SDB_NOTIFY_HOST=$MY_POD_IP
fi
set -e
wait-for-migrations
awx-manage collectstatic --noinput --clear
supervisord -c /etc/supervisord.conf

View File

@ -13,6 +13,8 @@ if [ -n "${AWX_KUBE_DEVEL}" ]; then
export SDB_NOTIFY_HOST=$MY_POD_IP
fi
set -e
wait-for-migrations
supervisord -c /etc/supervisord_task.conf

View File

@ -22,13 +22,20 @@ wait_for() {
local rc=1
local attempt=1
local next_sleep="${MIN_SLEEP}"
local check=1
while true; do
log_message "Attempt ${attempt} of ${ATTEMPTS}"
timeout "${TIMEOUT}" \
/bin/bash -c "! awx-manage showmigrations | grep '\[ \]'" &>/dev/null \
&& return || rc=$?
/bin/bash -c "awx-manage check" &>/dev/null
check=$?
if [ $check -eq 0 ]; then
timeout "${TIMEOUT}" \
/bin/bash -c "! awx-manage showmigrations | grep '\[ \]'" &>/dev/null \
&& return || rc=$?
fi
(( ++attempt > ATTEMPTS )) && break