门户估价对话、会员与智能体账号,以及生产 Docker 部署一直停在工作区,远端主分支还没有这些改动。 Co-authored-by: Cursor <cursoragent@cursor.com>
60 lines
1.6 KiB
Bash
Executable File
60 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
python - <<'PY'
|
|
import os
|
|
import time
|
|
import urllib.request
|
|
|
|
import pymysql
|
|
import redis
|
|
|
|
deadline = time.time() + 180
|
|
mysql = dict(
|
|
host=os.environ.get("MYSQL_HOST", "mysql"),
|
|
port=int(os.environ.get("MYSQL_PORT", "3306")),
|
|
user=os.environ.get("MYSQL_USER", "gsfdc"),
|
|
password=os.environ.get("MYSQL_PASSWORD", ""),
|
|
database=os.environ.get("MYSQL_DATABASE", "gsfdc"),
|
|
connect_timeout=3,
|
|
)
|
|
redis_host = os.environ.get("REDIS_HOST", "redis")
|
|
redis_port = int(os.environ.get("REDIS_PORT", "6379"))
|
|
redis_password = os.environ.get("REDIS_PASSWORD") or None
|
|
minio = os.environ.get("MINIO_ENDPOINT", "minio:9000").removeprefix("http://").removeprefix("https://")
|
|
minio_url = "http://" + minio.rstrip("/") + "/minio/health/live"
|
|
|
|
last = "starting"
|
|
while time.time() < deadline:
|
|
try:
|
|
conn = pymysql.connect(**mysql)
|
|
conn.close()
|
|
client = redis.Redis(
|
|
host=redis_host,
|
|
port=redis_port,
|
|
password=redis_password,
|
|
socket_connect_timeout=3,
|
|
socket_timeout=3,
|
|
)
|
|
client.ping()
|
|
with urllib.request.urlopen(minio_url, timeout=3) as response:
|
|
if response.status != 200:
|
|
raise RuntimeError(f"minio {response.status}")
|
|
print("dependencies ready", flush=True)
|
|
break
|
|
except Exception as exc:
|
|
last = str(exc)
|
|
time.sleep(3)
|
|
else:
|
|
raise SystemExit(f"dependencies not ready: {last}")
|
|
PY
|
|
|
|
workers="${UVICORN_WORKERS:-1}"
|
|
exec python -m uvicorn app.main:app \
|
|
--host 0.0.0.0 \
|
|
--port 8000 \
|
|
--workers "$workers" \
|
|
--proxy-headers \
|
|
--forwarded-allow-ips "*" \
|
|
--no-access-log
|