20 lines
979 B
Bash
Executable File
20 lines
979 B
Bash
Executable File
#!/bin/bash
|
||
# 本地启动(不使用 Docker,使用本地 PostgreSQL)
|
||
#
|
||
# 前置条件:
|
||
# 1. 本地 PostgreSQL 已安装并运行,且已安装 pgvector 扩展
|
||
# 2. 已创建数据库 th_agenter、用户 drgraph / 密码 yingping(与 docker-compose 一致)
|
||
# 创建示例:psql -U postgres -c "CREATE USER drgraph WITH PASSWORD 'yingping';"
|
||
# psql -U postgres -c "CREATE DATABASE th_agenter OWNER drgraph;"
|
||
# psql -U drgraph -d th_agenter -c "CREATE EXTENSION vector;"
|
||
# 3. 首次运行前执行迁移:DATABASE_URL="postgresql+asyncpg://drgraph:yingping@localhost:5432/th_agenter" python3 -m alembic upgrade head
|
||
#
|
||
# 也可在 .env 中设置 DATABASE_URL=postgresql+asyncpg://drgraph:yingping@localhost:5432/th_agenter
|
||
|
||
set -e
|
||
cd "$(dirname "$0")/.."
|
||
|
||
export DATABASE_URL="${DATABASE_URL:-postgresql+asyncpg://drgraph:yingping@localhost:5432/th_agenter}"
|
||
|
||
exec python3 -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload
|