Files
operating-room-monitor-server/start_fresh.sh
Kevin 8a4bad99d3 feat: 配置写死与 baked 模块,Alembic 建表,百度仅 BAIDU_*
- 新增 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
2026-04-24 15:33:22 +08:00

45 lines
1.6 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 与 start.sh 相同,唯一额外步骤:在启动 API 前清空本应用业务表(见 scripts/start_fresh.py
# 用法与 start 一致: SKIP_DOCKER=1、COMPOSE_FILE、PORT 等,参见 start.sh
#
# 仅清空库、不启动服务: uv run python scripts/start_fresh.py
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
echo "start_fresh: clearing app tables (TRUNCATE)..."
uv run python scripts/start_fresh.py
exec uv run uvicorn main:app --host "${HOST:-0.0.0.0}" --port "${PORT:-38080}" --reload