Production
This commit is contained in:
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# Container entrypoint: bring the schema up to date, then hand over to the server.
|
||||
# Migrations are idempotent, so restarting the container is always safe. Data import
|
||||
# scripts (which replace table contents) are never run from here.
|
||||
set -eu
|
||||
|
||||
if [ "${RUN_MIGRATIONS:-1}" = "1" ]; then
|
||||
attempt=1
|
||||
until alembic upgrade head; do
|
||||
if [ "$attempt" -ge 15 ]; then
|
||||
echo "entrypoint: database migration failed after $attempt attempts" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "entrypoint: database not ready (attempt $attempt), retrying in 3s" >&2
|
||||
attempt=$((attempt + 1))
|
||||
sleep 3
|
||||
done
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user