#!/bin/sh set -e if [ -n "$DATABASE_URL" ]; then until PGPASSWORD="${POSTGRES_PASSWORD:-accounting_password}" psql -h "${DB_HOST:-accounting-db}" -U "${POSTGRES_USER:-accounting_user}" -d "${POSTGRES_DB:-accounting_db}" -c '\q' 2>/dev/null; do >&2 echo "PostgreSQL is unavailable - sleeping" sleep 1 done >&2 echo "PostgreSQL is up" fi python manage.py migrate --noinput exec "$@"