20 lines
391 B
Bash
20 lines
391 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
MAX_RETRIES=10
|
|
COUNT=0
|
|
|
|
echo "Waiting for DB and running alembic migrations..."
|
|
until alembic upgrade head; do
|
|
COUNT=$((COUNT+1))
|
|
if [ "$COUNT" -ge "$MAX_RETRIES" ]; then
|
|
echo "Alembic migrations failed after $COUNT attempts." >&2
|
|
exit 1
|
|
fi
|
|
echo "Alembic failed, retrying in 3s... ($COUNT/$MAX_RETRIES)"
|
|
sleep 3
|
|
done
|
|
|
|
echo "Migrations applied."
|
|
exec "$@"
|