Initial GeoIntel V1 foundation
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
echo "Waiting for database connection..."
|
||||
python - <<'PY'
|
||||
import time
|
||||
|
||||
from sqlalchemy import create_engine, text
|
||||
|
||||
from app.core.config import get_settings
|
||||
|
||||
settings = get_settings()
|
||||
last_error = None
|
||||
|
||||
for attempt in range(1, 31):
|
||||
try:
|
||||
engine = create_engine(settings.database_url, pool_pre_ping=True, future=True)
|
||||
with engine.connect() as connection:
|
||||
connection.execute(text("SELECT 1"))
|
||||
print(f"Database connection ready after attempt {attempt}.")
|
||||
break
|
||||
except Exception as exc:
|
||||
last_error = exc
|
||||
print(f"Database not ready yet ({attempt}/30): {exc}")
|
||||
time.sleep(2)
|
||||
else:
|
||||
raise SystemExit(f"Database did not become ready: {last_error}")
|
||||
PY
|
||||
|
||||
python -m alembic upgrade head
|
||||
exec uvicorn app.main:app --host 0.0.0.0 --port 8000
|
||||
Reference in New Issue
Block a user