feat: initialize deployment governance
This commit is contained in:
26
infra/backend-entrypoint.sh
Normal file
26
infra/backend-entrypoint.sh
Normal 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 "$@"
|
||||
Reference in New Issue
Block a user