feat: initialize deployment governance

This commit is contained in:
hailin
2026-07-01 14:29:24 +08:00
parent 9fc8101f96
commit 85f3fd9af4
12 changed files with 215 additions and 37 deletions

View File

@@ -0,0 +1,26 @@
#!/bin/sh
set -eu
python - <<'PY'
import os
import socket
import time
host = os.environ.get("POSTGRES_HOST", "postgres")
port = int(os.environ.get("POSTGRES_PORT", "5432"))
deadline = time.time() + int(os.environ.get("POSTGRES_WAIT_TIMEOUT", "60"))
while True:
try:
with socket.create_connection((host, port), timeout=2):
break
except OSError:
if time.time() > deadline:
raise SystemExit(f"Timed out waiting for PostgreSQL at {host}:{port}")
time.sleep(1)
PY
python manage.py migrate --noinput
python manage.py bootstrap_governance
exec "$@"