docker-compose wait for PG to be ready

- periodically ping postres on port 5432 and only start
migrations if successful.
- prevents crash loop when attempting migrations before
postgres is ready.
This commit is contained in:
Seth Foster 2023-03-10 14:12:43 -05:00
parent be27d89895
commit 6a3282a689

View File

@ -14,6 +14,10 @@ make awx-link
make version_file
if [[ -n "$RUN_MIGRATIONS" ]]; then
# wait for postgres to be ready
while ! nc -z postgres 5432; do
echo "Waiting for postgres to be ready to accept connections"; sleep 1;
done;
make migrate
else
wait-for-migrations