- 新增 app/baked/algorithm|pipeline,非部署参数不再走 env;Settings 保留 DB/HTTP/RTSP/海康/百度/MinIO/Demo - 移除 init_db_schema 与 reload 配置;main 仅 check_database;start*.sh 在 uvicorn 前执行 alembic upgrade head - 依赖 psycopg[binary] 供 Alembic 同步 URL;alembic/env 注释与预发清单更新 - 撕段门控消费管线、各视频/语音/归档调用改为 baked - 百度环境变量仅 BAIDU_APP_ID、BAIDU_API_KEY、BAIDU_SECRET_KEY 与 BAIDU_* 超时/ASR;人脸脚本与 baidu_speech 文案同步 - 全量单测与 .env.example 更新;.gitignore 忽略 refs/(本地权重/视频不入库) Made-with: Cursor
42 lines
1.5 KiB
Bash
Executable File
42 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Start PostgreSQL + MinIO from docker-compose.dev.yml and run FastAPI on the host.
|
|
# Usage: ./start.sh
|
|
# Optional: SKIP_DOCKER=1 to skip Compose and use an existing PostgreSQL instance.
|
|
# Same flow but TRUNCATE app tables before the server: ./start_fresh.sh
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$ROOT"
|
|
|
|
COMPOSE_FILE="${COMPOSE_FILE:-docker-compose.dev.yml}"
|
|
|
|
if [[ "${SKIP_DOCKER:-0}" != "1" ]]; then
|
|
echo "Starting Docker Compose services: db, minio ($COMPOSE_FILE)"
|
|
docker compose -f "$COMPOSE_FILE" up -d db minio
|
|
echo "MinIO API: http://127.0.0.1:${MINIO_PORT:-9000} console: http://127.0.0.1:${MINIO_CONSOLE_PORT:-9001}"
|
|
echo "Waiting for PostgreSQL..."
|
|
for _ in $(seq 1 60); do
|
|
if docker compose -f "$COMPOSE_FILE" exec -T db \
|
|
pg_isready -U "${POSTGRES_USER:-postgres}" -d "${POSTGRES_DB:-operation_room}" \
|
|
>/dev/null 2>&1; then
|
|
echo "PostgreSQL is ready."
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
else
|
|
echo "SKIP_DOCKER=1: not starting Docker Compose; using POSTGRES_* or DATABASE_URL from the environment."
|
|
fi
|
|
|
|
export POSTGRES_USER="${POSTGRES_USER:-postgres}"
|
|
export POSTGRES_PASSWORD="${POSTGRES_PASSWORD:-postgres}"
|
|
export POSTGRES_DB="${POSTGRES_DB:-operation_room}"
|
|
export POSTGRES_HOST="${POSTGRES_HOST:-localhost}"
|
|
export POSTGRES_PORT="${POSTGRES_PORT:-35432}"
|
|
|
|
echo "Applying database migrations (alembic upgrade head)..."
|
|
uv run alembic upgrade head
|
|
|
|
exec uv run uvicorn main:app --host "${HOST:-0.0.0.0}" --port "${PORT:-38080}" --reload
|