auto_trade_sys/backend/start.sh
薇薇安 282b493b36 a
2026-01-13 19:27:15 +08:00

33 lines
812 B
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.

#!/bin/bash
# 生产环境启动脚本
cd "$(dirname "$0")"
# 激活虚拟环境
if [ -d "../.venv" ]; then
source ../.venv/bin/activate
elif [ -d ".venv" ]; then
source .venv/bin/activate
else
echo "错误: 找不到虚拟环境"
exit 1
fi
# 设置环境变量
export DB_HOST=${DB_HOST:-deepx2025.cb6swsyucgro.ap-east-1.rds.amazonaws.com}
export DB_PORT=${DB_PORT:-3306}
export DB_USER=${DB_USER:-autosys}
export DB_PASSWORD=${DB_PASSWORD:-as2025}
export DB_NAME=${DB_NAME:-auto_trade_sys}
export CORS_ORIGINS=${CORS_ORIGINS:-http://localhost:3000,http://localhost:5173}
# 创建日志目录
mkdir -p logs
# 启动服务(后台运行)
nohup uvicorn api.main:app --host 0.0.0.0 --port 8001 > logs/api.log 2>&1 &
echo "后端服务已启动PID: $!"
echo "日志文件: logs/api.log"